xsl-list
[Top] [All Lists]

Using XSLT to merge two XML Nodes

2005-08-19 09:04:36
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"/>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>