in XSL

2019-07-30 16:31发布

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

标签: xslt xslt-1.0
2条回答
Lonely孤独者°
2楼-- · 2019-07-30 17:11

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.

查看更多
手持菜刀,她持情操
3楼-- · 2019-07-30 17:14

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.

查看更多
登录 后发表回答