 |
|
THE XML REVOLUTION - TECHNOLOGIES FOR THE FUTURE WEB
|
|
XPath: Location paths
XPath is a declarative language for:
- addressing (used in XLink/XPointer and in XSLT)
- pattern matching (used in XSLT and in XQuery)
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 location step is evaluated wrt. some context resulting
in a set of nodes
- a location path is evaluated compositionally,
left-to-right, starting with some initial context
-
location paths resemble operating system directory paths
- each node resulting from evaluation of one step is used as context
for evaluation of the next, and the results are unioned together
A context consists of:
- a context node
- a context position and size (two integers)
- variable bindings, a function library, and a set of
namespace declarations
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
|
|
| | Copyright© 1998-2004 All Rights Reserved. No portion of this site may be reproduced or redistributed without prior written permission from VistaEdge Technologies
All registered trademarks appearing on this site are the property of their respective owners. Java is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries. This site is not connected to Sun Microsystems, Inc. and is not sponsored by Sun Microsystems, Inc. | |
|  |