You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Chris P. McCabe" <ch...@choicehotels.com> on 2000/03/07 18:48:42 UTC

Change in variable behavior with 0.20.0

In Xalan version 0_19_3D03, I used to be able to conditionally set a
variable in an xsl:choose element, then immediately reference the
variable.  This no longer works.  I get the following error:

VariableReference given for variable out of context or without
definition!

Is there any way to do this now?  It would be nice if variables can be
set conditionally like this.

Here is an example of what I am doing:

<xsl:choose>
   <xsl:when test="string(@size) = 'large'">
      <xsl:variable name="amount">100</xsl:variable>
   </xsl:when>
   <xsl:otherwise>
      <xsl:variable name="amount">50</xsl:variable>
   </xsl:otherwise>
</xsl:choose>
The amount is: <xsl:value-of select="$amount"/>


I can restructure things to get it to work, but that would mean that I
would have to repeat the xsl:choose for every place that I would I am
now referenceing the value of the variable.

Chris

--
Chris McCabe
Choice Hotels International
chris_mccabe@choicehotels.com