How to change XML to lower case using XSLT multi-pass?

Today I’ve resolved another issue using XSLT multi-pass technique presented in my previous post. I think this be might useful in future, so I post it here. The XSLT translates the input XML to lower case (it changes only node names, it doesn’t affect data inside elements or attributes). After that, it applies the actual logic.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:variable name="firstPassResult">
<xsl:apply-templates select="/" mode="firstPass"/>
<xsl:template match="@*|node()" mode="firstPass">
<xsl:apply-templates select="@*|node()"/>
<xsl:template match="*" mode="firstPass">
<xsl:element name="{translate(name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
<xsl:apply-templates select="@*|node()"/>
<xsl:template match="/">
<xsl:apply-templates select="$firstPassResult" mode="secondPass"/>
<xsl:template match="//boss" mode="secondPass">
<xsl:value-of select="text()"/>

The sample XML file (only to prove that this technique works):

<?xml version="1.0" encoding="UTF-8"?>

It worked under Altova XMLSpy and produced the following output:

<?xml version="1.0" encoding="UTF-8"?>JohnHenryNathanigor