saxon:do instruction is designed for use when invoking
XPath expressions that have side-effects. Any result of the expression is discarded.
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element
The expression to be evaluated (typically an expression with side-effects).
Requires Saxon-PE or Saxon-EE. Implemented since Saxon 9.9. Available for all platforms.
The instruction is designed for use when invoking
XPath expressions that have side-effects. For example,
calls the function
saxon:discard-document(). Any result of the expression is discarded. The instruction is useful
in preference to
xsl:sequence firstly because the result of the expression is discarded, and secondly
because it is recognized by the optimizer as signaling an expression that is being evaluated for its side-effects.
The optimizer will attempt to avoid aggressive optimizations such as lifting the instruction
out of an
xsl:for-each loop. Note however that this does not propagate; just
because a function
saxon:do, for example, does not prevent calls on
F being moved
out of a loop.