
Axes
There are thirteen different axes in the XPath specification. An axis represents a relationship to the context node, and is used to locate nodes relative to that node on the tree. The following is an extremely brief description of the thirteen available axes and the degree of support available in Netscape. For further information on using XPath expressions, please see the For Further Reading section at the end of this document.
The ancestor axis indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node.
The ancestor-or-self axis indicates the context node and all of its ancestors, including the root node.
The attribute axis indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (@).
The child axis indicates the children of the context node. If an XPath expression does not specify an axis, the child axis is understood by default. Since only the root node or element nodes have children, any other use will select nothing.
The descendant axis indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents.
The descendant-or-self axis indicates the context node and all of its descendants.Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents.
The following axis indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes.
The following-sibling axis indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.
The namespace axis indicates all the nodes that are in scope for the context node. In this case, the context node must be an element node.
The parent axis indicates the single node that is the parent of the context node. It can be abbreviated as two periods (..).
The preceding axis indicates all the nodes that precede the context node in the document except any ancestor, attribute, and namespace nodes.
The preceding-sibling axis indicates all the nodes that have the same parent as the context node and appear before the context node in the source document.
The self axis indicates the context node itself. It can be abbreviated as a single period (.).
|
Comments?
devdoc-feedback@netscape.com |