xsl:mode
Allows properties of a mode to be defined.
Category: declaration
Content: (
xsl:template*
)
Permitted parent elements:
xsl:package
; xsl:stylesheet
; xsl:transform
Attributes
|
| Identifies the name of this mode; if omitted, the element describes the properties of the unnamed mode. |
|
| New in XSLT 4.0. Declares the return type of all template rules in the mode. |
|
| The value |
|
| Relevant only when this mode is the initial mode of the transformation. Defines the set of accumulators that are applicable to documents containing nodes in the initial match selection. Available since Saxon 9.7.0.10. |
|
| Indicates what action is taken when a
node being processed by
|
|
| Indicates what action is taken
when a node being processed by |
|
| The value |
|
| The value
|
|
| Informs the processor whether the nodes to be
processed by template rules in this mode are to be typed or untyped. The default
is |
|
| New in XSLT 4.0. If
|
|
| Determines the potential visibility of
the component corresponding to this mode; the default is
|
|
| Causes tracing of
all template rules executed in the mode, showing the nodes selected by
|
Saxon availability
Available in XSLT 3.0 and later versions. From Saxon 9.8, available in all editions. Implemented in Saxon-PE and Saxon-EE since Saxon 9.6. Available for all platforms.
Details
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.
The element always appears as a child of xsl:stylesheet (or
xsl:transform) or xsl:package, and in XSLT 3.0 it is
empty (has no children).
In XSLT 4.0, an xsl:mode declaration for a named mode can
contain template rules within the body of the xsl:mode
declaration. This is known as an enclosing mode. Template rules
within the enclosing mode cannot have a mode attribute (they
automatically belong to the enclosing mode), and any
xsl:apply-templates instructions within these template
rules default their mode attribute to the enclosing mode.
Template rules within an enclosing mode cannot be overridden by template
rules outside it (in fact, template rules outside the enclosing mode cannot
name that mode in their mode attribute). Specifying
mode="#all" on a template rule has no effect on enclosing
modes.
The purpose of enclosing modes is to make it easier to see at a glance what all the rules for a mode are, and thus to make it easier to work out which rules will match which nodes in an input document.
Template rules in an enclosing mode can in principle be overridden in another
stylesheet package (using xsl:override) but this has not yet
been tested.
The changes in XSLT 4.0 for the typed attribute, to handle items
other than XNodes, are not yet implemented in Saxon.