Issue
I'm going through the W3Schools tutorial for XPath and there's a line that I find confusing. It says that the predicate query /bookstore/book[last()-1]
:
Selects the last but one book element that is the child of the bookstore element
I'm confused why they would word it this way. Doesn't this mean it selects the second to last child book element of the bookstore element in all situations? Thanks.
Solution
I'm confused why they would word it this way.
Because they assumed everyone would recognise the phrase "last but one" (meaning penultimate) and weren't aware that it would be unfamiliar to some of their readers.
Answered By - Michael Kay
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.