XML information pipe

Ihre Spezialisten für XML

Banner Werbung

List of XPaths

Contents 20 - 23


Ancestor-or-self axis

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.

/AAA/XXX/DDD/EEE/ancestor-or-self::*
//GGG/ancestor-or-self::*

XPath 1.0 introduction

Orthogonal axes

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.

//GGG/ancestor::*
//GGG/descendant::*
//GGG/following::*
//GGG/preceding::*
//GGG/self::*
//GGG/ancestor::* | //GGG/descendant::* |
//GGG/following::* | //GGG/preceding::* |
//GGG/self::*

XPath 1.0 introduction

Numeric operations

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.

//BBB[position() mod 2 = 0 ]
//BBB[ position() = floor(last() div 2 + 0.5) or
position() = ceiling(last() div 2 + 0.5) ]
//CCC[ position() = floor(last() div 2 + 0.5) or
position() = ceiling(last() div 2 + 0.5) ]

XPath 1.0 introduction