format number og decimaler
Hej.Jeg vil gerne kunne angive 2 decimaler i dansk format hvis de er i xml'en. Hvis prisen er ,00 skal der blot vises et heltal. Jeg kan ikke få det til at virke:
<products>
<product>
<name>LA</name>
<price>299,50</price>
<description>Looking for Hollywood?</description>
<version>1.0</version>
</product>
<product>
<name>Springfield</name>
<price>199,00</price>
<description>
Nice place
</description>
<version>5.0</version>
</product>
<product>
<name>NYC</name>
<price>299</price>
<description>The big apple</description>
<version>1.5</version>
</product>
<product>
<name>Chicago</name>
<price>599,99</price>
<description>Cold in winter</description>
</product>
</products>
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/products">
<html>
<head>
<title>Cascading Style Sheet</title>
<link rel="stylesheet" type="text/css" href="table.css"
title="Style"/>
</head>
<body>
<table border="1">
<tr class="header">
<td>Name</td>
<td>Price</td>
<td>Description</td>
</tr>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
<xsl:decimal-format name="european" decimal-separator="," grouping-separator="." NaN="Not a Number" />
<xsl:template match="product">
<tr class="odd">
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="format-number(price, '#,##', 'european')"/></td>
<td><xsl:value-of select="description"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>