Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Many of these operators behave in a way that is likely to be familiar from other languages, though there are differences because of the different data model, in particular, the fact that everything in XPath is a sequence.
The next chapter describes the most distinctive feature of the XPath language, namely path expressions. Unlike the operators in this chapter, these are quite unique to XPath.
Looking further ahead, Chapter 10 is devoted to operations used to process sequences. The tour of the language syntax finishes in Chapter 11, which describes operations on types. Chapter 12 returns specifically to XSLT with a description of match patterns, which use a subset of the XPath syntax. The standard functions available in XPath and XSLT are described in Chapter 13.
Chapter 9
XPath: Path Expressions
This chapter defines the syntax and meaning of
path expressions
. Path expressions are the most distinctive feature of the XPath language, the construct that gives the language its name. The chapter also describes other constructs in the language that are closely associated with path expressions, in particular
steps
and
axes
and the
union
,
intersect
, and
except
operators.
Path expressions are used to select nodes in a tree, by means of a series of steps. Each step takes as its starting point a node, and from this starting point, selects other nodes.
Each step is defined in terms of:
Because they are closely associated with processing the results of path expressions, this chapter also describes the operators used to combine two sets of nodes by taking their union, intersection, or difference.
Although I've chosen
Path Expressions
as the title for this chapter, the term is actually a slippery one. Because of the way W3 C defines the XPath grammar, all sorts of unlikely constructs such as
2
or
count($x)
are technically path expressions. The things I will actually cover in this chapter are: