You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Peter Snellman <pe...@cinnober.com> on 2000/07/13 16:18:05 UTC

Problems with variable scope in xalan

Hello,

We have noticed that a variable set within an xsl:if section is removed when
leaving the xsl:if  in Xalan.
Lotusxsl does not have this behaviour.

What is the correct behaviour?


EXAMPLE

The following result

	Before xsl:if; value = Value set outside xsl:if
	Inside xsl:if; value = Value set inside xsl:if
	After  xsl:if; value = Value set outside xsl:if

was generated from following xsl-code:

	<xsl:variable name="value" select="'Value set outside xsl:if'"/>
	Before xsl:if; value = <xsl:value-of select="$value"/>
	<xsl:if test="true()">
	    <xsl:variable name="value" select="'Value set inside xsl:if'"/>

	Inside xsl:if; value = <xsl:value-of select="$value"/>
	</xsl:if>
	After  xsl:if; value = <xsl:value-of select="$value"/>


Best Regards,

Peter Snellman
Cinnober Financial Technology AB
Stockholm, Sweden