Reputation: 1930
I can't get this to work... I simply want to change the value of a globally defined variable:
<xsl:variable name="isBusiness"></xsl:variable>
<xsl:choose>
<xsl:when test="yes this is a business">
<xsl:variable name="isBusiness">true</xsl:variable>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="isBusiness">false</xsl:variable>
</xsl:otherwise>
</xsl:choose>
Obviously the code is invalid because is already defined, but how would I change the value?
Upvotes: 11
Views: 26344
Reputation: 15794
Check this link out:
http://www.dpawson.co.uk/xsl/sect2/N8090.html#d10874e187
Basically, your code should look like this:
<xsl:variable name="x">
<xsl:choose>
<xsl:when test="a">z</xsl:when>
<xsl:when test="b">zz</xsl:when>
<xsl:otherwise>zzz</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Upvotes: 15