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

Merging two documents

Subject: Merging two documents
From: Martin Renner <m.renner@xxxxxxxxxx>
Date: Tue, 10 Apr 2001 09:36:49 +0159
 Merging two documents
Hi.

I have two xml files which have the same structure (and the same DTD). Those two files should be merged into one single xml file, so that the resulting file will still be valid (according to the DTD).

I already checked the xsl archive and the FAQ on http://www.dpawson.co.uk/xsl, but I didn't find a solution for my problem. My problem is, that I cannot identify the elements by an id.

file1.xml
<root>
  <section1>
    <elem>
      <name>1</name>
      nested data for elem "1"
    </elem>
    <elem>
      <name>2</name>
      nested data for elem "2"
    </elem>
  </section1>
  <section2>
    <something-else>
      nested data 1
    </something-else>
  </section2>
</root>


file2.xml has the same structure. Here is just a very short example (usually, file2.xml will also contain <section2>):
<root>
<section1>
<elem>
<name>3</name>
nested data for elem "3"
</elem>
</section1>
</root>



I need something like for-each file1/root/section1/elem copy to output for-each file2/root/section1/elem copy to output for-each file1/section2/something-else copy to output for-each file2/section2/something-else copy to output

How can I write that in XSL (and will this be a solution or are there any "smarter" solutions)?


Martin



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.