Thanks Stefan,

It worked just fine!

//Mikael

-----Original Message-----
From: Stefan Bodewig [mailto:[EMAIL PROTECTED]
Sent: den 28 april 2005 10:53
To: user@ant.apache.org
Subject: Re: check property


On Thu, 28 Apr 2005, Mikael Petterson <[EMAIL PROTECTED]>
wrote:

> In my ant build.xml I have a property called:
> 
> <property name="xsl.file" value="interface.xsl"/>
> 
> This can be changed when I run my build.xml ( from -Dxml.file) when
> starting ant.
> 
> How can I check the value of 'xsl.file' and depending on the value
> give another poperty ('pkg') a value

> if xsl.file = interface.xsl --> pkg = /se/company/app/interface
> if xsl.file = enumeration.xsl --> pkg= /se/company/app/interface

note that your values for pkg are the same ;-)

<condition property="pkg" value="second-line">
  <equals arg1="enumeration.xsl" arg2="${xsl.file}"/>
</condition>
<property name="pkg" value="first-line"/>

You could use a second condition, but since your first line is your
default, you can as well use a default for pkg.

This is the general pattern of conditional properties in Ant, set your
default value last.

Both <condition> and <property> will no override an existing property
and <condition> won't even evaluate the condition if it finds the
property has already been set.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to