Axis

Contact Us or call 1-877-932-8228
Axis

Axis

axis::node_test[predicate]

An axis indicates the relationship between the selected node and the context node. Below is a reference table of the available axes.

Axis Description
child children of the context node
descendant descendants of the context node
parent parent of the context node
ancestor ancestors of the context node
following-sibling all siblings that follow the context node
preceding-sibling all siblings that precede the context node
following all nodes that follow the context node
preceding all nodes that precede the context node
attribute attributes of the context node
namespace namespace nodes of the context node
self the context node
descendant-or-self the context node and all its descendants
ancestor-or-self the context node and all its ancestors

Some location paths using just the axis and the node test are shown below.

XPath: Children, Parents and Attributes
Example Description
child::FirstName Indicates the FirstName element children of the context node.
child::* Indicates all element children of the context node.
child::text() Indicates all text node children of the context node.
child::node() Indicates all the children of the context node, whatever their node type. Note that attributes are not considered children of elements.
parent::node() Indicates the parent of the context node regardless of type.
parent::* Indicates the parent of the context node if that parent is an element (the only other possibility is that the parent is the document root).
parent::Topic Indicates the parent of the context node if that parent is an element named "Topic".
attribute::href Indicates the href attribute of the context node.
attribute::* Indicates all the attributes of the context node.
XPath: Ancestors and Descendants
Example Description
descendant::FirstName Indicates the FirstName element descendants of the context node.
ancestor::Topics Indicates all Topics ancestors of the context node.
ancestor-or-self::div Indicates the div ancestors of the context node and, if the context node is a div element, the context node as well.
descendant-or-self::List Indicates the List element descendents of the context node, and if the context node is a List element, the context node as well.
Next