In XSL, how does one convert all element names in a document to lower case before processing it? We\'re using XSLT 2.0, and we\'ve tried the following but it does not work..
It works under Altova XMLSpy:
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xsl:output exclude-result-prefixes="xsl xs" indent="yes"/>
<xsl:template match="*">
<xsl:element name="{lower-case(local-name())}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
XML Input:
<?xml version="1.0" encoding="UTF-8"?>
<A>
<ITEMS>
<ITEM/>
<ITEM/>
</ITEMS>
</A>
XML output:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<items>
<item/>
<item/>
</items>
</a>
translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ", 'abcdefghijklmnopqrstuvwxyz')