Use concat function to create name of Element
File: Data.xml
<?xml version="1.0"?>
<message>
You can use the element element to create elements on the result
tree.
</message>
File: Transform.xslt
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="message">
<xsl:element name="{concat('my', name())}">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?>
<mymessage>
You can use the element element to create elements on the result
tree.
</mymessage>
Related examples in the same category