Grouping using break-when

The break-when attribute can be specified on xsl:for-each-group in place of group-by, group-adjacent, group-starting-with, or group-ending-with. This allows a new group to be started conditionally based on the contents of the current group so far. For example, break-when="@date lt $group[last()]/@date causes a new group to be started whenever the date on the current item is earlier than the date on the last item in the previous group.

For more details see xsl:for-each-group.