XSLT十进制格式导致异常 [英] XSLT decimal-format causes exception

查看:168
本文介绍了XSLT十进制格式导致异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用xslt:decimal-format元素,但无论使用我自己的代码还是使用w3schools.com提供的示例代码,我都会得到相同的错误消息。这是w3示例代码:

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


< xsl:template match =/>
< / xsl:template>

< / xsl:stylesheet>

这是我在Visual Studio 2010中运行时产生的XsltException:



格式'#,###。00'在小数点后面的数字符号后不能有零数字符号。



什么是错误在我的身边,导致这个错误?

解决方案

你已经改变了十进制格式,所谓的欧元看起来像这个1.232,99(一千二百三十二点九九)。这与您请求的格式不匹配#,###。00。



将格式数字模式更改为#。###, 00


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?

解决方案

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"

这篇关于XSLT十进制格式导致异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆