Enclosing modes
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.