to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

Predicates

- expressions coerced to type boolean

A predicate filters a node-set by evaluating the predicate expression on each node in the set with

Example:

  child::section[position()<6] / descendant::cite[attribute::href="there"]

selects all cite elements with href="there" attributes in the first 5 sections of an article document.

(Compare with the earlier example.)

The XPath predicate language is very large, but these are the essential ones to know

An entire location path may be used as a predicate

This is very useful to look ahead:

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next