XSLT with externally set variables does not compile
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 3
- Joined: Mon Dec 04, 2006 6:50 pm
XSLT with externally set variables does not compile
I am trying to create a debug scenario to profile my XSLT transforms. The main XSLT has variables which I can pass to it in my rails application via nokogiri XSLT transform API. However, when I create the scenario I am unable to have to variable substitution take place correctly. Main XSLT (I must use 1.0 due to a ruby gem that only supports 1.0):
When I execute the scenario, I get an error 'W[Saxon6.5.5] Variable result_root_element has not been declared'. I tried both parameter definitions (which I didn't really expect to work since the XSLT does not have parameters) and editor variables. With the editor variables, it seems like the variable is created as ${root_result_element} and perhaps what is why the compilation fails. Any suggestions?
Thank you,
Cal
Code: Select all
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
<xsl:output method="xml" indent="yes"/>
<xsl:include href="csw_common.xslt" />
<xsl:template match="/">
<xsl:element name="{$result_root_element}">
<xsl:if test="$result_root_element = 'MyStringValueSetOutside XSLT'">
etc.
Thank you,
Cal
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: XSLT with externally set variables does not compile
Hi,
Why aren't you declaring the variable in the stylesheet?
Before executing the scenario/stylesheet, validate it and fix the reported errors (e.g. Missing declarations).
Some API may let you set up the variables and then run the stylesheet in that environment, but that doesn't eliminate the need for a valid XSLT(proper declarations), especially if you'll ever want to use it without that API.
Did you try to assign a value to the variable under Parameters from the transformation scenario (but this would still assume you have declared the variable)?
Oxygen editor variables cannot be used in stylesheets. That is not their purpose.
Regards,
Adrian
Why aren't you declaring the variable in the stylesheet?
Before executing the scenario/stylesheet, validate it and fix the reported errors (e.g. Missing declarations).
Some API may let you set up the variables and then run the stylesheet in that environment, but that doesn't eliminate the need for a valid XSLT(proper declarations), especially if you'll ever want to use it without that API.
Did you try to assign a value to the variable under Parameters from the transformation scenario (but this would still assume you have declared the variable)?
Oxygen editor variables cannot be used in stylesheets. That is not their purpose.
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: 3
- Joined: Mon Dec 04, 2006 6:50 pm
Re: XSLT with externally set variables does not compile
Hi Adrian,
Thank you very much for your prompt response. I am using a ruby gem (Nokogiri) which relies on an old version of libxml which is much more permissive with the XSLT syntax.
I followed your suggestion and declared variables that are set via XSLT parameters and everything worked as expected. I was able to profile the XSLT.
I very much appreciate your help.
Regards,
Cal
Thank you very much for your prompt response. I am using a ruby gem (Nokogiri) which relies on an old version of libxml which is much more permissive with the XSLT syntax.
I followed your suggestion and declared variables that are set via XSLT parameters and everything worked as expected. I was able to profile the XSLT.
I very much appreciate your help.
Regards,
Cal
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