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

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

问题描述



目前,我的底层XML包含英/美格式的数字,例如54321.12345。我可以做一个选择总和这给我一个在相同的格式。我可以使用format-number(54321.12345,'###,###。#####')格式化数字给我54,321.12345。



然而,当我希望在我的机器上运行不同的区域设置,例如中间欧洲国家的逗号分隔符为。和十进制分隔符为,我想以这种方式格式化我的数字给我54.321,12345。

是否有一个很好的方式来做到这一点在XSL?



谢谢,

安德兹

解决方案

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



lockquote
xsl:decimal-format 元素
声明了一种十进制格式,其中
控制
格式模式的解释。
format-number 函数。



 <! -  Category:top-level-element  - > 
name = qname
decimal-separator = char
grouping-separator = char
infinity = string
减号= char
NaN = string
percent = char
per-mille = char
zero-digit = char
digit = char
pattern-separator = char />


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,12345.

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 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天全站免登陆