![]() |
NOTE:
These slides have not been updated since 2003. They have been superseded by the book
Anders Møller and Michael Schwartzbach, February 2006 |
![]() ![]() ![]() | THE XML REVOLUTION - TECHNOLOGIES FOR THE FUTURE WEB |
![]() ![]() ![]() |
The central construct is the location path, which is a sequence of location steps separated by /, e.g.:
child::section[position()<6] / descendant::cite / attribute::href |
selects all href attributes in cite elements in the first 5 sections of an article document.
A context consists of:
Initial context: defined externally (e.g. by XPointer, XSLT, or XQuery).
Location paths can be prefixed with / to use the document root
as initial context node!
Note: in the XPath data model, the XML document tree has a special root node above the root element.
There is a strong analogy to directory paths (in UNIX). As an example, the directory path /*/d/*.txt selects a set of files, and the location path /*/d/*[@ext="txt"] select a set of XML elements.
![]() | COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH |
![]() |