I am new to XSLT transformation and got stuck with this recursive mapping.
<Element1>
<Element11/>
<Element12/>
<Element13/>
<Element1>
<Element11/>
<Element12/>
<Element13/>
</Element1>
</Element1>
Will be transformed into
<Information>
<Element11/>
<Element12/>
<Element13/>
</Information>
<!-- This will be the child Element1 -->
<Metadata>
<Element11/>
<Element12/>
<Element13/>
</Metadata>
Definitely I can't use:
<xsl:template match="/">
<xsl:for-each select="Element1">
<Information>
</xsl:for-each>
</xsl:template>
This should do the job:
As Tim notes the result is not a valid XML because it has two root elements. To generate an extra
root
element to make the output valid XML add this template: