Validating xpath

Rated 4.5/5 based on 767 customer reviews

More complex expressions can be constructed by specifying an axis other than the default 'child' axis, a node test other than a simple name, or predicates, which can be written in square brackets after any step. Note also, index values in XPath predicates (technically, 'proximity positions' of XPath node sets) start from 1, not 0 as common in languages like C and Java.

In the full, unabbreviated syntax, the two examples above would be written .

The reference to an attribute of the top-level element in the first predicate affects neither the context of other predicates nor that of the location step itself.

Supports HTML5, SVG 1.1, Math ML 3.0, ITS 2.0, RDFa Lite 1.1.

selects items whose price attribute is greater than twice the numeric value of their discount attribute.

Entire node-sets can be combined ('unioned') using the vertical bar character |.

There is no limit to the number of predicates in a step, and they need not be confined to the last step in an XPath. Paths specified in predicates begin at the context of the current step (i.e.

that of the immediately preceding node test) and do not alter that context.

Leave a Reply