Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT Element

XSLT xsl:decimal-format Element


XSLT Element Reference Manual Complete XSLT Element Reference Manual


Definition and Usage

xsl:decimal-format element defines the characters and symbols to use when converting numbers to strings with 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 .


Syntax

name="name"

decimal-separator="char"

grouping-separator="char"

infinity="string"

minus-sign="char"

NaN="string"

percent="char"

per-mille="char"

zero-digit="char"

digit="char"

pattern-separator="char"/>

property

property Value Description
name name Optional. Specifies a name for this format.
decimal-separator char Optional. Specifies the decimal-point character. The default is ".".
grouping-separator char Optional. Specifies the thousands separator character. The default is ",".
infinity string Optional. Specifies the string used to represent infinity. The default is "Infinity".
minus-sign char Optional. Specifies the character representing a negative number. The default is "-".
NaN string Optional. Specifies the string used when a value is not a number. The default is "NaN".
percent char Optional. Specifies the character for the percent sign. The default is "%".
per-mille char Optional. Specifies the character for the per-mille sign. The default is "‰".
zero-digit char Optional. Specifies the character for the digit zero. The default is "0".
digit char Optional. Specifies the character used to indicate where a digit is required. The default is #.
pattern-separator char Optional. Specifies the character used to separate the positive and negative subpatterns in a format pattern. The 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 xsl:decimal-format name of the element):

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

decimal-separator="," grouping-separator="."/>

select="format-number(26825.8, '#.###,00', 'euro')"/>

Output:

26,825.80


XSLT Element Reference Manual Complete XSLT Element Reference Manual