\startbuffer[test]
<something>
    <what a="1"></what>
    <what a="2"/>
    <one/>
    <two/>
    <two/>
    <two/>
</something>
\stopbuffer

\startxmlsetups xml:mysetups
    \xmlsetsetup{#1}{something|what|two}{xml:*}
    \xmlsetsetup{#1}{something/two[position() == last()]}{xml:last}
    \xmlsetsetup{#1}{one[name(1) == 'two']}{xml:test}
%     \xmlsetsetup{#1}{one/following-sibling::two[position()==1]}{xml:test}
\stopxmlsetups


\xmlregistersetup{xml:mysetups}

\startxmlsetups xml:something
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:what
    what: \xmlatt{#1}{a}\par
\stopxmlsetups

\startxmlsetups xml:two
    [TWO] %
\stopxmlsetups

\startxmlsetups xml:test
    [TEST] %
\stopxmlsetups

\startxmlsetups xml:last
    [LAST] %
\stopxmlsetups

\starttext
\enabletrackers[xml.parse,xml.path]
    \xmlprocessbuffer{main}{test}{}
\disabletrackers[xml.parse]
\stoptext
