|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Assigning variable values
Hello Georges,
the variable got out of scope, if you declare them in <xsl:when/>. You have to turn around the XSL-elements: <xsl:variable name="teste" select="'um'"/> <xsl:variable name="um" select="'um'"/> <xsl:variable name="dois" select="'dois'"/> <xsl:template match="/">
<xsl:variable name="teste">
<xsl:choose>
<xsl:when test="$teste='um'">
<xsl:value-of select="$dois"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$um"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$teste"/>
</xsl:template>But I don't know whether you know that variables can't be re-assigned. So in the global variable there is still stored 'um', only in the local one the value is 'dois'. This behaviour can be reproduced with MSXML. With Xalan it's not possible. You will get an error "Variable accessed before it is bound!" I think that's not the correct behaviour, is it? Joerg Georges Claessen wrote: Could somebody help me on this issue? I am having a XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








