|
Subject: RE: [xsl] adding 2 formatted numbers? From: Jeff Beadle <Jbeadle@xxxxxxxx> Date: Thu, 14 Mar 2002 15:08:58 -0500 |
this works...
<xsl:template match="/">
<xsl:variable name="numbers">
<xsl:for-each select="//node1/text() | //node2/text()">
<n><xsl:value-of select="translate(.,',.','')"/></n>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="sum(msxsl:node-set($numbers)//n)"/>
</xsl:template>
I'm sure others will post something more effecient, but like I said ... this
works.
Keep in mind that the format of the currency node content must be the same,
the segments be of the same type.
-Jeff
-----Original Message-----
From: L Rutker [mailto:lrutker@xxxxxxxxxxx]
Sent: Thursday, March 14, 2002 2:55 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] adding 2 formatted numbers?
Hi,
I have the following nodes in my xml:
<node1>123,456,789.01</node1>
<node2>222,222,222.54</node2>
In my xsl I have to add the value of the 2 of them. Since my numbers are
formatted I cant do it.
How can I "unformat" my numbers and add them together?
Note: depending on the users currency formatting preferences I might get the
number in the following format:
<node1>123.456.789,01</node1>
<node2>222.222.222,54</node2>
I also have now way of knowing how many commas there are per node (the
length varies)
Thanks
Lou
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] adding 2 formatted number, Joerg Heinicke | Thread | [xsl] RE: need to show spaces, Anurag Batra |
| RE: [xsl] general purpose filter st, Jonathan C. Dietrich | Date | Re: [xsl] regarding spaces, Thomas B. Passin |
| Month |