Given the following XML:
11
Muenchian grouping is a work of genius. It's not easy to understand, but see: http://www.jenitennison.com/xslt/grouping/muenchian.html
To simplify the process the W3C specifically supported grouping in XSLT2.0. See, for example: http://www.xml.com/pub/a/2003/11/05/tr.html
However not all environments support XSLT2.0