在格式化数字时,XSL 中是否内置了任何区域化支持?
目前我的基础 XML 包含英国/美国格式的数字,例如 54321.12345。我可以对此进行选择总和,以相同格式给我一个总数。我可以使用 format-number(54321.12345, '###,###.#####') 格式化数字给我 54,321.12345。
但是,当我希望它在我的机器上的不同区域设置上运行时,例如逗号分隔符为“。”的中欧国家/地区。和小数分隔符为“,”我想以这种方式格式化我的数字给我 54.321,12345。
在 XSL 中有没有很好的方法来做到这一点?
谢谢,
安德斯
最佳答案
来自 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 />
关于xslt - XSL 与区域化/国际化数字格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4625330/