\enabletrackers[xml.entities]
\enabletrackers[xml.parse]
\enabletrackers[xml.path]
\enabletrackers[xml.profile]
\enabletrackers[xml.remap]
\enabletrackers[lxml.access]
\enabletrackers[lxml.comments]
\enabletrackers[lxml.loading]
\enabletrackers[lxml.manipulations]
\enabletrackers[lxml.setups]

\startxmlsetups xml:testsetups
    \xmlsetsetup{\xmldocument}{*}{-}
    \xmlsetsetup{\xmldocument}{body|afile|title|sect|content}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

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

\startxmlsetups xml:title
    \chapter{\xmlflush{#1}}
\stopxmlsetups

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

\startxmlsetups xml:afile
    \section{Filename \xmlatt{#1}{file}}

    %\xmlinclude{test} {  }          {\xmlatt{#1}{file}}
    %\xmlinclude{test} {/*}          {\xmlatt{#1}{file}}
    %\xmlinclude{test} {/sect}       {\xmlatt{#1}{file}}
    %\xmlinclude{test} {/sect/title} {\xmlatt{#1}{file}}
    \xmlinclude{test} {sect}       {\xmlatt{#1}{file}}
\stopxmlsetups

%\xmlprependsetup{xml:afile}  % from lxml-ini.mkiv, fails

\setuphead[chapter][page=no]

\starttext

\startbuffer
<?xml version="1.0"?>
<body>
  <sect><title>First section</title><content>Content</content></sect>
  <afile href="inc.xml" file="inc.xml"/>
  <sect><title>Last section</title><content>Content</content></sect>
</body>
\stopbuffer

\xmlprocessbuffer{test}{}{}

\stoptext

% vim:ft=context
