I've searched for the answer to this and frankly, I came up with so many possible answers that I was overwhelmed and so I'm still not sure how to proceed.
I've got two XML files that I would like to merge together and then sort based on three separate criteria.
Each file is, of course, in the same structure:
<root>
<item>
<number>1</number>
<name>Name</name>
<time>6h</time>
<internal>NAME_01</internal>
<flag>0</flag>
</item>
</root>
I'm simply trying to merge the two files together and then sort. The sorting would need to be done in such an order:
- Flag (This can be a 0 or a 1. 0 would come first.)
- Number (Simple digit from 1 to 20. Would be sorted lowest first.)
- Name (Simple alphabetization.)
I've seen many of the suggestions for this use XSLT which I know exactly nothing about. I'm not opposed to using it provided I'm given some instructions on how to go about implementing it. It doesn't have to be XSLT, though. I'm open to any option, simplicity would be key. Free applications (downloadable or web based) that can do this for me would be my holy grail.
An example of acceptable sorting would be:
<root>
<item>
<number>1</number>
<name>Apple</name>
<time>6h</time>
<internal>FRUIT_APPLE_01</internal>
<flag>0</flag>
</item>
<item>
<number>1</number>
<name>Banana</name>
<time>2h</time>
<internal>FRUIT_BANANA_01</internal>
<flag>0</flag>
</item>
<item>
<number>4</number>
<name>Cabbage</name>
<time>1h 15m</time>
<internal>VEGETABLE_CABBAGE_02</internal>
<flag>0</flag>
</item>
<item>
<number>4</number>
<name>Cucumber</name>
<time>25m</time>
<internal>FRUIT_CUCUMBER_01</internal>
<flag>0</flag>
</item>
<item>
<number>12</number>
<name>Avocado</name>
<time>12h</time>
<internal>FRUIT_AVOCADO_03</internal>
<flag>0</flag>
</item>
<item>
<number>3</number>
<name>Cat</name>
<time>6h</time>
<internal>MAMMAL_01</internal>
<flag>1</flag>
</item>
<item>
<number>8</number>
<name>Iguana</name>
<time>1h</time>
<internal>REPTILE_04</internal>
<flag>1</flag>
</item>
</root>
Please let me know if I can clarify anything.
Many thanks.