Hi Gilbert -

(note: there's an XMLTask mailing list xmltask-users@lists.sourceforge.net
which is more suitable for XMLTask-specific messages, but...)

I will have to check on property appends vs. buffer appends and what's
expected to work. Note that properties are normally immutable, so I
suspect that (for whatever reason) XMLTask will set the property once to
the first match and not change it afterwards.

Buffers are a better thing to copy/paste into (for many reasons I won't go
into here). You can copy from a buffer to a property. Probably by doing
something like (warning - this is untested!)

<xmltask sourcebuffer="your buffer name">
   <copy path="/" property="your property name">
   ....

or similar. Perhaps you can forgo the additional <xmltask> invocation by
creating a dummy node in your real doc, pasting into that, copying into a
property and then deleting the dummy node ?

Brian


On Tue, July 10, 2007 13:40, Rebhan, Gilbert wrote:
>
> Hi,
>
> i have a problem with xmltask 1.14 and xpath.
> i want a nodelist as property.
>
> the relevant xml section looks like that =
>
> <module>
> <modul.0>
> <name>modul_A</name>
> <label>020407_134553535</label>
> <buildpossible>N</buildpossible>
> </modul.0>
> <modul.1>
> <name>modul_B</name>
> <label>to_be_build</label>
> <buildpossible>J</buildpossible>
> </modul.1>
> </module>
>
> with the xpath expression =
>
> //module/*/name/text()
>
> i expect to get the nodelist containing both modulnames
>
> modul_A
> modul_B
>
>
> but with =
>
> <xmltask source="props.xml">
>   <copy path="count(//module/*/name/text())" property="name.count"/>
>   <copy path="//module/*/name/text()" property="moduls.text"/>
> </xmltask>
> <echo>
>   $${name.count} = ${name.count}
>   $${moduls.text} = ${moduls.text}
>  </echo>
>
> i get only =
>
>      [echo] ${name.count} = 2
>      [echo] ${moduls.text} = modul_A
>
> Is that a bug  or works as designed ?
> i expected to get the nodelist with all matches
>
> i believe it's because the property ${moduls.text} is set
> at first match - which is modul_A - and the second match
> get's not appended to that, because once set a (normal) property
> is immutable in ant.
>
> so i tried a buffer =
>
> <target name="init">
>   <xmltask source="props.xml">
>     <copy path="count(//module/*/name/text())" property="name.count"/>
>     <copy path="//module/*/name/text()" buffer="moduls.text"
> append="true"/>
>     <print buffer="moduls.text"/>
>    </xmltask>
>
> that gives me =
>
> [xmltask] { buffer 'moduls.text' output
>   [xmltask] modul_A
>   [xmltask] } buffer 'moduls.text' output
>   [xmltask] { buffer 'moduls.text' output
>   [xmltask] modul_B
>   [xmltask] } buffer 'moduls.text' output
>
> so both modulnames are contained now, but how to get
> that buffer in a property ?
>
> Any ideas ?
>
> 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


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to