Formatting numbers
Formatting of numbers affects the output of the xsl:number instruction, and the fn:format-integer() function.
In xsl:number
and in fn:format-integer()
it is possible to request a specific
language using the lang
attribute/argument. The default for this may be set using the Saxon
configuration property DEFAULT_LANGUAGE; failing this, the default is taken
from the operating system settings. This option mainly affects formatting of numbers as words (for
example, in English, "one", "two", "three", or "first", "second", "third") as requested using the format
token "W", "w", or "Ww". This is referred to as spellout numbering.
- In SaxonJ-HE, spellout numbering is supported "out of the box" only for English; if
any other language is requested, the output falls back to English. There is an API, Configuration.setLocalizerFactory(),
allowing plug-in code to be registered for other
languages, and there are some open-source components available (issued with the
saxon-resources
download) providing plug-ins for some common European languages. - In SaxonJ-PE and -EE, spellout numbering is available via the ICU-J library, which supports a large variety of languages. This does not require any special configuration.
- In SaxonCS, spellout numbering is not currently available.
As well as spellout numbering, the choice of language also affects ordinal numbering, for example 10 is output as "10th" in English, "10." in German, "10e" in French, and "10º" in Italian.
For more details on numbering using ICU, see Numbers and dates from ICU.
For more details on writing a plug-in for localizing numbers and dates, see Localizing numbers and dates.