I have a XML-document created by MS Excel. What I want is to combine nodes with same id. The xml I currently have is something like this:
<ns1:publications>
<ns1:book id="3" subType="book">
<ns1:peerReviewed>false</ns1:peerReviewed>
<ns1:publicationCategory>scientific</ns1:publicationCategory>
<ns1:publicationStatus>published</ns1:publicationStatus>
<ns1:language>en_GB</ns1:language>
<ns1:title>
<ns2:text lang="en" country="EN">Kirja3</ns2:text>
</ns1:title>
<ns1:abstract>
<ns2:text lang="en" country="EN">
</ns1:abstract>
<ns1:persons>
<ns1:author>
<ns1:role>author</ns1:role>
<ns1:person external="false" id="3">
<ns1:firstName>Rob</ns1:firstName>
<ns1:lastName>Hubbard</ns1:lastName>
</ns1:person>
</ns1:author>
</ns1:persons>
<ns1:organisations>
<ns1:organisation id="220400"/>
</ns1:organisations>
<ns1:owner id="220400"/>
<ns1:publicationDate>
<ns2:year>2014</ns2:year>
</ns1:publicationDate>
<ns1:visibility>Public</ns1:visibility>
<ns1:numberOfPages>655</ns1:numberOfPages>
<ns1:placeOfPublication>Newcastle</ns1:placeOfPublication>
</ns1:book>
<ns1:book id="3">
<ns1:title/>
<ns1:abstract/>
<ns1:persons>
<ns1:author>
<ns1:person id="4">
<ns1:firstName>Chris</ns1:firstName>
<ns1:lastName>Steward</ns1:lastName>
</ns1:person>
</ns1:author>
</ns1:persons>
<ns1:organisations>
<ns1:organisation id="220400"/>
</ns1:organisations>
<ns1:owner id="220400"/>
<ns1:publicationDate/>
</ns1:book>
And it should be something like this:
<ns1:publications>
<ns1:book id="3" subType="book">
<ns1:peerReviewed>false</ns1:peerReviewed>
<ns1:publicationCategory>scientific</ns1:publicationCategory>
<ns1:publicationStatus>published</ns1:publicationStatus>
<ns1:language>en_GB</ns1:language>
<ns1:title>
<ns2:text lang="en" country="EN">Kirja3</ns2:text>
</ns1:title>
<ns1:abstract>
<ns2:text lang="en" country="EN">
</ns1:abstract>
<ns1:persons>
<ns1:author>
<ns1:role>author</ns1:role>
<ns1:person external="false" id="3">
<ns1:firstName>Rob</ns1:firstName>
<ns1:lastName>Hubbard</ns1:lastName>
</ns1:person>
</ns1:author>
<ns1:author>
<ns1:person external="false" id="4">
<ns1:firstName>Chris</ns1:firstName>
<ns1:lastName>Steward</ns1:lastName>
</ns1:person>
</ns1:author>
</ns1:persons>
<ns1:organisations>
<ns1:organisation id="220400"/>
<ns1:organisation id="220300"/>
</ns1:organisations>
<ns1:owner id="220400"/>
<ns1:publicationDate>
<ns2:year>2014</ns2:year>
</ns1:publicationDate>
<ns1:visibility>Public</ns1:visibility>
<ns1:numberOfPages>655</ns1:numberOfPages>
<ns1:placeOfPublication>Newcastle</ns1:placeOfPublication>
</ns1:book>
Data comes from Excel spreadsheet that has information on rows. For example book can have multiple authors and they are on separate rows with same id on first column.