varun bhatnagar varun292006(_at_)gmail(_dot_)com wrote:
But I am sorry this is not the root element. There are few more elements
above this one and if I do this then the whole xml is getting written twice.
Is there anything else I can do?
Yes, assuming you know a pattern to identify the parent element of the
elements to merge then change
<xsl:template match="/*">
<xsl:copy>
<xsl:apply-templates select="@* , $doc2/*/node(), node()"/>
</xsl:copy>
</xsl:template>
to e.g.
<xsl:template match="/root/foo/config">
<xsl:copy>
<xsl:apply-templates select="@* , $doc2/root/foo/config, node()"/>
</xsl:copy>
</xsl:template>
or for instance, as long as "config" suffices to identify the parent
element of the elements you want to merge it should suffice to use
<xsl:template match="config">
<xsl:copy>
<xsl:apply-templates select="@* , $doc2//config, node()"/>
</xsl:copy>
</xsl:template>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--