You can use this template to convert parent-with-child to a merged element:
<xsl:template match="parent">
<combined>
<xsl:copy-of select="@* | child/@*" />
</combined>
</xsl:template>
What this means is, copy all the attributes from the input element <parent>and it <child>to the output element <combined>.
You will also need an identification template to pass the element <data>and other nodes through:
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
Larsh source
share