ant xmltask节点如果
我的新问题是if条件标签 事实上,当param为0时,我无法进入条件“then”ant xmltask节点如果,xml,if-statement,ant,ant-contrib,xmltask,Xml,If Statement,Ant,Ant Contrib,Xmltask,我的新问题是if条件标签 事实上,当param为0时,我无法进入条件“then” <xmltask source="rapport.xml"> <call path="//testsuites"> <param name="chaine" path="@name"/> <param name="testsuite1" path="tests
<xmltask source="rapport.xml">
<call path="//testsuites">
<param name="chaine" path="@name"/>
<param name="testsuite1" path="testsuite[1]/@name"/>
<param name="testsuite2" path="testsuite[2]/@name"/>
<param name="ko1" path="count(testsuite[1]/testcase/failure[@type='ko'])"/>
<actions>
<echo message="count fichiers ko 1 : @{ko1}"/>
<if>
<equals arg1="${ko1}" arg2="0" />
<then>
<echo message="OK"/>
</then>
<else>
<echo message="KO"/>
</else>
</if>
</actions>
</call>
</xmltask>
为什么当arg1=0时,我不能进入then条件,而只能进入else
report.xml是:
<testsuites name="COMPTES" tests="6" time="7" timestamp="2014-07-01T17-20-07" failures="6" errors="0">
<testsuite name="100" tests="6" failures="6" errors="0" time="7">
<testcase classname="Script.COMPTES.100" name="TEST1" time="1">
<failure message="Not exist file or counter or used" type="fichiersInexistants">
File No matches
</failure>
</testcase>
<testcase classname="Script.COMPTES.100" name="TEST2" time="2">
<failure message="Not exist file or counter or used" type="fichiersUtilises">
Data set in use
</failure>
</testcase>
<testcase classname="Script.COMPTES.100" name="TEST3" time="3">
<failure message="Not exist file or counter or used" type="fichiersInexistants">
File No matches
</failure>
</testcase>
<testcase classname="Script.COMPTES.100" name="TEST4" time="3">
<failure message="File abended" type="abended">
File abended
</failure>
</testcase>
</testsuite>
</testsuites>
尝试使用@{ko1}而不是${ko1}来引用参数。如果echo确实在打印0,那么它应该可以工作
<echo message="count fichiers ko 1 : @{ko1}"/>
<if>
<equals arg1="@{ko1}" arg2="0" />
向我们展示您的XML源意味着融洽关系。xmlManouti的答案是正确的。请参阅xmltask documentation=>=>注意在本例中如何使用@{…}取消对参数的引用。还请注意,对于嵌入式操作,每个属性都必须指定一个值。如果有疑问,请使用说明中的默认属性。