Grouping Nodes

When grouping nodes, we sort things to get them into a certain order, and then we group all items that have the same value for the sort key (or keys). We’ll use xsl:sort for this grouping, and then use variables or functions such as key() or generate-id() to finish the job.

[2.0] XSLT 2.0 has new elements and functions that make grouping much easier. If you’re using XSLT 2.0, feel free to skip ahead to the section [2.0] New Grouping Syntax in XSLT 2.0” later in this chapter.

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.