XSLT <xsl:decimal-format> Element
Definition and Usage
The <xsl:decimal-format> element defines the characters and symbols to be used when converting numbers to strings via the format-number() function.
Not all countries use the same characters to separate the decimal part from the integer part, or to group numbers. With the <xsl:decimal-format> element, you can change specific characters to other symbols.
This element is a top-level element.
The format-number() function can reference the <xsl:decimal-format> element by name.
Syntax
Attributes
| Attribute | Value | Description |
|---|---|---|
| name | name | Optional. Specifies a name for this format. |
| decimal-separator | char | Optional. Specifies the character for the decimal point. Default is ".". |
| grouping-separator | char | Optional. Specifies the character for thousands separator. Default is ",". |
| infinity | string | Optional. Specifies the string used to represent infinity. Default is "Infinity". |
| minus-sign | char | Optional. Specifies the character for negative numbers. Default is "-". |
| NaN | string | Optional. Specifies the string used when the value is not a number. Default is "NaN". |
| percent | char | Optional. Specifies the character for the percentage sign. Default is "%". |
| per-mille | char | Optional. Specifies the character for the per mille sign. Default is "‰". |
| zero-digit | char | Optional. Specifies the character for the number 0. Default is "0". |
| digit | char | Optional. Specifies the character used to indicate where digits are to be placed. Default is "#". |
| pattern-separator | char | Optional. Specifies the character used to separate positive and negative sub-patterns in a format pattern. Default is ";". |
Example 1
The following example shows how to format as European currency (note that the third parameter in the format-number() function references the name of the <xsl:decimal-format> element):