xsl:mode
The xsl:mode
declaration is new in XSLT 3.0. Previously, modes were declared implicitly
by referring to them in the mode
attribute of xsl:template
or xsl:apply-templates
.
XSLT 3.0 introduces an xsl:mode
declaration to allow properties of the mode to be defined.
The element always appears as a child of xsl:stylesheet
(or xsl:transform
),
and it is empty (has no children).
The name
attribute identifies the name of this mode; if omitted, the element describes the properties
of the unnamed mode.
The attribute streamable="yes"
indicates that template rules using this mode must be capable
of being evaluated in a streaming manner. This imposes restrictions on the content of the template rules.
For details, see Streaming of Large Documents. This option is available
in Saxon-EE only.
The attribute on-multiple-match
indicates what action is taken when a node being processed
by xsl:apply-templates
in this mode matches more than one template rule (with the same precedence and priority). The values are
fail
indicating that a dynamic error is reported, or use-last
indicating
that the template rule appearing last in document order is chosen.
The attribute on-no-match
indicates what action is taken when a node being processed
by xsl:apply-templates
in this mode matches no template rule. The default value is
text-only-copy
. The permitted values are:
-
text-only-copy: the XSLT 2.0 behaviour (for elements: apply-templates to the children; for text nodes: copy the text node to the output)
-
shallow-copy: invoke the "identity template", which copies an element node and does apply-templates to its children
-
deep-copy: invoke
xsl:copy-of
-
shallow-skip: ignores this node, does apply-templates to its children
-
deep-skip: ignores this node and all its descendants
-
fail: reports a dynamic error
The attribute warning-on-multiple-match="yes"
causes a run-time warning when a node is matched
by multiple template rules.
The attribute warning-on-no-match="yes"
causes a run-time warning when a node is matched
by no template rules.