The comment()
node test specifically refers to comments.
For example, this XPointer points to the third comment in the document:
/descendant::comment()[position()=3]
Because comments do not contain attributes or elements, you cannot add an
additional child
, descendant
, or
attribute
relative location step after the first term that selects
a comment.You can use a string
relative location axis
to select part of the text of the comment, though.