From: "Meer, Hans van der" <H.vanderMeer@uva.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Subject: loading and executing xml-buffer
Date: Wed, 12 Oct 2016 08:13:24 +0000 [thread overview]
Message-ID: <775B7000-B390-48DE-9F46-0716CA2B2203@uva.nl> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2032 bytes --]
I did not succeed in on-the-fly loading data from an xml-buffer and subsequently executing its content.
The accompanying minimal example of a <document> shows what I strive to accomplish.
The node <buffer> contains the buffered data (abc meant to be set in bold) and node <getbuffer> executing the typesetting. As can be seen the output the <b>xyz</b> outside <buffer> is correctly set in bold, but the contents of <buffer> is not processed: the xml is just reproduced. Obviously there is some misunderstanding on my part.
I would like to be pointed in the right direction.
Hans van der Meer
\startbuffer[demo-xml]
<?xml version="1.0" encoding="UTF-8"?>
<document>
<buffer name="name">
<b>abc</b>
</buffer>
<!-- other stuff in real application -->
<getbuffer name="name"/>
<b>xyz</b>
</document>
\stopbuffer
\enabletrackers[lxml.loading,lxml.setups]
\startxmlsetups xml:demo:base
\xmlsetsetup{#1}{document|buffer|getbuffer|execbuffer|b}{xml:demo:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:buffer
... enter <buffer> for "\xmlatt{#1}{name}"\crlf
\xmltobuffer{#1}{.}{\xmlatt{#1}{name}}
\stopxmlsetups
\startxmlsetups xml:demo:getbuffer
... enter <getbuffer> for "\xmlatt{#1}{name}"\crlf
\xmlprocessbuffer{}{\xmlatt{#1}{name}}{xml:demo:execbuffer}
\stopxmlsetups
\startxmlsetups xml:demo:execbuffer
... enter <execbuffer>\crlf
\xmlall{#1}{buffer/*}
\stopxmlsetups
\startxmlsetups xml:demo:b
\xmlstripnolines{#1}{.}
{\bf\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:demo:document
\writestatus{TEST}{start document}
start document "\xmldocument"\blank
\xmlflush{#1}\blank
stop document "\xmldocument"\blank
\writestatus{TEST}{stop document}
\stopxmlsetups
\starttext
\textrule{Demo of buffer: demo.xml}
==========\crlf
\xmlprocessbuffer{demo}{demo-xml}{}
==========\crlf
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 3431 bytes --]
[-- Attachment #2: demo2.pdf --]
[-- Type: application/pdf, Size: 9929 bytes --]
[-- Attachment #3: Type: text/plain, Size: 489 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://context.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
reply other threads:[~2016-10-12 8:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=775B7000-B390-48DE-9F46-0716CA2B2203@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).