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

Re: Merging two xml files

Subject: Re: Merging two xml files
From: David Mitchell <dmitchell4@xxxxxxxxx>
Date: Tue, 26 Aug 2003 08:50:37 -0500
merging technologie
>>I am trying to merge two xml files, using a xsl stylesheet...
>>Basically, the only thing I know about the files is that they have the same
>>root node.
>>
>>For example, with the 2 following files:
>>File1.xml:
>><root>
>>       <elt1 att1="a" att2="b">
>>               <subelt1 att1="b"/>
>>               <subelt1 att1="c"/>
>>       </elt1>
>>       <elt2 att1="d"/>
>></root>
>>
>>File2.xml:
>><root>
>>       <elt1 att1="a" att2="b">
>>               <subelt1 att1="c"/>
>>               <subelt1 att1="d"/>
>>       </elt1>
>>       <elt1 att1="a" att2="d">
>>               <subelt1 att1="x"/>
>>       </elt1>
>>       <elt3 att1="e"/>
>></root>
>>
>>Should give something like:
>><root>
>>       <elt1 att1="a" att2="b">
>>               <subelt1 att1="b"/>
>>               <subelt1 att1="c"/>
>>               <subelt1 att1="d"/>
>>       </elt1>
>>       <elt1 att1="a" att2="d">
>>               <subelt1 att1="x"/>
>>       </elt1>
>>       <elt2 att1="d"/>
>>       <elt3 att1="e"/>
>></root>
>>
>>So the following rules must be respected:
>>. Each element associated with its attribute is unique (we don't have two
>><elt1 att1="a" att2="b">).
>>. If one element exists only in one of the file, it should  appear in the
>>output.
>>

The online chapter of Sal Mangano's XSLT Cookbook may shed some light
on this. Check out:

http://www.oreilly.com/catalog/xsltckbk/chapter/ch07.pdf

(I recommend the whole book as well.) Sorry that I don't have time to
cook up a working sample myself. ;-)

--David Mitchell


 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.