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

Using XSLT to merge two XML Nodes

Subject: Using XSLT to merge two XML Nodes
From: Santosh Shanbhag <santoshlovesjava@xxxxxxxxx>
Date: Fri, 19 Aug 2005 11:04:36 -0500
xslt merge nodes
Hi,

I have a document with two nodes that I have to merge:

<AllBooks>
 <BookList1>
   <Book id=3D"1" upc=3D"1" someotherID=3D"booklist1" salePrice=3D"1"/>
   <Book id=3D"3" upc=3D"3" someotherID=3D"booklist1" salePrice=3D"3"/>
   <Book id=3D"4" upc=3D"4" someotherID=3D"booklist1" salePrice=3D"4"/>
 </BookList1>
 <BookList2>
   <Book id=3D"2" upc=3D"2" someotherID=3D"booklist2" salePrice=3D"2"/>
   <Book id=3D"3" upc=3D"3" someotherID=3D"booklist2" salePrice=3D"3"/>
   <Book id=3D"4" upc=3D"4" someotherID=3D"booklist2" salePrice=3D"4"/>
   <Book id=3D"5" upc=3D"5" someotherID=3D"booklist2" salePrice=3D"5"/>
 </BookList2>
</AllBooks>

My output needs to be:

<AllBooks>
 <BookList>
   <Book id=3D"1" upc=3D"1" someotherID=3D"booklist1" salePrice=3D"1"/>
   <NotFound/>
   <NotFound/>
   <Book id=3D"2" upc=3D"2" someotherID=3D"booklist2" salePrice=3D"2"/>
   <Book id=3D"3" upc=3D"3" someotherID=3D"booklist1" salePrice=3D"3"/>
   <Book id=3D"3" upc=3D"3" someotherID=3D"booklist2" salePrice=3D"3"/>
   <Book id=3D"4" upc=3D"4" someotherID=3D"booklist1" salePrice=3D"4"/>
   <Book id=3D"4" upc=3D"4" someotherID=3D"booklist2" salePrice=3D"4"/>
   <NotFound/>
   <Book id=3D"5" upc=3D"5" someotherID=3D"booklist2" salePrice=3D"5"/>

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.