Ogawa
Ogawa

Reputation: 87

XSLT decimal-format causes exception

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?

Upvotes: 2

Views: 2080

Answers (1)

samjudson
samjudson

Reputation: 56853

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"

Upvotes: 3

Related Questions