Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Number Formatting (1/2) >

Function format-number

Numbers can be formatted for output using format-number() function. The first argument to this function is the number to be formatted the second one is a picture string, which provides a recipe for the formatting. In the first example the picture string indicates that the number should have 2 digits after decimal point.

Digits are indicated either by "#" or "0"Characters. Please note the difference. If zeroes are used than the string is padded by 0 to the specified length.


            <xsl:output  method="xml"

            <xsl:template  match="/aaa">
                        <xsl:value-of  select="format-number(123456789.6543,'#.##')"/>
                        <xsl:value-of  select="format-number(123456789,'#.##')"/>
                        <xsl:value-of  select="format-number(123456789,'#.00')"/>
                        <xsl:value-of  select="format-number(123456.789,'#.00')"/>
                        <xsl:value-of  select="format-number(12.789,'00000.0')"/>
                        <xsl:value-of  select="format-number(12.789,'#####.#')"/>




Previous chapter: Transforming strings with regular expressions
Next chapter: Sorting
Previous page: - - -
Next page: Grouping separator

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver Stanton

You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks ing suit and swim trunks