I think the most recent version is 1.14, but I don't think it affects what
you're trying to do.

   <xmltask source="test.xml">
     <copy path="count(/module/name/text())" property="name.count"/>
   </xmltask>
   <echo>Count = ${name.count}</echo>

will do the job and write the correct value into 'name.count'. (the above
XPath expression is for my test file - please adapt for your scenario).

Brian

On Mon, April 16, 2007 14:47, Rebhan, Gilbert wrote:
>
> Hi,
>
> i use xmltask (the most recent version 1.13)
> for xml stuff regularly, but now i have a question
>
> Problem =
>
> i have a xml file where i want to count
> the occurence of a given node, structure of that file =
>
> <module>
> <modul.0>
> <name>...</name>
> <label>...</label>
> ...
> </modul.0>
> <modul.1>
> <name>...</name>
> <label>...</label>
> ...
> </modul.1>
> </module>
>
>
> I know the relevant xpath expression but i need
> to know how to get that integer as property into my ant script.
>
> I tried with =
>
> <xmltask source="${ant.working.dir}/props.xml" >
>        <print path="count(//module/*/name/text())" buffer="nodecount"/>
>   </xmltask>
>
> ...
>
> <xmltask >
>       <print buffer="nodecount"/>
> </xmltask>
>
> but that gave me only =
>
> depends:
>   [xmltask] { node output
>   [xmltask] 1
>   [xmltask] } node output
>
> elements:
>   [xmltask] Couldn't find any entries for buffer 'nodecount'
>
>
> fine the node output 1 is right,  but how to get it for
> further processing.
> Thought i simply put in a buffer and set a property with the
> contents of that buffer, but see above.
>
> Any ideas with xml task   ??
>
> Regards, Gilbert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012


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

Reply via email to