I would like to rename the mattext node to text, but retain its attributes and all the child node/attributes
Input XML
<material>
<mattext fontface="Tahoma">
<p style="white-space: pre-wrap">
<font size="11">Why are the astronauts in the video wearing special suits? (Select two)</font>
</p>
</mattext>
</material>
Output
<material>
<text fontface="Tahoma">
<p style="white-space: pre-wrap">
<font size="11">Why are the astronauts in the video wearing special suits? (Select two)</font>
</p>
</text>
</material>
I have used the following xsl:
<xsl:template name="content">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- Build stem -->
<xsl:template match="mattext">
<text>
<!-- Option text -->
<xsl:call-template name="content"/>
</text>
</xsl:template>
But it does not retain the initial fontface attribute and seems to output plain text stripping the tags
I can understand your result if that is your complete XSLT. You are inly matching one element, the <mattext>. All others are handled by the default behavior which is to copy the text nodes. I guess you want an Identity Transformation with a special handling of the <mattext> element: