I tested some rather weird queries with the eXist demo server and found
that the treatment of the attribute kind test does not correspond to the
For the following queries I used document doc('/db/library/biblio.rdf')
and defined the rdf namespace.
results in the content of the 57 id attributes - ok.
The same with
/rdf:RDF/rdf:Description/attribute(id) - ok
returns the attributes as well
returns correctly the empty sequence.
In general all XPath expressions with an attribute kind test and an axis
which is or is derived from child axis (descendant, descendant-or-self,
following-sibling, preceding-sibling) must return an empty sequence.
Only in case the context already contains attribute nodes and we have
descendant-or-self axis the current attribute nodes might be returned
(if name matches).
Looking only at the examples it seems to me that the error is simply
that eXist ignores the axis specifier if an attribute test is given.