Subject:Merge Multiple Files While Checking For Duplicates Author:Adam McCormick Date:20 Jul 2009 08:15 PM
Ok here's the situation; I have multiple xml files that I need to merge into one compiled xml file. The files look something like this:
Note that I only show 3 files but there can be, and are, many more
data3.xml
<report name="report1">
<items name="items1">
<item name="item-one" data="8" />
<item name="item-two" data="8" />
<item name="item-three" data="9" />
</items>
</report>
After merging these docs I would like to have a result like this:
I created a master file that lists the paths to all the data files. The problem is I can't just go through every file and compare the current item to all the files and get its data becuase if items in some other file don't appear in file 1 I will never know because I'll never search for them. I created a small test xsl that seemed to almost (stressing almost) solve my problem:
Please excuse me if it's a complete disaster and makes alot of you cringe but I've only been at this xsl stuff for a week now.
The output from this style sheet shows me this:
item-one
Day: 0
Day: 0
Day: 8
item-two
Day: 2
Day: 2
Day: 8
item-three
Day:
Day: 7
Day: 9
This is soooo close (unless I'm duping myself). The major problem is it only works with 2 files. I need to able to recurse the logic in the select for the combine variable, so that in the end its been combined with all files but I'm at a complete loss.