<xsl:decimal-format group-separator=“{$myseparator}”/> in XSL

爷,独闯天下 提交于 2019-12-11 07:29:37

问题


is it possible to set decimal-format in any way by using a variable or similar?

Example:

The error I get : "The element 'xsl:decimal-format' has an attribute 'grouping-separator' with an illegal value of '$grouping_separator"

Setting the decimal-format via a xsl:attribute is not possible also.

Any hints appreciated.

Cheers, Ranjith


回答1:


The spec for XSLT 1.0 and XSLT 2.0 both state that the value for the grouping-separator attribute must be a single character. It appears that AVT is not allowed.

On the other side, one can have multiple named decimal formats, so this can be used to provide variability in formatting numbers.




回答2:


You can't specify any of properties of a decimal format as attribute value templates (i.e. "{...}").

Assuming a small number of possible separators, what you could do is define multiple decimal-formats with different names for each different separator you would like to use. And then pass in a different name to the format-number function to select the format with the appropriate separator.



来源:https://stackoverflow.com/questions/4805164/xsldecimal-format-group-separator-myseparator-in-xsl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!