>> English << | česky | Nederlands | Français | Español | По-русски | Deutsch | 中文 | Italiano | Polski

Example 1
The basic XPath syntax is similar to filesystem addressing. If the path starts with the slash / , then it represents an absolute path to the required element.
Example 2
If the path starts with // then all elements in the document which fulfill following criteria are selected.
Example 3
The star * selects all elements located by preceeding path
Example 4
Expresion in square brackets can further specify an element. A number in the brackets gives the position of the element in the selected set. The function last() selects the last element in the selection.
Example 5
Attributes are specified by @ prefix.
Example 6
Values of attributes can be used as selection criteria. Function normalize-space removes leading and trailing spaces and replaces sequences of whitespace characters by a single space.
Example 7
Function count() counts the number of selected elements
Example 8
Function name() returns name of the element, the starts-with function returns true if the first argument string starts with the second argument string, and the contains function returns true if the first argument string contains the second argument string.
Example 9
The string-length function returns the number of characters in the string. You must use &lt; as a substitute for < and &gt; as a substitute for > .
Example 10
Several paths can be combined with | separator.
Example 11
The child axis contains the children of the context node. The child axis is the default axis and it can be omitted.
Example 12
The descendant axis contains the descendants of the context node; a descendant is a child or a child of a child and so on; thus the descendant axis never contains attribute or namespace nodes
Example 13
The parent axis contains the parent of the context node, if there is one.
Example 14
The 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; thus, the ancestor axis will always include the root node, unless the context node is the root node.
Example 15
The following-sibling axis contains all the following siblings of the context node.
Example 16
The preceding-sibling axis contains all the preceding siblings of the context node
Example 17
The 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.
Example 18
The 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
Example 19
The descendant-or-self axis contains the context node and the descendants of the context node
Example 20
The ancestor-or-self axis contains the context node and the ancestors of the context node; thus, the ancestor-or-self axis will always include the root node.
Example 21
The ancestor, descendant, following, preceding and self axes partition a document (ignoring attribute and namespace nodes): they do not overlap and together they contain all the nodes in the document.
Example 22
The div operator performs floating-point division, the mod operator returns the remainder from a truncating division. The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.