Clas, can you use XSLT 2.0 instead 1.0? (If you can control the XSLT engine you use, then switch to SAXON by M. Kaye, from the web-site, you can also download all you need for .NET reuse.) If so, and the so-called Muenchian method is your friend. All you need to know you will find here: http://www.jenitennison.com/xslt/grouping/muenchian.html[^] Best regards, Stefan