xsl:value-of
must be empty, no doubt. But you don't need anything inside it. The stylesheet below is an identity transform with two exceptions, namely replacing the element names of e1
and e2
.
It is quite generic in the sense that it replaces e1
and e2
in any XML document and leaves all the rest untouched.
Stylesheet
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="e1">
<c1>
<xsl:apply-templates select="@*|node()"/>
</c1>
</xsl:template>
<xsl:template match="e2">
<c2>
<xsl:apply-templates select="@*|node()"/>
</c2>
</xsl:template>
</xsl:stylesheet>
Output
<?xml version="1.0" encoding="UTF-8"?>
<c1>t1<c2>t2</c2></c1>