Altova Mailing List Archives


Re: format-number

From: "Marrow" <m--a-r-r-o-w@--------------------.--->
To: NULL
Date: 9/3/2004 6:37:00 PM
Hi,

Use the format-number() function as suggested in your posting subject, e.g.

If you want 4 fixed decimal places...
  <xsl:value-of select="format-number(LastPrice,'0.0000')" />

If you want a maximum of 4 decimal places...

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

However, this will round to the nearest, i.e. 1.1234999999999 will be shown
as 1.1235
So if you want to always round down you will have to floor it yourself, e.g.
  <xsl:value-of select="format-number(floor(LastPrice * 10000) div
10000,'0.0000')" />


HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator



"Saulot" <saulot@l...> wrote in message
news:41386ee4$0$29651$636a15ce@n......
> Hi,
> Got this : <xsl:value-of select="LastPrice" />
>
> How can I tell my XSL I want the result with 4 digit max. (ie : 1.1234 and
> not 1.1234999999999)
>
> Thks for help.
>
>


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.