Hi Hari,
In page 16, of XML certification success part2, question 2:
<!-- books.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book id="BK1">
<name>Understanding XML</name>
<Author>Whizlabs</Author>
<price>50</price>
</book>
<book id="BK2">
<name>Understanding
Java</name>
<Author>Whizlabs</Author>
<price>40</price>
</book>
<book id="BK3">
<name>XML Certification Made Easy</name>
<Author>Whizlabs</Author>
<price>75</price>
</book>
</books>
Which of the following XPath expressions will select the price element in
the third book element?
A. //book[position() = last()]/price
B. //book[@id ='BK3']/price
C. //book[position() = 3]/price
D. /books/book[position() = 3]/price
E. //price[position = last()]
F. //book/price[position = 3]
All are correct choices according to the article.
But I feel E and F are not.
Reason there is nothing called 'position', it should be 'position()'.
I tried the same on XML spy, it does not yield the correct result even with position().
//price[position() = last()], gives me all 3 prices
//book/price[position() = 3], no result was yielded.
Please correct me if I am wrong.