[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Merging two xml files
>>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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|