Location Paths

Location paths, as the name suggests, specify a pathway, or series of steps, that can be followed to reach a point in the document tree. The location path is usually stated in terms of an agreed upon starting point, called a context.

In the examples that follow, diagrams illustrate the part of the tree being selected by each location path. A large arrow marks the initial context node, and dashed arrows show the path from that point to the selected node, which will be in a highlighted box.

Location Path Syntax

XPath’s location path syntax is in many ways similar to the syntax of filesystem paths:

/usr/pkg/bin/bash 

or:

\windows\win.com 

These just consist of a list of names separate by slashes (the kind of slash used depends ...

Get Special Edition Using XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.