current-group


current- group

The current-group () function returns the set of items making up the group that is currently being processed using the <xsl:for-each-group> instruction.

Changes in 2.0

This function is new in XSLT 2.0.

Signature

There are no arguments.

 

Data type

Meaning

Result

item()*

A sequence of items, specifically the sequence that is being processed in the current iteration of an <xsl:for-each-group> instruction.

Effect

When the stylesheet starts executing, there is no current group; the current-group() function then returns an empty sequence.

The <xsl:for-each-group> instruction, described in Chapter 5, page 281, takes as input a sequence of items (called the population) and a grouping expression or pattern. It allocates each item in the population to zero or more groups of items, and then processes each group in turn . While it is processing each group, the current-group() function returns the sequence of items that participate in that group.

The current-group() function does not need to be called textually within the <xsl:for-each-group> instruction. Its scope is dynamic, and the current group remains available in called templates unless another nested <xsl:for-each-group> instruction is evaluated. On completion of an <xsl:for-each-group> instruction, it reverts to its previous value.

The current-group() function can also be called while evaluating the sort key in an <xsl:sort> element contained within the <xsl:for-each-group> instruction. This affects the order in which groups are processed. In this context, current-group() refers to the group whose sort key is being calculated. For example, to sort groups in order of decreasing size , write <xsl:sort select= "count (current-group())" order="descending"/> .

On entry to a stylesheet function, the current group is an empty sequence.

Usage and Examples

See <xsl:for-each-group> on page 281 in Chapter 5.

See Also

  • <xsl:for-each-group> on page 281 in Chapter 5.

  • current-grouping-key () -the next entry in this chapter.




XSLT 2.0 Programmer's Reference
NetBeansв„ў IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications (2nd Edition)
ISBN: 764569090
EAN: 2147483647
Year: 2003
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net