XSLT Number Formatting Notes
XML / XPath / XSLT xslt
Published: 2006-02-02
XSLT Number Formatting Notes

When using XSLT’s format-number() function to format a decimal, consider using a zero in the least significant place of the decimal part of your format string. This will allow a number with a 0 integer part to display correctly.

For example:

Number format-number using #,### format-number using #,##0
12345 12,345 12,345
5 5 5
No output!

This also applies to decimals:

Number format-number using #.00 format-number using 0.00
5 5.00 5.00
.00 (Note no leading 0) 0.00
0.1234 .12 (Note no leading 0) 0.12