问题
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