XPath - Axes and Node Set Functions

admin's picture
 
 
Axes Node Set Functions
child
 
 
axis contains the children of the context node
last()
returns a number equal to the context size from the expression evaluation context
descendant
axis contains the descendants of the context node; a descendant is a child or a child of a child and so on
position()
function returns a number equal to the context position from the expression evaluation context
parent
axis contains the parent of the context node
count(node-set)
returns the number of nodes in the argument node-set
ancestor
axis contains the ancestors of the context node; the ancestors of the context node consist of the parent of context node and the parent's parent and so on
node-set id(object)
selects elements by their unique ID
following-sibling
axis contains all the following siblings of the context node
string local-name(node-set?)
 
returns the local part of the expanded-name of the node in the argument node-set that is first in document order
preceding-sibling
axis contains all the preceding siblings of the context node
string namespace-uri(node-set?)
 
returns the namespace URI of the expanded-name of the node in the argument node-set that is first indocument order
following
axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes
string name(node-set?)
returns a string containing a QName representing the expanded-name of the node in the argument node-set that is first in document order
preceding
axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and namespace nodes
 
attribute
axis contains the attributes of the context node; the axis will be empty unless the context node is an element
 
namespace
axis contains the namespace nodes of the context node; the axis will be empty unless the context node is an element
 
self
axis contains just the context node itself
 
descendant-or-self
axis contains the context node and the descendants of the context node
 
ancestor-or-self
axis contains the context node and the ancestors of the context node; thus, the ancestor axis will always include the root node