January 4, 2002 - Specifying the Number Formatting Scheme in XSLT
January 4, 2002 Specifying the Number Formatting Scheme in XSLT Tips: January 2002
Yehuda Shiran, Ph.D.
|
format-number(@dvds_rented, "###,###");
The peculiar behavior of the browser is that it picks up the number of "#"
signs to the right of the comma as the determining distance between commas in the formatted data. The example above dictates that the first comma will be placed to the left of the third right most digit, then to the left of the sixth right most digit, etc. The number 19761247
, for example, will be formatted as 19,761,247
. Similarly, the following line of XSL code:
format-number(@dvds_rented, "####,##");
will put a comma every two digits. For the above example, you'll get 19,76,12,47
.