On Tue, 11 Sep 2001, Ken Wood <[EMAIL PROTECTED]> wrote:
> Since some of us are not good at reading source code
> and deducing what the xml should look like, could
> you please provide an example or two???
Sure 8-)
<if> supports three types of nested child elements:
(1) Exactly one condition - the same way <condition> has exactly one
condition child, i.e. one of <not>, <and>, <or>, <available>,
<uptodate>, <os>, <equals>.
(2) Zero or one <then> element.
(3) Zero or one <else> element.
<then> and <else> can themselves contain an arbitrary number of tasks.
If the condition is true the tasks in the <then> element (if present)
will be executed, otherwise the tasks in the <else> element (if
present) will be executed.
<project default="if">
<target name="if">
<if>
<or>
<equals arg1="${foo}" arg2="bar" />
<equals arg1="${foo}" arg2="baz" />
</or>
<then>
<echo message="foo is boring" />
</then>
<else>
<echo message="foo is not that boring" />
</else>
</if>
</target>
</project>
would be one example, where values of bar and baz for the property foo
would be considered boring.
<condition property="foo" value="bar">
<some-condition>
</condition>
would be a shortcut for
<if>
<some-condition>
<then>
<property name="foo" value="bar">
</then>
</if>
(just that <condition> will override existing properties).
Stefan