Good way to selectively merge XML docs?

J

Jim Bancroft

Hi folks,

I'm interested in merging two xml docs together. The documents use the same
structure, and in the case of similar nodes I'd like to keep the "newer"
one. I'll explain what I mean by that below.

For instance, if I have two docs like so:

<!--xmldoc1-->

<topnode>
<automobilepart>
<name>Radiator</name>
<version>4</version>
</automobilepart>
<automobilepart>
<name>Head Gasket</name>
<version>8</version>
</automobilepart>
</topnode>


<!--xmldoc2-->

<topnode>
<automobilepart>
<name>Radiator</name>
<version>6</version> <!--note newer version from above-->
</automobilepart>
<automobilepart>
<name>Spark Plug</name>
<version>4</version>
</automobilepart>
</topnode>

I'd like to create a document which is a combination of the two inputs, but
only has the "latest" version of a given autopart. In the example above, my
final document would contain a Head Gasket, a Spark Plug, and a Radiator,
whose "version" is 6. How might I tackle this? Could I do it with XSLT?
I'm using the MSXML3 parser to create the first two documents, if that helps
any.

TIA,

-Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top