XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (303 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
7.37Mb size Format: txt, pdf, ePub

For a more complete explanation of this distinction, see the sections on
Axis Steps
in Chapter 9 and
Filter Expressions
in Chapter 10.

Another rather specialized use for parentheses is to remove syntactic ambiguities when using the
/
symbol as an expression referring to the document node at the root of the current tree. When
/
is followed by a name, or by the symbol
*
, then it is assumed to be the start of a rooted path expression. This means that if you want to follow
/
with a named operator, you need to enclose it in parentheses, for example:

if ((/) instance of document(schema-element(mf:invoice))) then …

or

if ((/) intersect $nodes) then …

Another way of disambiguating
/
in such expressions is to write it as
/.
.

Changes in XPath 2.0

The syntax
()
to represent an empty sequence, and the use of the
,
operator to perform sequence concatenation, are new in XPath 2.0.

Other books

Atticus Claw Lends a Paw by Jennifer Gray
La condesa sangrienta by Alejandra Pizarnik, Santiago Caruso
What We Keep by Elizabeth Berg
Murderous Lies by Rhondeau, Chantel
The Iron Khan by Williams, Liz, Halpern, Marty, Pillar, Amanda, Notley, Reece
Take Me Under by Rhyannon Byrd
The Continental Risque by James Nelson