Silly me, the sample I included in the message is not what I was really
using. Instead of <xsl:value-of select="sum(tax_item/amount)"/> I was really
using <xsl:number value="sum(tax_item/amount)"/>. The "value-of" does seem
to work better - thanks!
I still need to include your suggestion for the "format-number", however if
I use #### after the decimal as you suggest then trailing zeroes are
omitted. So instead I have put in 0.00 and that seems to do the trick.
-Brian
----- Original Message -----
From: "Ramin Firoozye" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 29, 2001 9:24 AM
Subject: RE: xslt and number formats


> Hi Brian,
>
> I tried your code in Xalan (C and J) and MSXML and got '2.79' (with the
> digits after decimal point intact). The XSLT spec says that numbers are
kept
> in double format internally so you shouldn't be getting any truncation
loss
> as a result of doing math. The 'sum' function is also supposed to keep
> numbers in their original format. The only culprit may be the xsl:value-of
> instruction (although on my system, it's working fine). You might want to
> try to force a format using something like:
>
> <xsl:value-of select="format-number(sum(tax_item/amount),
> '########.#########')" />
>
> The '#' characters default to the formatting scheme defined in the JDK 1.1
> java.text.DecimalFormat class
>
<http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html>
> .
>
> Hope this helps,
> Ramin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to