This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

merging xml files




i have got a fairly conplicated problem ( atleast for me :( )
i have got 3 xml files that contains university result data from 3 different regions.and i have to merge them into one xml with all the data from 3 xmls. The resultant XML should have the same structure as individual XMLs.
for example,
xml1:
<?xml version="1.0"?>
<university-records>
<univ-ids>
<univ id = "KSU">
<name>Kansas State University</name>
<location>Kansas<location>
</univ>
<univ id = "FAU">
<name>Florida Atlantic University</name>
<location>Florida<location>
</univ>
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
<univ id = "OSU">
<name>Ohio State University</name>
<location> Ohio <location>
</univ>
</univ-ids>
<university-results>
<university univ-id = "KSU">100%</university>
<university univ-id = "MSU">90%</university>
<university univ-id = "FAU">80%</university>
</university-results>
</university-records>

xml2:
<?xml version="1.0"?>
<university-records>
<univ-ids>
<univ id = "OSU">
<name> Ohio State University</name>
<location> Ohio <location>
</univ>
<univ id = "WSU">
<name> Wisconsin state University</name>
<location> Wisconsin <location>
</univ>
<univ id = "RPI">
<name> Rensellar polytechnic Institute </name>
<location> New Jersey <location>
</univ>
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
</univ-ids>
<university-results>
<university univ-id = "OSU">70%</university>
<university univ-id = "WSU">100%</university>
<university univ-id = "RPI">100%</university>
</university-results>
</university-records>
xml3:
<?xml version="1.0"?>
<university-records>
<univ-ids>
<univ id = "NSU">
<name> Newyork State University</name>
<location> Newyork <location>
</univ>
<univ id = "BU">
<name> Belmont University</name>
<location> Belmont <location>
</univ>
<univ id = "WSU">
<name>Wisconsin state University</name>
<location> Wisconsin <location>
</univ>
<univ id = "BCM">
<name> Berklee College of Music</name>
<location> Berklee <location>
</univ>
</univ-ids>
<university-results>
<university univ-id = "NU">70%</university>
<university univ-id = "BU">60%</university>
<university univ-id = "BCM">100%</university>
</university-results>
</university-records>


i want the resultant xml to be ...

<university-records>
<univ-ids>

<univ id = "KSU">
<name>Kansas State University</name>
<location>Kansas<location>
</univ>
<univ id = "FAU">
<name>Florida Atlantic University</name>
<location>Florida<location>
</univ>
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
<univ id = "OSU">
<name> Ohio State University</name>
<location> Ohio <location>
</univ>
<univ id = "OSU">
<name> Ohio State University</name>
<location> Ohio <location>
</univ>
<univ id = "WSU">
<name> Wisconsin state University</name>
<location> Wisconsin <location>
</univ>
<univ id = "RPI">
<name> Rensellar polytechnic Institute </name>
<location> New Jersey <location>
</univ>
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
<univ id = "NSU">
<name> Newyork State University</name>
<location> Newyork <location>
</univ>
<univ id = "BU">
<name> Belmont University</name>
<location> Belmont <location>
</univ>
<univ id = "WSU">
<name>Wisconsin state University</name>
<location> Wisconsin <location>
</univ>
<univ id = "BCM">
<name> Berklee College of Music</name>
<location> Berklee <location>
</univ>

</univ-ids>
<university-results>
<university univ-id = "NU">70%</university>
<university univ-id = "BU">60%</university>
<university univ-id = "BCM">100%</university>
<university univ-id = "OSU">70%</university>
<university univ-id = "WSU">100%</university>
<university univ-id = "RPI">100%</university>
<university univ-id = "KSU">100%</university>
<university univ-id = "MSU">90%</university>
<university univ-id = "FAU">80%</university>
</university-results>
</university-records>


Things to be noticed here: The <univ-ids> in each of the xml files have some <univ-id> elements which are there in other xmls as well. for example the
<univ id = "MSU">
<name> Mississipi State University</name>
<location> Mississipi <location>
</univ>
which is in the xml2
similarly..
<univ id = "OSU">
<name> Ohio State University</name>
<location> Ohio <location>
</univ>
is there in both the xml files..

But The final XML should not reflect this.

Any Ideas as to how we can acheive this??

Thanks in advance..
laura

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]