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:




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

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.