This one took the better part of an afternoon from me, but I finally found the (unexpected) culprit.
In the xml documentation on page 31 it is said:
 The given expression between [] is converted to a LUA expression so you can use the use operators: == ~= <= >= < > not and or ()
In addition, = equals == and != is the same as ~=.

This is not true as the following demonstrates. The use of != is as expected but the ~= leads to an error and this should not be:

xml> lpath > error in expression: number(@atta) ~= 1 => expr.number((ll.at and ll.at['atta'])) ~== 1


Hans van der Meer


% failure of test on inequality.
\startxmlsetups demo:comparefail
\xmlsetsetup{#1}{root|node}{demo:comparefail:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:comparefail}
\startxmlsetups demo:comparefail:root
compare \type{!=}\crlf
\xmlfilter{#1}{/[number(@atta) != 1]/command(demo:comparefail:node)}
compare \type{~=}\crlf
\xmlfilter{#1}{/[number(@atta) ~= 1]/command(demo:comparefail:node)}
\stopxmlsetups
\startxmlsetups demo:comparefail:node
node: attribute atta = \xmlatt{#1}{atta}\crlf
\stopxmlsetups
\startbuffer[comparefail]
<root>
<node atta="2"/>
<node atta="1"/>
</root>
\stopbuffer
\starttext
\xmlprocessbuffer{demo}{comparefail}{}
Note the absence of output in the second \tex{xmlfilter}.
\stoptext