The tutorial referenced on the <xmltask> web page

http://www.zvon.org/xxl/XPathTutorial/General/examples.html is very good.

The set of test cases in the .src.zip download may also be useful.

Brian

BERVOETS Wim wrote:
Hi Brian,
 
I just tried it and it works :-) (also the attribute value)
 
I'm going to read some more tutorials on XPath to become more fluent in it :-)
 
Thanks a lot,
Wim


From: Brian Agnew [mailto:[EMAIL PROTECTED]]
Sent: dinsdag 30 mei 2006 14:05
To: BERVOETS Wim
Cc: xmltask-users@lists.sourceforge.net
Subject: Re: [Xmltask-users] xmltask call and recursive xpaths

For your 'constantvalue' below I'd expect your path to be:

constant/text()

to access the text node.

For 'constantname' I'd expect the path to be:

constant/@name

to access the attribute. Now I'll have to check whether you can access an attribute value as opposed to an attribute node (there's no way in XPath to reference an attribute value directly).

Brian

ps. haven't checked any of the above but will do soon....

BERVOETS Wim wrote:
Hi,
 
I have the following XML file:
 
<root>
    ....
    <content name="Dutch" locale="locale_nl">
        <constant name="stupidlabeltext">Dutch text</constant>
    </content>
    <content name="French" locale="locale_fr">
 <constant name="stupidlabeltext">French text</constant>
    </content>
    ...
</root>
I have the following Ant file:
 
    <xmltask source="test.xml" dest="test-new.xml" failWithoutMatch="true">
        <call path="//content" target="echoprops">
             <param name="locale" path="@locale"/>
             <param name="constantname" path="[EMAIL PROTECTED]"/>
             <param name="constantvalue" path="constant[text()]"/>
        </call>
   </xmltask>
 
 <target name="echoprops">
      <echo message="Constant: ${locale} - ${constantname} - ${constantvalue}"/>
 </target>
 
The output I receive on an example xml file is:

Constant: locale_nl - ${constantname} - ${constantvalue}

It seems that it's not possible to specify an XPath referencing children inside a param. Or am I doing something wrong? Or is there another way I should try?

Purpose of this is to convert constants in legacy xml files to standard resourcebundles...

I'm using the latest XMLTask 1.12 version.

kind regards,

Wim Bervoets

 



-----Disclaimer-----

This message may contain confidential information intended solely for the use of the named addressee. If you are not the intended recipient, you should not read, use, disclose or reproduce the content of this message. If you have received this message by mistake, please notify the sender immediately. Any views or opinions presented in this message are solely those of the author and do not necessarily represent those of AXA Belgium, AXA Bank Belgium, AXA Tech Belgium GIE - ESV or any other entity of the AXA Group, unless otherwise stated by the sender and duly authorized by the said companies.

---------------------

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

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


Reply via email to