If you want to format output of numbers in a specific way, XSLT allow this using the format-number function.
The format-number() function takes 3 parameters ( 2 mandatory and one optional )
Consider the following example:
<xsl:value-of select="125000.3333"></xsl:value>
Output: 125000.3333
xslt
If you want to format this output with grouping separators, or control the number of decimals, apply formatting by using the format-number function
<xsl:value-of select="format-number(125000.3333,'###,###.00')"></xsl:value>
Output: 125,000.33
xslt
In the above example, format-number uses the default XSLT number-format to:
1. Output numbers '#'
2. Separate groups of 3 digits ','
3. Specify 2 decimal number to be outputted only '.00'
Formatting numbers with European grouping and decimal separators
<xsl:decimal-format name="european" decimal-separator=',' grouping-separator='.' ></xsl:decimal>
<xsl:value-of select="format-number(24535.2, '###.###,00', 'european')"></xsl:value>
xslt
Formatting numbers to ensure correct number of digits
Often month is represented as a single digit, eg. '4' for April, but when dealing with fixed-position formats, we often want to Express this as '04'.
<xsl:value-of Select="format-number(@month,'00')"/>
xslt
Removing unwanted decimals in whole number
<xsl:value-of select="format-number('4.0','#')"/>