An axis in XPath is similar to an axis in a traditional two or three dimensional chart or graph. It tells the XPath-aware processor which direction to look, up, down, or sideways in a document tree, starting from a given point of originthe context node. Using an axis as part of a location step is:
axisname::nodetest
Where axisname is one of the built-in axes defined by the XPath specification, selected from the list below, and nodetest indicates which node(s) along that axis are of interest. For example:
child::*
indicates to select all children of the context node, while
/child::*
is to select all children of the root node, which is made the context node by virtue of the opening slash.
Using an axis in an XPath expression extends your options in navigating through the document tree. A traditional unidirectional path, such as to a file on a Web server, is similar to the following:
/rootfolder/subfolder/subsubfolder
unlike this sort of path or a traditional charting application with its X, Y, and Z axes, XPath provides you with a rich variety of axes. Each XPath axis consist of a tree-like structure to the context node.
For more information, see Use XPath Axes to Navigate through XML Data.