XSL 与区域化/国际化数字格式 [英] XSL vs Regionalisation/Internationalization Number Formats

查看:12
本文介绍了XSL 与区域化/国际化数字格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在格式化数字时,XSL 中是否内置了任何区域化支持?

Is there any regionalisation support built into XSL when it comes to formatting numbers?

目前我的基础 XML 包含英国/美国格式的数字,例如 54321.12345.我可以对此进行选择总和,以相同格式给我一个总数.我可以使用 format-number(54321.12345, '###,###.#####') 格式化数字给我 54,321.12345.

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.

但是,当我希望它在我的机器上的不同区域设置上运行时,例如逗号分隔符为."的中欧国家/地区.和小数分隔符为,"我想以这种方式格式化我的数字给我 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,12345.

在 XSL 中有没有很好的方法来做到这一点?

Is there a nice way to do this in XSL?

谢谢,

安德斯

推荐答案

来自 http:///www.w3.org/TR/xslt#format-number

xsl:decimal-format 元素声明一个十进制格式,它控制一个解释使用的格式模式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 />

这篇关于XSL 与区域化/国际化数字格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆