[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
xsl round 2 decimal places
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:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.