Is there any regionalisation support built into XSL when it comes to formatting numbers?
At present my underlying XML contains numbers in UK/US format, for example 54321.12345. I can do a select sum on this to give me a total in the same format. I can format the number using format-number(54321.12345, '###,###.#####') to give me 54,321.12345.
However when I want this to run on a different region setting on my machine such as Central European countries which have the comma seperator as "." and the decimal seperator as "," I want to format my numbers in this way to give me 54.321,123开发者_如何学Go45.
Is there a nice way to do this in XSL?
Thanks,
Andez
From http://www.w3.org/TR/xslt#format-number
The
xsl:decimal-format
element declares a decimal-format, which controls the interpretation of a format pattern used by theformat-number
function.
<!-- Category: top-level-element -->
<xsl:decimal-format
name = qname
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 />
I now have the following xsl:
<!-- define number format to use -->
<xsl:decimal-format name="european" decimal-separator=',' grouping-separator='.' />
<!-- format the number -->
<xsl:value-of select="format-number(54321.12345,'###.##0,0000', 'european')"/>
精彩评论