Examples of XSLT 2.0 patterns
The table below gives some examples of patterns, and explains their meaning:
Pattern |
Meaning |
|
Matches any element whose name (tag) is |
|
Matches any element |
|
Matches any |
|
Matches any |
|
Matches any |
|
Matches any element with a |
|
Matches any |
|
Matches any |
|
Matches any |
|
Matches any element in a document provided the top-level element in the
document is named |
|
Matches the character content of an |
|
Matches any attribute of an |
In a schema-aware stylesheet, it can be useful to match elements by their schema-defined type, rather than by their name. The following table shows some examples of this.
Pattern |
Meaning |
|
Matches any element that has been validated against the global element
declaration named |
|
Matches any element that has been validated against the schema-defined
global type definition |
|
Matches any attribute that has been validated as an instance of
|
XSLT 3.0 introduces a new option on an xsl:mode
declaration,
typed="strict"
or typed="lax"
, which enables simple
name patterns such as match="invoice"
to be treated as if they were
written match="schema-element(invoice)"
. This enables the processor to
perform stricter type-checking, by checking the content of the template rule against
the schema definitions for the invoice
element.