Skip to content

xsl:accumulator-rule⚓︎

Defines a rule for an xsl:accumulator.

Available in XSLT 3.0. From Saxon 9.8, available in all editions. Implemented in Saxon-PE and Saxon-EE since Saxon 9.6.

Attributes⚓︎

match
pattern
Pattern defining the set of nodes to which the accumulator rule applies.
phase?
"start" | "end"
Determines whether the rule fires before or after descendants are processed, by specifying phase="start" (the default) or phase="end" respectively.
select?
expression
The expression to be evaluated by the rule may be given either by a select attribute, or by an enclosed sequence constructor.
saxon:capture?
boolean
The value "yes|true|1" on a phase="end" rule for a streaming accumulator removes the requirement for the select attribute (or sequence constructor) to be motionless. Instead the expression has access to a snapshot of the streamed node (in the sense of the fn:snapshot function). For example, writing select="($value, .)" ensures that the value of the accumulator contains a sequence of snapshot copies of all the element nodes matched by the accumulator rule. For details see saxon:capture.

Examples⚓︎

For an example of the use of a capturing accumulator rule to construct the glossary of a document, see the blog article Capturing Accumulators.

See also⚓︎

Comments