O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

[2.0] <xsl:for-each-group>

Takes the items in a sequence and puts them into groups. There are four different ways of defining groups, each of which are explained in detail below. The grouping is done based on a common value or by a pattern that the first or last item in the group must match. Be aware that it is possible for an item in the original sequence to be put into more than one group.

Category

Instruction.

Required Attribute

select

An XPath expression that determines the items to be grouped.

Optional Attributes

group-by

Defines a common value that all items in a group must share. For example, group-by="state" creates a group for each unique value of the <state> element. All items in a given group will have the same value for <state>.

group-adjacent

Defines an expression that is evaluated for every item in the sequence. If the value of that expression for the current item is the same as the value of that expression for the previous item, then the current item is put into the same group as the previous item. If not, the current item becomes the first item in a new group.

group-starting-with

Defines a pattern that indicates the start of a new group. When an item matching that pattern is found, a new group is started, and all subsequent items are put into the same group until another item that matches the pattern is found.

group-ending-with

Defines a pattern that indicates the end of the current group. When an item matching that pattern is found, the current group is closed. The next item ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required