A given node matches a given pattern if:
- the node is member of the result of evaluating the pattern with respect to some context.
Operationally (and intuitively), a pattern matching is probably best evaluated backwards (from right to left).
Recall the structure of XPath node-set expressions:
| pattern: | location path | ... | location path | |
| location path: | /step/ ... // ... /step | |
| step: | axis nodetest predicate |
- a pattern is a set of XPath location paths separated by | (union)
- restrictions: only the child (default) and attribute (@) axes are allowed here
- extensions: the location paths may start with id(..) or key(..)
A simple example is:
match="section/subsection | appendix//subsection" |
which matches subsection elements occurring either as child elements of section elements or as descendants of appendix elements.
These figures illustrate the pattern matching mechanism.
discuss this topic to forum
