You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Mikael Petterson (KI/EAB)" <mi...@ericsson.com> on 2005/04/28 10:39:28 UTC
check property
Hi,
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
like:
if xsl.file = interface.xsl --> pkg = /se/company/app/interface
if xsl.file = enumeration.xsl --> pkg= /se/company/app/interface
All hints are very much appreciated.
Cheers,
//Mikael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: check property
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 28 Apr 2005, Mikael Petterson <mi...@ericsson.com>
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org