I'm currently stuck on applying multiple xsl:template with the same match for an element. The example below shows the problem.
Does anyone knows a XSL template that creates the expected output using two "template match"s? For technical reasons it's not possible to put the two "template" elements together.
Input
<root>
<elem>123.45</elem>
<elem>789.12</elem>
</root>
XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:decimal-format name="de" decimal-separator="," grouping-separator="."/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/root/elem">
<xsl:element name="renamed">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="/root/elem">
<xsl:element name="elem">
<xsl:value-of select="format-number(.,'#.##0,0000','de')" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Output:
<root>
<elem>123,4500</elem>
<elem>789,1200</elem>
</root>
Expected output:
<root>
<renamed>123,4500</renamed>
<renamed>789,1200</renamed>
</root>
Thanks