RE: [xsl] [Illegal?] setting xsl:variable inside xsl:if code block

Subject: RE: [xsl] [Illegal?] setting xsl:variable inside xsl:if code block
From: "Raffaele Sena" <raff@xxxxxxxxxxxx>
Date: Wed, 1 Dec 2004 18:35:49 -0800
I am not sure of what you are trying to do.

If you are trying to "change" the value of a variable that you defined
outside the "if" statement, it's an error (XSLT doesn't allow you to change
the value of variables).

If you are trying to set the variable inside the "if" block and use it
outside the "if" block, it's an error, because the variable exists only in
the scope of the "if" block.

If you are setting and using the variable inside the "if" block, it should
work because creation and use will be in the same block.

-- Raffaele

-----Original Message-----
From: Wong Chin Shin [mailto:publicbbs@xxxxxxxxxxxxxxxx] 
Sent: Wednesday, December 01, 2004 6:08 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] [Illegal?] setting xsl:variable inside xsl:if code block

Hi,

I got an error when I tried to do the following:

<xsl:if test="$x=$y">
	<xsl:variable something something>
</xsl:if>

It says it can't find the variable or something to that effect. How do I
accomplish this? 

Thanks!
Wong



!DSPAM:41ae6f4c275021367519020!

Current Thread