I have a requirement to combine 4 xml files into one. They are like follows.
Document 1
<doc1>
....
<doc1>
Document 2
<doc2>
....
<doc2>
Document 3
<doc3>
....
<doc3>
Document 4
<doc4>
....
<doc4>
I want the output as follows
<doc1>
....
<doc2>
....
</doc2>
<doc3>
....
</doc3>
<doc4>
....
</doc4>
</doc1>
I did it as follows.
<xsl:transform version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy-of select="document('doc1.xml')"/>
<xsl:copy-of select="document('doc2.xml')"/>
<xsl:copy-of select="document('doc3.xml')"/>
<xsl:copy-of select="document('doc4.xml')"/>
</xsl:template>
</xsl:transform>
but the ouput I get is as follows
<doc1>
....
</doc1>
<doc2>
....
</doc2>
<doc3>
....
</doc3>
<doc4>
....
</doc4>
Is it possible to change my script and get what I want?
This transformation produces the wanted result: