Thank you, this is much appreciated!

Best,
Mica

On April 21, 2016 12:41:26 AM PDT, "Meer, Hans van der" <H.vanderMeer@uva.nl> wrote:
A week ago I posted here by accident part of a private conversation (in Dutch) with Hans Hagen. I already apologized for this.

On 15 Apr 2016, at 00:47, Mica Semrick <mica@silentumbrella.com> wrote:

I'm interested in this thread too... But I'm american, so English only. I appreciate your understanding!


From reactions I understood that other people are interested in this subject of \xmlinclude too, but at that moment I could not produce a coherent story.
After having produced some minimal (1) working, (2)  not working and (3) crashing examples, I dare hope that my contribution of these will be of some use. And perhaps they will spawn better suggestions and better understanding of what happens, because I must confess I am somewhat unsure with functional language behaviour, being raised with Assembler, Algol, Pascal, Fortran, and so on ;-)

Find below my examples. One can call each of them by commenting out the \starthiding.
The last one can be executed by removing the %%%%'s at the front of the offending statement.
Again, I hope this post will be of some use.

Hans van der Meer

contents of file minimal-example.xml:

<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




If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net