XML technologies / XSLT / XSLT 3.0 / XSLT streaming / First steps with XSLT streaming / xsl:mode on-no-match
The attribute on-no-match of the xsl:mode element determines how to handle elements for which no explicit XSLT-template has been defined. Six values are available for this attribute:
text-only-copyThis is the default mode, used when the attribute
on-no-matchis not specified. For every node without a template, its content and subtree are copied to the output as text, discarding markup. Descendant nodes are also output as text unless explicit templates are defined for them.shallow-copyElements without a template are copied unchanged to the output. Templates are applied to child elements when available; otherwise those elements are also copied unchanged.
shallow-skipElements without a matching template are discarded rather than copied to the output. Child elements with defined templates are nevertheless processed and included in the output accordingly.
deep-copyIf no template is defined for a node, the entire node and its subtree are copied unchanged to the output. Templates for descendant elements are ignored.
deep-skipIf no template is defined for a node, the entire node and its subtree are ignored and omitted from the output. Any templates for descendant elements are ignored.
failA template must be defined for every element; otherwise an element-specific error is raised.
Exercises on xsl:mode on-no-match
The following exercises demonstrate different values for on-no-match.
xsl:mode on-no-match="fail" (Exercise 1)
xsl:mode on-no-match="shallow-copy" (Exercise 2)
xsl:mode on-no-match="shallow-skip" (Exercise 3)