Good way to selectively merge XML docs?

Discussion in 'XML' started by Jim Bancroft, Jun 26, 2003.

  1. Jim Bancroft

    Jim Bancroft Guest

    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, Jun 26, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KYG
    Replies:
    2
    Views:
    875
    Ian Collins
    Aug 18, 2008
  2. J
    Replies:
    0
    Views:
    335
  3. Stefan Behnel
    Replies:
    0
    Views:
    610
    Stefan Behnel
    Jan 12, 2012
  4. Stéphane Wirtel
    Replies:
    0
    Views:
    170
    Stéphane Wirtel
    Apr 19, 2007
  5. Al
    Replies:
    1
    Views:
    140
    Henry Law
    Oct 16, 2005
Loading...

Share This Page