Xquery transformation scenario

Issues related to W3C XQuery.
SteffenWeitsch
Posts: 5

Xquery transformation scenario

Wed Sep 30, 2015 5:29 pm

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: 2326

Re: Xquery transformation scenario

Thu Oct 01, 2015 10:56 am

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: 5

Re: Xquery transformation scenario

Thu Oct 01, 2015 12:13 pm

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: 2326

Re: Xquery transformation scenario

Thu Oct 01, 2015 3:15 pm

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

Return to “XQuery”

Who is online

Users browsing this forum: No registered users and 0 guests