to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

Patterns

Patterns are simple XPath expressions evaluating to node-sets.

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

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next