The xsl:for-each-group element selects a sequence of nodes and/or atomic values and organizes them into subsets called groups. There are four possible ways of defining the grouping:

Saxon implements the xsl:for-each-group instruction in full, except that some error conditions are not detected. For examples of using the instruction, see the draft XSLT 2.0 specification.