Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以通过使用变量或类似的方式以任何方式设置十进制格式?
例子:
我得到的错误:“元素'xsl:decimal-format'有一个属性'grouping-separator',其值为'$grouping_separator'”
通过 xsl:attribute 设置十进制格式也是不可能的。
任何提示表示赞赏。
干杯,兰吉斯
XSLT 1.0和XSLT 2.0的规范都规定grouping-separator属性的值必须是单个字符。似乎不允许使用 AVT。
grouping-separator
另一方面,可以有多种命名的十进制格式,因此这可用于提供格式数字的可变性。
您不能将任何十进制格式的属性指定为属性值模板(即“{...}”)。
假设有少量可能的分隔符,您可以做的是为您想要使用的每个不同分隔符定义多个具有不同名称的十进制格式。然后将不同的名称传递给 format-number 函数以选择具有适当分隔符的格式。