Deepx Xml Path Language Quick Reference

ADVERTISEMENT

HORIZONTAL AXIS
Examples:
/descendant::figure[position()=42] selects the forty-second figure
child::para selects the para element children of the context node
element in the document [//figure[position()=42]]
attribute
[para]
descendant-or-self
The attribute axis contains the attributes of the context node; the axis will
child::* selects all element children of the context node [*]
The descendant-or-self axis contains the context node and the
be empty unless the context node is an element.
child::text() selects all text node children of the context node
descendants of the context node.
Examples:
[text()]
Example:
attribute::name selects the name attribute of the context node
child::node() selects all the children of the context node, whatever
descendant-or-self::para selects the para element descendants of
[@name]
their node type
the context node and, if the context node is a para element, the
attribute::* selects all the attributes of the context node [@*]
child::chapter/descendant::para selects the para element
context node as well
descendants of the chapter element children of the context node
following
parent
[chapter//para]
The following axis contains all nodes in the same document as the
child::*/child::para selects all para grandchildren of the context
The parent axis contains the parent of the context node, if there is one.
context node that are after the context node in document order, excluding
node [*/para]
Example:
any descendants and excluding attribute nodes and namespace nodes.
child::para[position()=1] selects the first para child of the context
parent:: select the parent element [..]
following-sibling
node [para[position()=1]]
/ selects the document root (which is always the parent of the
child::para[position()=last()] selects the last para child of the
The following-sibling axis contains all the following siblings of the
document element) [//]
context node [para[position()=last()]]
context node; if the context node is an attribute node or namespace node,
self
child::para[position()=last()-1] selects the last but one para child of
the following-sibling axis is empty.
The self axis contains just the context node itself.
the context node [para[position()=last()-1]]
Example:
Example:
child::para[position()>1] selects all the para children of the context
following-sibling::chapter[position()=1] selects the next chapter
self::para selects the context node if it is a para element, and
node other than the first para child of the context node
sibling of the context node
otherwise selects nothing [.]
[para[position()>1]]
namespace
/child::doc/child::chapter[position()=5]/child::section[position()
NODE SET FUNCTIONS
The namespace axis contains the namespace nodes of the context node;
=2] selects the second section of the fifth chapter of the doc
the axis will be empty unless the context node is an element.
document element [/doc/chapter[5]/section[2]]
number count(node-set?)
§ 4.1
child::para[attribute::type="warning"] selects all para children
preceding
The count function returns the number of nodes in the argument node-
of the context node that have a type attribute with value warning
The preceding axis contains all nodes in the same document as the
set.
[para[@type="warning"]]
context node that are before the context node in document order,
node-set id(object)
§ 4.1
child::para[attribute::type='warning'][position()=5] selects the
excluding any ancestors and excluding attribute nodes and namespace
fifth para child of the context node that has a type attribute with
The id function selects elements by their unique ID.
nodes.
value warning [para[@type="warning"][5]]
number last()
§ 4.1
preceding-sibling
child::para[position()=5][attribute::type="warning"] selects the
The last function returns a number equal to the context size from the
fifth para child of the context node if that child has a type attribute
The preceding-sibling axis contains all the preceding siblings of the
expression evaluation context.
with value warning [para[5] [@type="warning"]]
context node; if the context node is an attribute node or namespace node,
child::chapter[child::title='Introduction'] selects the chapter
the preceding-sibling axis is empty.
string local-name(node-set?)
§ 4.1
children of the context node that have one or more title children with
Example:
The local-name function returns the local part of the expanded-name of
string-value equal to Introduction [chapter[title="Introduction"]]
preceding-sibling::chapter[position()=1] selects the previous
the node in the argument node-set that is first in document order.
child::chapter[child::title] selects the chapter children of the
chapter sibling of the context node
string name(node-set?)
§ 4.1
context node that have one or more title children [chapter[title]]
VERTICAL AXIS
child::*[self::chapter or self::appendix] selects the chapter and
The name function returns a string containing a QName representing the
appendix children of the context node [chapter|children]
expanded-name of the node in the argument node-set that is first in
ancestor
child::*[self::chapter or self::appendix][position()=last()] selects
document order.
The ancestor axis contains the ancestors of the context node; the
the last chapter or appendix child of the context node
string namespace-uri(node-set?)
§ 4.1
ancestors of the context node consist of the parent of context node and
[[chapter|appendix][position()=last()]]
the parent's parent and so on; thus, the ancestor axis will always include
The namespace-uri function returns the namespace URI of the expanded-
descendant
the root node, unless the context node is the root node.
name of the node in the argument node-set that is first in document
Example:
The descendant axis contains the descendants of the context node; a
order.
ancestor::div selects all div ancestors of the context node
descendant is a child or a child of a child and so on; thus the descendant
number position()
§ 4.1
axis never contains attribute or namespace nodes.
ancestor-or-self
The position function returns a number equal to the context position from
Example:
The ancestor-or-self axis contains the context node and the ancestors of
the expression evaluation context.
descendant::para selects the para element descendants of the
the context node; thus, the ancestor axis will always include the root
context node [.//para]
STRING FUNCTIONS
node.
/descendant::para selects all the para elements in the same
Example:
document as the context node [//para]
string concat(string, string, string*)
§ 4.2
ancestor-or-self::div selects the div ancestors of the context node
/descendant::olist/child::item selects all the item elements that
The concat function returns the concatenation of its arguments.
and, if the context node is a div element, the context node as well
have an olist parent and that are in the same document as the context
child
node [//olist/item]
The child axis contains the children of the context node.

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2