Match Patterns (Locating Elements)
One critical capability of a stylesheet language is to locate source
elements to be styled. CSS, for example, does this with "selectors."
FOSIs do it with "e-i-c's", elements in context. XSLT does it
with "match patterns" defined by the XML Path Language (XPath) (http://www.w3.org/TR/xpath).
-
XPath has an extensible string-based syntax
-
It describes "location paths" between parts of
a document or documents
-
One inspiration for XPath was the common "path/file"
file system syntax
Two things to remember about XPath expressions:
-
Pattern matching occurs in a context; XPath expressions and
XSLT elements can change the current context and consequently the nodes which
match
-
XPath is inclusive or greedy, it addresses all
matching elements. You must use predicates to refine the set of
nodes selected.