[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Find elements with same key and merge sub-elements
Hi, I have an xml file containing dictionary entries with their meanings/senses. I'd like to find Entries that have 2 or more senses that have the same gloss. Sometimes an entry will have more than one sense but each sense will have its own unique gloss. For the entries that have senses with identical glosses, I want to merge those senses and their contents as shown below. Input <Root> <Entry form="voiture"> <Sense num="1"> <Gloss>car</Gloss> <Index> <IndexItem>automobile</IndexItem> <IndexItem>vehicle</IndexItem> <IndexItem>car</IndexItem> </Index> </Sense> <Sense num="2"> <Gloss>car</Gloss> <Category>transportation</Category> </Sense> </Entry> <Entry> <!-- ...Etc.... --> </Entry> </Root> Desired Output: <Root> <Entry form="voiture"> <Sense num="1"> <Gloss>car</Gloss> <Index> <IndexItem>automobile</IndexItem> <IndexItem>vehicle</IndexItem> <IndexItem>car</IndexItem> </Index> <Category>transportation</Category> </Sense> </Entry> <Entry> <!-- ...Etc.... --> </Entry> </Root> Thanks in advance for any pointers as to what might be the most efficient approach. Larry
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|