xslt - XSL 与区域化/国际化数字格式

标签 xslt internationalization numbers format

在格式化数字时,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 the format-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/

相关文章:

c - 如何用C语言的两个冒号生成随机数?

xslt - 生成动态xmlns

c# - Umbraco 在 xslt 中发布日期

java - Spring 安全 2.0.5。自定义登录表单。看不到英语以外的语言错误

ios - 本地化 iOS "More"按钮

PHP - 获取数字中的数字长度

xml - 创建后在 xsl 中对表进行排序

xslt - LINQ to XML 是否取代 XSLT?

Django 的 makemessages 创建了很多模糊条目

c - 范围之间的随机奇数,C 中单个数字除外