[thelist] owed tip

Steve Lewis nepolon at worlddomination.net
Tue Jul 29 15:11:32 CDT 2003


I will throw down too.

<tip type="XSL" author="Steve Lewis">

It can be difficult to use <xsl:variable> because you cannot redefine a 
variable value once you set it. You can also only declare a variable in 
one place in an XSL template.  This can lead to some difficult times.  
Fortunately <xsl:choose> is there for you.

If you nest the <xsl:choose> inside the <xsl:variable> you will not 
encounter any strange runtime errors.

<xsl:variable name="codename">
  <xsl:choose>
    <xsl:when test="agent/name/last = 'Bond'">
      007
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="agent/@id"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

</tip>



More information about the thelist mailing list