Re: How to round number values

Subject: Re: How to round number values
From: "David Marston/CAM/Lotus" <David_Marston@xxxxxxxxx>
Date: Tue, 2 May 2000 12:48:05 -0400
Moritz Walther writes:

>the XSL - part is
>.....<xsl:value-of select="lipr"/>...
>with this I get "48064.63999" but I need "48.064,64".
>How could I format the number ?

There are two operations in question, but you may find
that format-number does what you want with the rounding.
Your instruction would change to something like
<xsl:value-of select="format-number(lipr,'##.##0,00')"/>
and you would have to make a couple declarations in an
xsl:decimal-format element to swap the two separators.
Read section 12.3 of the XSLT spec for the whole story.
You'll want to set the number of #s and 0s to fit the
largest allowable number, and you may need to deal
with negative values as well.

To round manually to two decimal places, do this
<xsl:value-of select="round(100*lipr) div 100"/>
.................David Marston

 XSL-List info and archive:

Current Thread