Re: [xsl] rounding numbers up or down

Subject: Re: [xsl] rounding numbers up or down
From: "Jonathan Perret" <jonathan@xxxxxxxxxxxx>
Date: Tue, 5 Mar 2002 12:06:56 +0100
Try round($Total_Pages * 2) div 2.

Cheers,
--Jonathan

----- Original Message -----
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, March 05, 2002 11:26 AM
Subject: Re: [xsl] rounding numbers up or down


> 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
>


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


Current Thread