XML : How to use calculated result and use it as a variable in XSLT?

As the title says I am having trouble with making my calculated result into a variable that can be re use. This is an example of my part of the XSLT:

  <td><xsl:variable name="total"/>        <xsl:value-of select="variable 1 + variable 2 + variable 3"/></td>        <xsl:choose>          <xsl:when test="total &lt; 50">              <td><xsl:text>N</xsl:text></td>          </xsl:when>          <xsl:when test="total &gt;= 50 and total &lt; 60">              <td><xsl:text>C</xsl:text></td>          </xsl:when>            <xsl:when test="total &gt;= 60 and total &lt; 70">              <td><xsl:text>CR</xsl:text></td>          </xsl:when>            <xsl:when test="total &gt;= 70 and total &lt; 80">              <td><xsl:text>D</xsl:text></td>          </xsl:when>          <xsl:otherwise>              <td><xsl:text>HD</xsl:text></td>          </xsl:otherwise>        </xsl:choose>    

The result for the xsl:choose gives me all HD which is incorrect.

No comments:

Post a Comment