File: Data.xml
<?xml version="1.0"?>
<?xml-stylesheet href="Transform.xslt" type="text/xsl"?>
<format>
<number>100</number>
<number>1000</number>
<number>10000</number>
<number>100000</number>
<number>1000000</number>
<number>10000000</number>
<number>100000000</number>
<number>1000000000</number>
</format>
File: Transform.xslt
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:decimal-format name="de" decimal-separator=","
grouping-separator="." />
<xsl:decimal-format name="fr" decimal-separator=","
grouping-separator=" " />
<xsl:decimal-format name="ru" decimal-separator=","
grouping-separator=" " />
<xsl:decimal-format name="uk" decimal-separator="."
grouping-separator="," />
<xsl:decimal-format name="us" decimal-separator="."
grouping-separator="," />
<xsl:template match="format">
<html>
<head>
<title>Number Formatter</title>
<style type="text/css">
table {margin-left:auto;margin-right:auto} td
{text-align:right;padding: 5px 5px 5px 5px} h3
{text-align:center}
</style>
</head>
<body>
<h3>Number Formatter</h3>
<table rules="all">
<thead>
<tr>
<th>Deutschland</th>
<th>France</th>
<th>
Россия
</th>
<th>United Kingdom</th>
<th>United States</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="number" />
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="number">
<tr>
<td>
<xsl:value-of
select="format-number(.,'.###,00€','de')" />
</td>
<td>
<xsl:value-of
select="format-number(.,' ###,00€','fr')" />
</td>
<td>
<xsl:value-of
select="format-number(.,' ###,00p.','ru')" />
</td>
<td>
<xsl:value-of
select="format-number(.,'£,###.00','uk')" />
</td>
<td>
<xsl:value-of
select="format-number(.,'$,###.00','us')" />
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
Output:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Number Formatter</title><style type="text/css">
table {margin-left:auto;margin-right:auto} td
{text-align:right;padding: 5px 5px 5px 5px} h3
{text-align:center}
</style></head>
<body>
<h3>Number Formatter</h3>
<table rules="all">
<thead>
<tr>
<th>Deutschland</th>
<th>France</th>
<th>
??????
</th>
<th>United Kingdom</th>
<th>United States</th>
</tr>
</thead>
<tbody>
<tr>
<td>100,00?td>
<td>100,00?td>
<td>100,00p.</td>
<td>?0.00</td>
<td>$100.00</td>
</tr>
<tr>
<td>1.000,00?td>
<td>1 000,00?td>
<td>1 000,00p.</td>
<td>?000.00</td>
<td>$1,000.00</td>
</tr>
<tr>
<td>10.000,00?td>
<td>10 000,00?td>
<td>10 000,00p.</td>
<td>?,000.00</td>
<td>$10,000.00</td>
</tr>
<tr>
<td>100.000,00?td>
<td>100 000,00?td>
<td>100 000,00p.</td>
<td>?0,000.00</td>
<td>$100,000.00</td>
</tr>
<tr>
<td>1.000.000,00?td>
<td>1 000 000,00?td>
<td>1 000 000,00p.</td>
<td>?000,000.00</td>
<td>$1,000,000.00</td>
</tr>
<tr>
<td>10.000.000,00?td>
<td>10 000 000,00?td>
<td>10 000 000,00p.</td>
<td>?,000,000.00</td>
<td>$10,000,000.00</td>
</tr>
<tr>
<td>100.000.000,00?td>
<td>100 000 000,00?td>
<td>100 000 000,00p.</td>
<td>?0,000,000.00</td>
<td>$100,000,000.00</td>
</tr>
<tr>
<td>1.000.000.000,00?td>
<td>1 000 000 000,00?td>
<td>1 000 000 000,00p.</td>
<td>?000,000,000.00</td>
<td>$1,000,000,000.00</td>
</tr>
</tbody>
</table>
</body>
</html>
|