I might be doing wrong, but for now I have the strong impression that \xmlchainatt is at fault. It does not break the callchain as soon as a match is found.
Also according the manual xml-mkiv, \xmlchainatt{#1}{testx}{no-test} should return "no-test" but returns nothing. I would very much helped if these macros react is I thin they should.
Is this my fault?

Hans van der Meer

Minimal example

% test chainttribute failure.
\startxmlsetups demo:chainatt
        \xmlsetsetup{#1}{root|node|innernode}{demo:chainatt:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:chainatt}
\startxmlsetups demo:chainatt:root
        root: xmlatt <test> = <\xmlatt{#1}{test}>\crlf
        root: xmlchainatt <test> = <\xmlchainatt{#1}{test}>\crlf
        \xmlall{#1}{*}
\stopxmlsetups
\startxmlsetups demo:chainatt:node
        -- node: xmlatt test = <\xmlatt{#1}{test}>\crlf
        -- node: xmlchainatt <node> = \xmlchainatt{#1}{test}\crlf
        -- node: xmlchainattdef <node> = \xmlchainattdef{#1}{notest}{no-test}\crlf

\stopxmlsetups
\startxmlsetups demo:chainatt:innernode
        ---- innernode: xmlatt test = <\xmlattdef{#1}{test}{nono}>\crlf
        ---- innernode: xmlchainatt <test> = \xmlchainatt{#1}{test}\crlf
\stopxmlsetups
\startbuffer[chainatt]
<root test="abc">
  <node test="pqr">
    <innernode test="xyz"/>
  </node>
</root>
\stopbuffer
\starttext
\ConTeXt-version=\contextversion\blank
Manual on xml-mkiv page 22 on \tex{xmlchainatt} reads:
returns the value of attribute NAME or empty if no such attribute exists; backtracks till a match is found\blank
\xmlprocessbuffer{demo}{chainatt}{}\blank
However, does not stop when backtracking finds "a match".
\stoptext