<xsl:decimal-format group-separator="{$myseparator}"/> in XSL
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 i开发者_如何学Cs not possible also.
Any hints appreciated.
Cheers, Ranjith
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.
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.
精彩评论