I don't know why you're making such a meal of this. This stylesheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="//SecondNode"/>
</xsl:template>
</xsl:stylesheet>
applied to this document:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<FirstNode>
<SecondNode>
<Children />
</SecondNode>
</FirstNode>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
produces this output:
<?xml version="1.0" encoding="UTF-8"?>
<SecondNode>
<Children/>
</SecondNode>
Which part of it doesn't work?
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference