xsl:for-each-group

Allocates the items in an input sequence into groups of items (that is, it establishes a collection of sequences) based either on common values of a grouping key, or on a pattern that the initial or final node in a group must match.

Format

<xsl:for-each-group 
  select = expression 
  [group-by = expression] 
  [group-adjacent = expression] 
  [group-starting-with = pattern] 
  [group-ending-with = pattern] 
  [collation = { uri }> 
  <!-- Content: (xsl:sort*, sequence-constructor) --> 
</xsl:for-each-group> 

Description

The xsl:for-each-group element is an instruction that can be used anywhere within a sequence constructor. The sequence of items to be grouped is referred to as a population. A group cannot be empty. If the population is zero (that is, empty), the number of groups is zero. How items are assigned to groups is determined by the group-by, group-adjacent, group-starting-with, and group-ending-with attributes.

 
Free Stylus Studio XML Training: