XSLT Transformation: Output XML with variable file name
Oxygen general issues.
-
- Posts: 96
- Joined: Mon May 09, 2011 11:54 am
XSLT Transformation: Output XML with variable file name
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
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
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: XSLT Transformation: Output XML with variable file name
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
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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 96
- Joined: Mon May 09, 2011 11:54 am
Re: XSLT Transformation: Output XML with variable file name
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
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
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XSLT Transformation: Output XML with variable file name
Hi Patrick,
What Oxygen version are you using? The xpath_eval variable was added in Oxygen 16.0.
Regards,
Radu
What Oxygen version are you using? The xpath_eval variable was added in Oxygen 16.0.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: XSLT Transformation: Output XML with variable file name
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.
Regards,
Adrian
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')
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 96
- Joined: Mon May 09, 2011 11:54 am
Re: XSLT Transformation: Output XML with variable file name
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
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service