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

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

It's important to remember that this implicit testing of
position()
happens only when the predicate expression actually evaluates to a single number. For example,
$paras[1 or last()]
does not mean
$paras[position() = 1 or position() = last()]
, because the result of evaluating
1 or last()
is a boolean, not a number (and as it happens, it will always be true). Similarly,
book[../@book-nr]
does not mean
book[position() = ../@book-nr]
, because the result of
../@book-nr
is a node, not a number.

A neat way to force the node to be atomized in such cases is to use the unary
+
operator: write
book[+../@book-nr]
.

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

Other books

Gang of Lovers by Massimo Carlotto, Antony Shugaar
Cappuccino Twist by Anisa Claire West
Romance: Luther's Property by Laurie Burrows
Bantam of the Opera by Mary Daheim
A Very Selwick Christmas by Lauren Willig
Between Friends by Kiernan, Kristy
Hogs #4:Snake Eaters by DeFelice, Jim