What XPath can I use to select any category with a name attribute specified and any child node author with the value specified.
I\'ve tried different variations of t
Use:
/category[@name='Sport' and author/text()[1]='James Small']
or use:
/category[@name='Sport' and author[starts-with(.,'James Small')]]
It is a good rule to try to avoid using the // pseudo-operator whenever possible, because its evaluation can typically be very slow.
Also:
./somename
is equivalent to:
somename
so it is recommended to use the latter.