ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Meer, Hans van der" <H.vanderMeer@uva.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Subject: Re: xml input
Date: Thu, 21 Apr 2016 07:41:26 +0000	[thread overview]
Message-ID: <9C2C0247-95F7-47B1-A1A8-4FE147A880F7@uva.nl> (raw)
In-Reply-To: <500669F7-BE73-4372-8F05-35E6997C3B9F@silentumbrella.com>


[-- Attachment #1.1: Type: text/plain, Size: 3885 bytes --]

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<mailto: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



[-- Attachment #1.2: Type: text/html, Size: 10370 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2016-04-21  7:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 14:21 Meer, Hans van der
2016-04-13 15:35 ` Meer, Hans van der
2016-04-14  8:44   ` Hans Hagen
2016-04-14  8:45 ` Hans Hagen
2016-04-14 20:30   ` Meer, Hans van der
2016-04-14 20:31     ` luigi scarso
2016-04-14 20:56     ` Pablo Rodriguez
2016-04-14 21:22       ` Meer, Hans van der
2016-04-14 22:47       ` Mica Semrick
2016-04-21  7:41         ` Meer, Hans van der [this message]
2016-04-21  8:41           ` Hans Hagen
2016-04-22  7:33             ` Meer, Hans van der
2016-04-22  7:46               ` Hans Hagen
2016-04-21 14:38           ` Mica Semrick
2016-04-23 11:18             ` Meer, Hans van der

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9C2C0247-95F7-47B1-A1A8-4FE147A880F7@uva.nl \
    --to=h.vandermeer@uva.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).