Page 1 of 1
XSLT Transformation: Output XML with variable file name
Posted: Tue Nov 18, 2014 6:37 pm
by patrick
Hi,
I need to set an custom filename to the xml output document of my transformation. I cannot use result-document because the output xml should open after the transformation in oxygen.
So i tried the new xpath_eval variable for the xml output filename, but it is not recognized (I think there is an error somewhere...).
This expression should get a defined value from the xsl script and use a part of it as filename. The regex works in the xpath builder..
${cfd}\${cfn}-kis${xpath_eval(replace(doc('${frameworkDir}\transformations\kisupgrade.xsl')/xsl:stylesheet/xsl:param[@name='doctype.public'],'^.+V(\d+)\.(\d+).+$','$1$2'))}.xml
Thanks
Patrick
Re: XSLT Transformation: Output XML with variable file name
Posted: Wed Nov 19, 2014 7:13 pm
by adrian
Hi,
I tested without ${frameworkDir} in the doc path and that worked fine for me.
Did you create this scenario within a framework (document type)?
Have you tried using '${frameworksDir}/frameworkName'?
Regards,
Adrian
Re: XSLT Transformation: Output XML with variable file name
Posted: Fri Nov 21, 2014 3:33 pm
by patrick
Hi Adrian,
also with '${frameworksDir}/frameworkName' it does not work.
The Scenario is defined in that framework but also in a second framework which links to the first framework theoretically using your line above with frameworksDir.
Thanks,
Patrick
Re: XSLT Transformation: Output XML with variable file name
Posted: Wed Nov 26, 2014 10:49 am
by Radu
Hi Patrick,
What Oxygen version are you using? The xpath_eval variable was added in Oxygen 16.0.
Regards,
Radu
Re: XSLT Transformation: Output XML with variable file name
Posted: Wed Nov 26, 2014 12:47 pm
by patrick
Hi Radu,
I am using the 16.0 Build 2014070913.
Best regards,
Patrick
Re: XSLT Transformation: Output XML with variable file name
Posted: Wed Nov 26, 2014 12:50 pm
by patrick
OS: Win 8.1x64
Re: XSLT Transformation: Output XML with variable file name
Posted: Thu Nov 27, 2014 12:09 pm
by adrian
Hi,
Apologies for the late reply.
I finally got the opportunity to test this thoroughly and the problem is that the
doc() XPath function needs a URL/URI as argument, but you're passing a file path (${frameworkDir}).
Note that the list of editor variables from the GUI doesn't actually include the corresponding URL editor variables (it would be misleading) because the output XML must indicate a local file path. However, even though the URL editor variables are not listed in the GUI, they are still expanded correctly:
Oxygen XML Editor - Editor Variables
Anyway, to keep a long story short, for doc() you have to use ${framework} instead of ${frameworkDir} and ${frameworks} instead of ${frameworksDir} and use forward slashes (/) for the remaining path.
e.g.
Code: Select all
doc('${framework}/transformations/kisupgrade.xsl')
Regards,
Adrian
Re: XSLT Transformation: Output XML with variable file name
Posted: Thu Nov 27, 2014 12:51 pm
by patrick
Thank you! It works now, here is the working string:
Code: Select all
${cfd}\${cfn}-kis${xpath_eval(replace(doc('${frameworks}/thiemekis/transformations/kisupgrade.xsl')/xsl:stylesheet/xsl:param[@name='doctype.public'],'^.+V(\d+)\.(\d+).+$','$1$2'))}.xml