From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/94504 Path: news.gmane.org!not-for-mail From: "Meer, Hans van der" Newsgroups: gmane.comp.tex.context Subject: Re: xml input Date: Thu, 21 Apr 2016 07:41:26 +0000 Message-ID: <9C2C0247-95F7-47B1-A1A8-4FE147A880F7@uva.nl> References: <8ACED9AF-31FB-4C80-9D4C-6A545EA13634@uva.nl> <570F58C0.4090107@wxs.nl> <545694FE-156E-4912-9D98-A59815EB6F47@uva.nl> <571003F2.6040105@gmx.es> <500669F7-BE73-4372-8F05-35E6997C3B9F@silentumbrella.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3754101632002434424==" X-Trace: ger.gmane.org 1461224549 1853 80.91.229.3 (21 Apr 2016 07:42:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Apr 2016 07:42:29 +0000 (UTC) To: NTG ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 21 09:42:17 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1at9Fc-0000OE-Aw for gctc-ntg-context-518@m.gmane.org; Thu, 21 Apr 2016 09:42:12 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 38A9CAA71; Thu, 21 Apr 2016 09:41:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZeCtfhyxhV3c; Thu, 21 Apr 2016 09:41:40 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id F2CB1AABE; Thu, 21 Apr 2016 09:41:39 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 48AB0A8A4 for ; Thu, 21 Apr 2016 09:41:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nRqHe9mAx3AI for ; Thu, 21 Apr 2016 09:41:37 +0200 (CEST) Original-Received: from HUB02.uva.nl (hub02.uva.nl [146.50.108.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id BC503A5CD for ; Thu, 21 Apr 2016 09:41:27 +0200 (CEST) Original-Received: from MBX02.uva.nl ([169.254.2.73]) by HUB02.uva.nl ([2002:9232:6ce7::9232:6ce7]) with mapi id 14.03.0266.001; Thu, 21 Apr 2016 09:41:27 +0200 Thread-Topic: [NTG-context] xml input Thread-Index: AQHRlioM4dTLZ/GwMUWPLa/OBLWcZJ+JywSAgAAHTwCAAB8jgIAKAxkA In-Reply-To: <500669F7-BE73-4372-8F05-35E6997C3B9F@silentumbrella.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [84.106.134.200] x-endpointsecurity-0xde81-ev: v:6.2.7.719, d:out, a:y, w:t, t:0, sv:1461206110, ts:1461224487 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:94504 Archived-At: --===============3754101632002434424== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_9C2C024795F747B1A1A84FE147A880F7uvanl_" --_000_9C2C024795F747B1A1A84FE147A880F7uvanl_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable A week ago I posted here by accident part of a private conversation (in Dut= ch) with Hans Hagen. I already apologized for this. On 15 Apr 2016, at 00:47, Mica Semrick > wrote: I'm interested in this thread too... But I'm american, so English only. I a= ppreciate your understanding! >From reactions I understood that other people are interested in this subjec= t of \xmlinclude too, but at that moment I could not produce a coherent sto= ry. After having produced some minimal (1) working, (2) not working and (3) cr= ashing examples, I dare hope that my contribution of these will be of some = use. And perhaps they will spawn better suggestions and better understandin= g of what happens, because I must confess I am somewhat unsure with functio= nal 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 \st= arthiding. The last one can be executed by removing the %%%%'s at the front of the off= ending statement. Again, I hope this post will be of some use. Hans van der Meer contents of file minimal-example.xml: Body of first note Body of second note Three exampel programs: \enabletrackers[lxml.loading,lxml.setups] \startbuffer[notes-xml] \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} =3D=3D=3D> number of =3D \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} =3D=3D=3D> number of =3D \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}}\crl= f \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} =3D=3D=3D> number of =3D \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 --_000_9C2C024795F747B1A1A84FE147A880F7uvanl_ Content-Type: text/html; charset="us-ascii" Content-ID: <9490384E4EC5DF44A541796AC8F42685@uva.nl> Content-Transfer-Encoding: quoted-printable A week ago I posted here by accident part of a private conversation (in Dut= ch) 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 E= nglish only. I appreciate your understanding!


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

Find below my examples. One can call each of them by commen= ting 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 secon= d note</body>
</note>
</notes>

Three exampel programs:

\enabletrackers[lxml.load= ing,lxml.setups]
\startbuffer[notes-xml]
<?xml version=3D"= 1.0" encoding=3D"UTF-8"?>
<takenotes><= /div>
<include file=3D"= minimal-example.xml"/>
</takenotes>=
\stopbuffer

\starthiding
% Test #1
\startxmlsetups notes:set= ups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{notes}{n= otes:*}
\stopxmlsetups
\xmlregisterdocumentsetup= {notes}{notes:setups}
\startxmlsetups notes:not= es
\xmlinclude{#1}{include}{= file}
\xmlshow{#1}
=3D=3D=3D> number of &= lt;note> =3D \xmlcount{#1}{note}
\stopxmlsetups
\starttext
Ok with \type{\xmlprocess= buffer{notes}{notes-xml}{notes:notes}}\crlf
\xmlprocessbuffer{notes}{= notes-xml}{notes:notes}
\blank
Not ok with \type{\xmlpro= cessbuffer{notes}{notes-xml}{}}\crlf
\xmlprocessbuffer{notes}{= notes-xml}{}
\textrule{end of test \#1= }
\stoptext
\stophiding

\starthiding
% Test #2
\startxmlsetups notes:set= ups
    \xmlsetsetu= p{#1}{*}{-}
    \xmlsetsetu= p{#1}{takenotes}{notes:*}
\stopxmlsetups
\xmlregisterdocumentsetup= {notes}{notes:setups}
\startxmlsetups notes:tak= enotes
\xmlinclude{#1}{include}{= file}
\xmlshow{#1}
=3D=3D=3D> number of &= lt;note> =3D \xmlcount{#1}{note}
\stopxmlsetups
\startxmlsetups notes:set= ups
\xmlflush{#1}
\stopxmlsetups
\starttext
Nothing with \type{\xmlpr= ocessbuffer{takenotes}{notes-xml}{}}\crlf
\xmlprocessbuffer{takenot= es}{notes-xml}{}
\blank
Not ok with \type{\xmlpro= cessbuffer{notes}{notes-xml}{}}\crlf
\xmlprocessbuffer{notes}{= notes-xml}{}
\blank
Not ok with \type{\xmlpro= cessbuffer{notes}{notes-xml}{notes:takenotes}}\crlf
\xmlprocessbuffer{notes}{= notes-xml}{}
\textrule{end of test \#2= }
\stoptext
\stophiding

%\starthiding
% Test #3
\startxmlsetups notes:set= ups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{notes}{n= otes:*}
\stopxmlsetups
\xmlregisterdocumentsetup= {notes}{notes:setups}
\startxmlsetups notes:not= es
\xmlfilter{#1}{takenotes/= include/command(notes:include)}
\xmlshow{#1}
=3D=3D=3D> number of &= lt;note> =3D \xmlcount{#1}{note}
\stopxmlsetups
\startxmlsetups notes:inc= lude
\writestatus{DEBUG}{enter= notes: include file \xmlattribute{#1}{../include}{file}}
\xmlinclude{#1}{../includ= e}{file}
\stopxmlsetups
\starttext
\type{\xmlprocessbuffer{n= otes}{notes-xml}{notes:notes}} will crash
%%%%\xmlprocessbuffer{not= es}{notes-xml}{notes:notes}%%%%
\crlf prints in the log:<= /font>
\crlf \type{DEBUG > en= ter notes: include file minimal-example.xml}
\crlf \type{lxml  &g= t; 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


--_000_9C2C024795F747B1A1A84FE147A880F7uvanl_-- --===============3754101632002434424== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============3754101632002434424==--