I have been working on an XPath parser, with the grammars here as a reference. I was surpised that an @
symbol with a KindTest
is possible. The KindTest
can be node()
, comment()
, text()
, or processing-instruction(xyz)
(they test for the Node Type).
My question is what these do when combined with an @
sign; . What do @processing-instruction("xyz")
, @comment()
, @node
, and @text
do? Are they searching for attributes with processing instructions or comments in them?
@comment()
is a valid XPath location path step expression that is guaranteed to return nothing. Technically it is asking for all comment nodes found along the attribute axis (and you will never find any).
I tell my students that /..
is a more compact and readable way of writing a complete location path that is guaranteed to return nothing. Technically it is asking for the parent of the root node.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With