TonyMarston
Programmer
Is there any good reason why the following code does not work?
<xsl:choose>
<xsl:when test="foo">
<xsl:variable name="var" select="'foo'" />
</xsl/when>
<xsltherwise>
<xsl:variable name="var" select="'something else'" />
</xsltherwise>
</xsl:choose>
If I try to access variable $var after this code has been executed all I get is "unknown variable". If I declare the variable without the conditions it works, but I want to set the variable to a different value depending on conditions at run-time.
Is this a bug, or something which is disallowed in the XSL specification?
<xsl:choose>
<xsl:when test="foo">
<xsl:variable name="var" select="'foo'" />
</xsl/when>
<xsltherwise>
<xsl:variable name="var" select="'something else'" />
</xsltherwise>
</xsl:choose>
If I try to access variable $var after this code has been executed all I get is "unknown variable". If I declare the variable without the conditions it works, but I want to set the variable to a different value depending on conditions at run-time.
Is this a bug, or something which is disallowed in the XSL specification?