Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: format-number [Thread Next] Re: format-numberTo: NULL Date: 9/4/2004 1:01:00 PM Haha nice one Marrow ! I thought until yesterday that was an MS extension, turns out to be core xslt ;-) Cheers - Neil On Fri, 3 Sep 2004 18:37:17 +0100, "Marrow" <m--a-r-r-o-w@m-a-r-r-o-w--s-o-f-t.com> wrote: >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. >> >> > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
