Re: [xsl] rounding numbers up or down

Subject: Re: [xsl] rounding numbers up or down
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 05 Mar 2002 11:26:39 +0100
XPATH has a function round(). If you have such things with 0.5, you can do something similar to <xsl:value-of select="round($Total_Pages) + 0.5)"/>. How do you want to handle numbers between 0.5 and 0.999999? Maybe you need a <xsl:choose>-statement.

Regards,

Joerg

Paul Mortimer wrote:
Hi,

Right, here's the  problem ...Im paging through my data using a stored procedure, and returning the data in xml chunks...
On the display page I've got a counter that displays how many pages there are and the users current page.. The problem I've got is that I need to round up all values of less than .5 to the nearest .5  e.g. 0.1 rounded to  0.5.

The only syntax I can find is something like ..

<xsl:value-of select="format-number($Total_Pages,'#.#')"/>

I need to be able to control which way the number is rounded up or down ..is there a function for this? .. oh im using MSXML 4.0..

Thanks

Paul Mortimer

--


System Development
VIRBUS AG
Fon  +49(0)341-979-7411
Fax  +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread