XSLT with externally set variables does not compile
Posted: Tue Sep 27, 2016 6:22 pm
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