Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Usage
The pattern
/
matches any document node. This means that if you have several trees (which will be the case in a stylesheet that uses the
document()
or
doc()
functions described in Chapter 13), the pattern
/
will match the document nodes of each one. This makes it difficult to write different template rules to match the document nodes of different trees. There are a few ways around this problem:
The pattern
/@width
is legal but meaningless; it would match a
width
attribute of the document node, but as the document node cannot have attributes, there is no such node.
To match every
para
in preference to
//para
The latter will work (except in non-document trees), but its default priority is different, and it may be less efficient. For the other kinds of
PathPattern
, see
RelativePathPattern
(on this page) and
IdKeyPattern
(page 704) discussed later.