XSLT decimal-format causes exception

一曲冷凌霜 提交于 2019-12-11 10:42:57

问题


I am trying to use the xslt:decimal-format element, but I get the same error message whether I use my own code or the example code provided by w3schools.com. This is the w3 sample code:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>

<xsl:template match="/">
<xsl:value-of select="format-number(26825.8, '#,###.00', 'euro')"/>
</xsl:template>

</xsl:stylesheet>

And this is the XsltException it produces when I run it in Visual Studio 2010:

"Format '#,###.00' cannot have zero digit symbol after digit symbol after decimal point."

What's wrong on my side that causes this error?


回答1:


You have changed the decimal format, called "euro" so that a valid number looks like this "1.232,99" (one thousand, two hundred and thirty two, point nine-nine in words). This does not match the format you have requested which is "#,###.00".

Change your format-number pattern to "#.###,00"



来源:https://stackoverflow.com/questions/15095435/xslt-decimal-format-causes-exception

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