Xquery transformation scenario

Issues related to W3C XQuery.
SteffenWeitsch
Posts: 6
Joined: Tue Feb 07, 2012 12:59 pm

Xquery transformation scenario

Post by SteffenWeitsch »

Hello,

I want to setup a transformation scenario with xquery.

Filename of generated output file should be dynamic generated by values extracted from actual transformed file.

Can anyone help to configure this ?

Regards
Steffen
adrian
Posts: 2797
Joined: Tue May 17, 2005 4:01 pm

Re: Xquery transformation scenario

Post by adrian »

Hello,

Note that the generated output file can only be saved in the local file system (file path).
If you need to use values from the source file in the output file name (in the Save as field from the Output tab of the scenario configuration), you can use an XPath that pinpoints the value from the XML source with the editor variable ${xpath_eval(expression)}.

If you're creating a scenario of type XML transformation with XQuery (from the perspective of the XML as the "current file") you can use ${cfd} (current file directory) and ${cfu} (current file URL) in the Save as field to refer the XML source.

e.g.
Save as: ${cfd}/myfile${xpath_eval(doc('${cfu}')/xpath/to/my/value/text())}.xml

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
SteffenWeitsch
Posts: 6
Joined: Tue Feb 07, 2012 12:59 pm

Re: Xquery transformation scenario

Post by SteffenWeitsch »

Hello,

that worked fine, thanks.

One more question - is it also possible to use some xquery functions ?

eg. tokenize(/path/to/my/node[qualifier = 'X'][part = '1']/value/text(), '\|')[1]


Regards
Steffen
adrian
Posts: 2797
Joined: Tue May 17, 2005 4:01 pm

Re: Xquery transformation scenario

Post by adrian »

Hi,

You can only use XPath functions in the expression from ${xpath_eval(expression)}. tokenize is an XPath function (also available in XQuery), so it works.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply