Again, I hope this post will be of some use.
<notes>
<note>
<body>Body of first note</body>
</note>
<note>
<body>Body of second note</body>
</note>
</notes>
Three exampel programs:
\enabletrackers[lxml.loading,lxml.setups]
\startbuffer[notes-xml]
<?xml version="1.0" encoding="UTF-8"?>
<takenotes>
<include file="minimal-example.xml"/>
</takenotes>
\stopbuffer
\starthiding
% Test #1
\startxmlsetups notes:setups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{notes}{notes:*}
\stopxmlsetups
\xmlregisterdocumentsetup{notes}{notes:setups}
\startxmlsetups notes:notes
\xmlinclude{#1}{include}{file}
\xmlshow{#1}
===> number of <note> = \xmlcount{#1}{note}
\stopxmlsetups
\starttext
Ok with \type{\xmlprocessbuffer{notes}{notes-xml}{notes:notes}}\crlf
\xmlprocessbuffer{notes}{notes-xml}{notes:notes}
\blank
Not ok with \type{\xmlprocessbuffer{notes}{notes-xml}{}}\crlf
\xmlprocessbuffer{notes}{notes-xml}{}
\textrule{end of test \#1}
\stoptext
\stophiding
\starthiding
% Test #2
\startxmlsetups notes:setups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{takenotes}{notes:*}
\stopxmlsetups
\xmlregisterdocumentsetup{notes}{notes:setups}
\startxmlsetups notes:takenotes
\xmlinclude{#1}{include}{file}
\xmlshow{#1}
===> number of <note> = \xmlcount{#1}{note}
\stopxmlsetups
\startxmlsetups notes:setups
\xmlflush{#1}
\stopxmlsetups
\starttext
Nothing with \type{\xmlprocessbuffer{takenotes}{notes-xml}{}}\crlf
\xmlprocessbuffer{takenotes}{notes-xml}{}
\blank
Not ok with \type{\xmlprocessbuffer{notes}{notes-xml}{}}\crlf
\xmlprocessbuffer{notes}{notes-xml}{}
\blank
Not ok with \type{\xmlprocessbuffer{notes}{notes-xml}{notes:takenotes}}\crlf
\xmlprocessbuffer{notes}{notes-xml}{}
\textrule{end of test \#2}
\stoptext
\stophiding
%\starthiding
% Test #3
\startxmlsetups notes:setups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{notes}{notes:*}
\stopxmlsetups
\xmlregisterdocumentsetup{notes}{notes:setups}
\startxmlsetups notes:notes
\xmlfilter{#1}{takenotes/include/command(notes:include)}
\xmlshow{#1}
===> number of <note> = \xmlcount{#1}{note}
\stopxmlsetups
\startxmlsetups notes:include
\writestatus{DEBUG}{enter notes: include file \xmlattribute{#1}{../include}{file}}
\xmlinclude{#1}{../include}{file}
\stopxmlsetups
\starttext
\type{\xmlprocessbuffer{notes}{notes-xml}{notes:notes}} will crash
%%%%\xmlprocessbuffer{notes}{notes-xml}{notes:notes}%%%%
\crlf prints in the log:
\crlf \type{DEBUG > enter notes: include file minimal-example.xml}
\crlf \type{lxml > tex > including file 'minimal-example.xml'}
\crlf \type{lua error ... attempt to index field 'settings' (a nil value) ...tail calls}
\textrule{end of test \#3}
\stoptext
\stophiding