I suggest that XSLT is not the right tool for this task. XSLT will do a good job of marking up XML that is already well constructed, it's really not very good at processing data.
There are many XSLT hacks that let you find groupings and rearrange pieces and sort parts and loop with conditions in interesting ways... but it's (almost) always easier to parse the XML with some kind of server-side script, clean up dupes and rearrange the data, then throw the result of that into your XSLT. What will take 1000 lines of infuriating and confusing XSLT acrobatics can be done in 20 lines of PHP or C#.
Your XML is malformed and the task specifications leave for quite a bit of assumptions...
What you have here is not duplicated nodes, but rather a collection of duplicated data within multiple nodesets. Matching data against each other accross multiple nodes is gonna be pretty much impossible to implement. There is a slim chance that this can be done, but unless you provide a well-formed XML and elaborate on the specifications, it will be a wasted effort.