|
Subject: Get NaN when adding From: "James Steven" <JSteven@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 22 Jun 2004 16:44:58 +0100 |
Hello
Using the xml and xsl below I have added b/c/data to b/d/data. However when
I use the same method to add b/e/data (value of 0.00) to b/f/data (value of
0.00 also) I get NaN. Does anyone have any ideas why I am getting this?
Thankyou very much for any help offered.
<xsl:template match="a">
<xsl:call-template name="orderlist.sum.edit">
<xsl:with-param name="set-of-order" select="b/c"/>
</xsl:call-template>
</xsl:template>
<!-- ================================================================ --!>
<xsl:template name="orderlist.sum.edit">
<xsl:param name="set-of-order"/>
<xsl:variable name="sumorg">
<xsl:call-template name="orderlist.sum">
<xsl:with-param name="set-of-order" select="$set-of-order"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select='format-number($sumorg, "£###,###,##0.00")'/>
</xsl:template>
<xsl:template name="orderlist.sum">
<xsl:param name="set-of-order"/>
<xsl:variable name="var1">
<xsl:call-template name="orderlist.sum.edit2">
<xsl:with-param name="set-of-order" select="b/d"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$set-of-order">
<xsl:variable name="first">
<xsl:apply-templates select="$set-of-order[1]/data"/>
</xsl:variable>
<xsl:variable name="rest">
<xsl:call-template name="orderlist.sum">
<xsl:with-param name="set-of-order" select="$set-of-order[position() !=
1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$first + $rest + $var1"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ================================================================ --!>
<a>
<b>
<c>
<data>1</data>
</c>
<c>
<data>3</data>
</c>
<d>
<data>1</data>
</d>
<d>
<data>5</data>
</d>
<d>
<data>2</data>
</d>
<e>
<data>0.00</data>
</e>
<e>
<data>0.00</data>
</e>
<f>
<data>0.00</data>
</f>
<f>
<data>0.00</data>
</f>
</b>
</a>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] conversion from xslt2.0 t, J.Pietschmann | Thread | RE: [xsl] EXCEPTION: javax.xml.tra, Wolpert, Jake |
| [xsl] conversion from xslt2.0 to xs, TDarksword | Date | Re: [xsl] Remapping image paths, Josh Canfield |
| Month |