Page 1 of 1

Xquery transformation scenario

Posted: Wed Sep 30, 2015 5:29 pm
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

Re: Xquery transformation scenario

Posted: Thu Oct 01, 2015 10:56 am
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

Re: Xquery transformation scenario

Posted: Thu Oct 01, 2015 12:13 pm
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

Re: Xquery transformation scenario

Posted: Thu Oct 01, 2015 3:15 pm
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