Merge two different xml files into one

Discussion in 'XML' started by Kjetil Finsrud, Nov 23, 2004.

  1. I have two xml files that I wish to join/merge into one. The first
    file (sp.xml)includes information about study programmes and the
    second one includes information about each course. The only thing I
    want from file number two(course.xml) abouts courses is credits.
    credits pr. course. I am using xsl to show the data.

    Here's the first xml file(sp.xml):
    <studyinfo>
    <studyprogramme>
    <name>Bachelor Agroecology</name>
    <language>Norwegian</language>
    <code>B-GEOM</code>
    <studyoptions>
    <coursecomposition>
    <coursecombination level ="1">
    <coursecombinationcode>B-GEOM-OBL</coursecombinationcode>
    <coursecombinationame>Geomatikk</coursecombinationame>
    <course>
    <courseid>
    <coursecode>STAT100</coursecode>
    <institutenr>192</institutenr>
    </courseid>
    <coursename>Statistics</coursename>
    <semester>1</semester>
    <status>O</status>
    --> here I want credits from the other xml file(course.xml)!
    </course>
    etc.
    </coursecombination>
    </coursecomposition>
    </studyoptions>
    </studyprogramme>
    </studyinfo>


    Here's file number two(course.xml):
    <studyinfo>
    <courses>
    <course>
    <courseid>
    coursecode>STAT100</coursecode>
    <institutenr>192</institutenr>
    </courseid>
    <coursename>Statistics</coursename>
    <semester>1</semester>
    <status>O</status>
    <credits>10</credits> ---->I want this info into my first
    file(sp.xml)
    </course>
    </courses>
    </studyinfo>

    etc.
    ---------------------------------

    I loop through the document number one (sp.xml)and I have tried using
    document() function, but only get the credits for the first course!
    The credits for the rest of the courses are from the first course in
    the course.xml file, therefore the same.

    Also tried <xsl:copy of select="">, but with no luck yet.

    Have you any suggestions on a solution for this problem?
     
    Kjetil Finsrud, Nov 23, 2004
    #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. Luke Airig
    Replies:
    1
    Views:
    933
    Patrick TJ McPhee
    Dec 16, 2003
  2. Luke Airig
    Replies:
    0
    Views:
    644
    Luke Airig
    Dec 21, 2003
  3. Eirik Eldorsen

    [Ant] Merge two xml files

    Eirik Eldorsen, Jan 24, 2004, in forum: XML
    Replies:
    1
    Views:
    6,354
    Brian Agnew
    Apr 12, 2004
  4. Jacinle Young
    Replies:
    3
    Views:
    455
    Jacinle Young
    Jun 28, 2004
  5. could ildg
    Replies:
    7
    Views:
    2,363
    Grant Edwards
    Apr 5, 2005
Loading...

Share This Page