[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problems merging two xml documents

Subject: Problems merging two xml documents
From: sp <spamthis@xxxxxxxxxxxxxx>
Date: Mon, 4 May 2009 09:31:40 -0700
 Problems merging two xml documents
HI,

I'm trying to merge and copy two xml documents, into a new xml
document and in a nutshell no matter what xsl I write I have yet to
been able to get it to merge as I desire.

I don't just want the content of the elements, I want to make a copy
of each element making a new xml document. I've been utilizing the xsl
copy-of and the document() to try and do this, with merge and copy
examples as my guide.

After a day and a half of trying, I've gotten close, but still can't
get any one example to do what I need.  I don't know what of my many
efforts to provide as an example, so I thought I should just
illustrate below what I want and see if anyone can offer help.

thanks in advance for any suggestions or examples.

This document is merged with doc2, to form a new version of doc1.  Any
common elements from doc2 replace doc1s elements of the same name, any
new elements from doc2 are added

<doc1>

<a>
 <a1></a1>
 <a2></a2>
 <!-- etc -->
</a>

<b>
 <b1></b1>
 <b2></b2>
 <!--etc -->
</b>

<c>
 <c1></c1>
 <c2></c2>
 <!--etc -->
</c>

</doc1>

All except root element should be merged into doc1,  if element
already exists it replaces the ones in doc1

<doc2>

<c>
 <c1>more recent stuff</c1>
 <c2>more recent stuff</c2>
 <!--etc -->
</c>

<d> new element not in doc1 </d>

</doc2>


final doc, which is just a new version of doc1:


<doc1>

<a>
 <a1></a1>
 <a2></a2>
 <!-- etc -->
</a>

<b>
 <b1></b1>
 <b2></b2>
 <!--etc -->
</b>

<c>
 <c1>more recent stuff</c1>
 <c2>more recent stuff</c2>
 <!--etc -->
</c>

<d> new element not in doc1 </d>

</doc1>


thank you

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.