I have a strangely formatted XML document in which there are several tags that are repeated; but I need to process this data with a tool that does not support duplicate tags.
So I need a way to concatenate data in duplicate tags.
My original document is as follows:
<root> <irrelevantTag1>irrelevantData1</irrelevantTag1> <irrelevantTag2>irrelevantData2</irrelevantTag2> <irrelevantTag3> <irrelevantTag4>irrelevantData4</irrelevantTag4> <keyword>one</keyword> <keyword>two</keyword> </irrelevantTag3> <irrelevantTag5>irrelevantData5</irrelevantTag5> </root>
I need a stylesheet to combine the values ββwith two "keyword" tags and create a single keyword tag, as in the next release:
<root> <irrelevantTag1>irrelevantData1</irrelevantTag1> <irrelevantTag2>irrelevantData2</irrelevantTag2> <irrelevantTag3> <irrelevantTag4>irrelevantData4</irrelevantTag4> <keyword>one,two</keyword> </irrelevantTag3> <irrelevantTag5>irrelevantData5</irrelevantTag5> </root>
source share