Basically, the grouping feature may be called "for-each on steroids". The new instruction, for-each-group, works similar to for-each, but on each iteration it gives you a group of nodes instead of a single node. This group, accessed by current-group() in XPath, can be further sorted, filtered, transformed, etc. The best thing about that is that the groups may be selected based on a wide variety of tests, such as common value, adjacency, starting/ending node etc.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Grouping using XSLT 2.0 (question for Dmitry Kirsanov)