saxon:capture

This attribute may be set on an xsl:accumulator-rule element. It has no effect unless the accumulator is declared streamable and the rule has phase="end". It is intended for use when the accumulator rule matches an element node. The value is a boolean with the default "no".

The effect of setting this attribute is that the code for computing the new accumulator value when the element end tag is encountered now has access to a snapshot copy of the matched element (as if taken using the fn:snapshot function), and is no longer required to be motionless.

This means that if you want access to the typed value or string value of an element, you can now get this directly with a rule that matches the element, rather than having to write rules that match the element's text node children.

It also opens up additional possibilities. For example:

Note: the snapshot captured as a result of the use of saxon:capture differs from the result of the fn:snapshot() function in that accumulator values associated with the copied nodes are not retained in the snapshot.