CSCIE-259 - Project 2 (version 8.0)
Author: Fernando Paulo
Question 3)
i)
/descendant-or-self::node()[starts-with(name/last,'B')]
ii)
/students/student[starts-with(name/last,'B') and GPA>=3.7]
Question 4)
i)
2 nodes
ii)
5 nodes
iii)
/students/student[@id='55']/name/preceding::*[4]
iv)
following::* will return 1 node.
following::node() will return 5 nodes.
The difference is that * matches any node of the principal node type, which must be an element when the axis is neither an attribute nor a namespace.
On the other hand, node() matches any node of any type, which includes text nodes. In this case I'm assuming whitespaces are NOT being ignored (if they were, the number of nodes returned would be 2).
v)
/students//name[last='Bond']/../@id