I have two XML streams with different information about the same entities. I would like to be able to merge them to produce an XML output stream with all the information from the two streams.
 
Example:
 
Input stream one:
<entity id = 1>
  <a>some data</a>
  <b>some shared data</b>
</entity>
 
Input stream two:
<entity id = 1>
  <b>some shared data</b>
  <c>some more data</c>
</entity>
 
 
Desired output stream:
<entity id = 1>
  <a>some data</a>
  <b>some shared data</b>
  <c>some more data</c>
</entity>
 
I can see how to do this with tools such as JAXP, but I am struggling with how to start in XSLT. The only solution I have at the moment is very complex using a java class to return the element, and that java class uses Xalan to return the entity with the correct data from the second stream. This is a little inefficient, and I am having problems working out how to eliminate the duplicate elements such as <b> in the above example.
 
I have already searched the archives for this mailing list, and devoured the Wrox press book on XSLT, and am no wiser. If there is anyone out there that can help I would be grateful.
 
 
Phil Rice

Reply via email to