XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (568 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
7.53Mb size Format: txt, pdf, ePub

The first subpicture is used for formatting positive numbers. The second (optional) subpicture is used for negative numbers. If only one subpicture is specified, then the subpicture used for negative numbers is the same as the positive subpicture, but with a minus sign added before the prefix. The actual character used for the minus sign depends on the

declaration.

The prefix and suffix are just literal characters that are output at the start and end of the number. The only real reason to use them, other than simple convenience, is when they are different for positive and negative numbers. For example, you can use this mechanism to implement the accounting convention of displaying negative numbers in parentheses.

If the prefix or suffix includes a
%
sign, the percent sign will be displayed in the place where it appears in the prefix or suffix, and the number will be multiplied by 100. Similarly, you can also use a per-mille sign
%
in which case the number will be multipled by 1000.

If the number is one of the special values positive or negative infinity or NaN, then it is displayed using the representation defined in the

declaration. The positive subpicture (including its prefix and suffix) is used for displaying positive zero and positive infinity, while the negative subpicture (perhaps with a different prefix and suffix) is used for negative zero and negative infinity. No prefix and suffix are used when NaN is formatted.

The special characters used are as follows.

Special Character
Default Value
Meaning
zero-digit
0
A digit will always appear at this point in the result string
digit
#
A digit will appear at this point in the result string unless it is a redundant leading or trailing zero
decimal-point
.
Separates the integer and the fraction part of the number
grouping-separator
,
Separates groups of digits
pattern-separator
;
Separates the positive and negative subpictures
minus-sign
-
Minus sign
percent-sign
%
Multiplies the number by 100 and shows it as a percentage

Other books

Justin by Allyson James
Before I Wake by Robert J. Wiersema
The SEAL's Second Chance Baby by Laura Marie Altom
What I Did for Love by Susan Elizabeth Phillips
Fortune's Magic Farm by Suzanne Selfors
True Colors by Jill Santopolo