Grouping in XSLT 2.0

Grouping in XSLT 1.0 can be quite difficult. Grouping with the Muenchian method is one way to do it with XSLT 1.0. You can find out more about grouping with Muenchian method in XSLT 1.0 here.

Grouping in XSLT 2.0 is easier.

group-by

Here's some XML for William Shakespare's The Tragedy of Hamlet, Prince of Denmark, Act 3, Scene 1.

Click here to see the XML document for this play.

We'll group speeches here by character and then group by scene.

Click here to see how this can be done with XSLT 1.0 with the Muenchian method.

And here's how to it with XSLT 2.0.

And here's the output.