Parts of Numbers

Table F-1 describes the characters that represent parts of a number. They are used by the format-number() function and by the <xsl:decimal-format> element.

Table F-1. Number formatting codes
CodeMeaning
#Represents a digit. Trailing or leading zeroes are not displayed. Formatting the number 4.0 with the string "#.##" returns the string "4".
0Represents a digit. Unlike the # character, the 0 always displays a zero. Formatting the number 4.1 with the string "#.00" returns the string "4.10".
.Represents the decimal point.
-Represents the minus sign.
,Is the grouping separator.
;Separates the positive-number pattern from the negative-number pattern.
%Indicates that a number should be displayed as a percentage. The value is multiplied by 100, and then displayed as a percentage. Formatting the number .76 with the string "##%" returns the string "76%".
\u2030Is the Unicode character for the per-thousand (per-mille) sign. The value will be multiplied by 1000, and then displayed as a per mille. Formatting the number .768 with the string "###\u2030" returns the string "768‰".

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.