Determine if a String is a Number

Tips:

number(node) != ‘NaN’

Sample:

<xsl:variable name=”inDisc”>
    <xsl:value-of select="./DiscountPercent"/>
</xsl:variable>
<xsl:variable name="DiscPct">
    <xsl:value-of select="number($inDisc)"/>
</xsl:variable>
<xsl:element name="UnitDiscountAmount">
    <xsl:choose>
        <xsl:when test="$DiscPct!='NaN'">
            <xsl:value-of select="$DiscPct"/>
        </xsl:when>
        <xsl:otherwise>0</xsl:otherwise>
    </xsl:choose>
</xsl:element>

posted @ 2009-05-04 16:16  upzone  阅读(175)  评论(0编辑  收藏  举报