How to merge sibling elements with same attributes?

Consider XML input like this:\[code\]<root> <sub> <p att1=0 att2=1><i>foo</i></p> <p att1=1 att2=1><i>bar</i></p> <p att1=0 att2=0><i>baz</i></p> <p att1=0 att2=1><i>bazz</i></p> </sub></root>\[/code\]Which should be transformed to:\[code\]<root> <sub> <p att1=0 att2=1><i>foo</i><i>bazz</i></p> <p att1=1 att2=1><i>bar</i></p> <p att1=0 att2=0><i>baz</i></p> </sub></root>\[/code\](Because both \[code\]p\[/code\] parent elemets of \[code\]<i>foo</i>\[/code\] and \[code\]<i>bazz</i>\[/code\] are siblings and have the same attributes.)How to do such a transformation with HXT arrows?
 
Back
Top