Axes

XPath defines twelve axes along which an XPointer may search for nodes, all from the same XPath syntax used for XSLT. These depend on context to determine exactly what they point to. For instance, consider this location path:

id("p6")/child::NAME

It begins with the id() function that returns a node set containing the element with the ID type attribute whose value is p6. This provides a context node for the following location step along the relative child axis. Other axes include ancestor, descendant, self, ancestor-or-self, descendant-or-self, attribute, and more. Each serves to select a particular subset of the elements in the document. For instance, the following axis selects from nodes that come after the context node. The preceding axis selects from nodes that come before the context node.


Previous | Next | Top | Cafe con Leche

Copyright 1999, 2000 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified February 21, 2000