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

Merging two xml files.

Subject: Merging two xml files.
From: "Bhaskar Reddy" <bhaskar_reddy@xxxxxxxxxxx>
Date: Mon, 12 Jan 2004 21:59:29 +0530
merge two xml files
Hi,
I have many sets of data in xml files. Each set has three xml files. And each set has different tree structure. So I am looking for some general solution.


I want to merge file 1 and file 2, depending on the attribute"src" from file 3( template file) of the set.

Sample files for a set are as shown below..

the "src" attribute tells from where to get the value of that element.

file 1: xml
-------------
<Data>
    <Name> Peter Radke </Name>
    <Age> 34 </Age>
    <Address>
               <Street> 34 Peter Ave </Street>
               <City> Chicago</City>
               <Country> USA </Country>
    </Address>
</Data>

file 2: xml : Has very similar structure but different values

<Data>
    <Name> Peter </Name>
    <Age> 38 </Age>
    <Address>
               <Street> 38 Bradway st</Street>
               <City> NewYork</City>
               <Country> USA </Country>
    </Address>
</Data>

file 3: xml :
<Data>
    <Name src="file1"> </Name>
    <Age src="file2"></Age>
    <Address src="file2">
    </Address>
</Data>

file 3 is a template file for merging file 1 and file 2. the src attribute in this file tells from where to get the element value from. For example the Name element value should be read from the file1 and the Age should be from the file 2. And the whole <Address> structure should be read from the file 2.

So the result should look like

Result FILE:
----------------
<Data>
    <Name> Peter Radke </Name>
    <Age> 38 </Age>
    <Address>
               <Street> 38 Bradway st</Street>
               <City> NewYork</City>
               <Country> USA </Country>
    </Address>
</Data>

_________________________________________________________________
Free drafts to 700 locations. http://server1.msn.co.in/msnleads/suvidha/dec03.asp?type=hottag Click here.



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.