Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Good way to selectively merge XML docs?

 
Thread Tools Search this Thread
Old 06-26-2003, 09:40 PM   #1
Default Good way to selectively merge XML docs?



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






Jim Bancroft
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump