Declare variables whose value is initialized to that of the element if it is present, or the default value otherwise; then perform the calculation on the variables.
In 2.0 this is easy:
<xsl:variable name="discount" select="(DISCOUNT, 0)[1]"/>
In 1.0 it's a bit more convoluted:
<xsl:variable name="discount">
<xsl:choose>
<xsl:when test="DISCOUNT"><xsl:value-of select="DISCOUNT"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:variable>
or you can cheat if you want (but it's horrible):
<xsl:variable name="discount" select="number(concat('0', DISCOUNT))"/>
Michael Kay
http://www.saxonica.com/