Understanding XPath

Although we already know, for example, that you can assign “.” to a select attribute to refer to the current node, “.” is not a valid match pattern; it’s an XPath abbreviation for self::node(). Match patterns are restricted to only two axes: child and attribute, but XPath has thirteen axes, including self. You’ll see all those axes in this chapter, as well as an example of each at work.

Formally speaking, XPath enables you to refer to specific sections of XML documents; it’s a language for addressing the various parts of such documents. XPath is what you use to indicate what part of a document you want to work with. W3C says of XPath:

“The primary purpose of XPath is to address parts of an XML document. In support of this ...

Get Inside 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.