xsl:decimal-format

Indicates a set of localisation parameters. If the xsl:decimal-format element has a name attribute, it identifies a named format; if not, it identifies the default format.

Category: declaration
Content: none
Permitted parent elements: xsl:package ; xsl:stylesheet ; xsl:transform

Attributes

name?

eqname

A named format; if the attribute is omitted then the default format is used.

decimal-separator?

string

Specifies the string used to separate the integer part from the fractional part of the formatted number; the default is the period character (.). In XSLT 3.0 and earlier, this must be a single character, but in XSLT 4.0 it can be any string.

grouping-separator?

string

Specifies the string typically used as a thousands separator; the default is the comma character (,). In XSLT 3.0 and earlier, this must be a single character, but in XSLT 4.0 it can be any string.

infinity?

string

Specifies the string used to represent the xs:double value INF; the default is the string (Infinity).

minus-sign?

string

Specifies the string used to signal a negative number; the default is the hyphen-minus character (-). In XSLT 3.0 and earlier, this must be a single character, but in XSLT 4.0 it can be any string.

exponent-separator?

string

Specifies the string used to separate the mantissa part from the exponent part of the formatted number; the default is the character (e). For use with XPath 3.1. In XSLT 3.0 and earlier, this must be a single character, but in XSLT 4.0 it can be any string.

NaN?

string

Specifies the string used to represent the xs:double value Nan (not-a-number); the default is the string (NaN).

percent?

string

Specifies the string used to indicate that the number is represented as a per-hundred fraction; the default is the percent character (%). In XSLT 3.0 and earlier, this must be a single character, but in XSLT 4.0 it can be any string.

per-mille?

string

Specifies the string used to indicate that the number is represented as a per-thousand fraction; the default is the Unicode per-mille character (#x2030). In XSLT 3.0 and earlier, this must be a single character, but in XSLT 4.0 it can be any string.

zero-digit?

char

Specifies the character used to represent the digit zero; the default is the Western digit zero (0). Implicitly defines the characters used to represent each digit 0 to 9, as those in the corresponding Unicode decimal digit block.

digit?

char

Specifies the character used as a place-holder for an optional digit in the picture string; the default is the number sign character (#).

pattern-separator?

char

Specifies the character used to separate positive and negative sub-pictures in a picture string; the default is the semi-colon character (;).

Saxon availability

Available in XSLT 1.0 and later versions. Available in all Saxon editions. Available for all platforms.

Details

In practice decimal formats are used only for formatting numbers using the format-number() function in XPath expressions.

With XSLT 3.0, the specification of format-number() has moved into XPath which means it is also available in XQuery. The exponent-separator attribute is new in XPath 3.1, and allows formating of numbers in scientific notation.

In XSLT 4.0, the strings used in the formatted number to represent a decimal separator, grouping separator, exponent separator, percent sign, per mille sign, or minus sign, are no longer constrained to be single characters.

Links to W3C specifications

XSLT 3.0 Specification

XSLT 4.0 Specification

See also

format-number()

xsl:number