to the main page... about these slides...

XPath: Location paths

XPath is a declarative language for addressing (used in XPointer) and pattern matching (used in XSLT).

The central construct is the location path, which is a sequence of location steps separated by /.

A context consists of: Initial context: defined externally (e.g. by XPointer or XSLT).

(Location paths starting with / always use the document root as initial context node!)


Example:

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

selects all href attributes in cite elements in the first 5 sections of an article.