From: Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de>
To: ntg-context@ntg.nl
Subject: Re: including xml files
Date: Sun, 7 Mar 2010 11:14:56 +0100 [thread overview]
Message-ID: <20100307101456.GA14247@aides> (raw)
In-Reply-To: <20100303132841.GA7606@aides>
[-- Attachment #1.1.1: Type: text/plain, Size: 1493 bytes --]
Hi again,
now that everybody should be back from DANTE2010, I'll try that one
again:
> what is the recommended way of including an xml tree from one file in
> another? Right now I'm stuck with the following
[ ... ] snip
>
> Personally, I'd prefer some include method like file entities (<!ENTITY
> inc SYSTEM "inc.xml">) but they don't seem to work.
My latest try was \xmlinclude but that didn't work either. When I have
the following setups
\startxmlsetups xml:afile
\section{Filename \xmlatt{#1}{file}}
%\xmlinclude{test} { } {\xmlatt{#1}{file}}
%\xmlinclude{test} {/*} {\xmlatt{#1}{file}}
%\xmlinclude{test} {/sect} {\xmlatt{#1}{file}}
%\xmlinclude{test} {/sect/title} {\xmlatt{#1}{file}}
\xmlinclude{test} {sect} {\xmlatt{#1}{file}}
\stopxmlsetups
Where “test” is the name of the document to be processed and "sect” is
the outermost node from the included file.
This produces nothing, but try uncommenting some lines: context fails
with a lua error. Why this? xml-mkiv says that the second argument to
\xmlinclude should be an lpath from “file” and <sect> is the first node
in the file (I'll attach it).
Is there anybody who could provide a working example of \xmlinclude or
reveal The Right Way of Including XML to me?
Thanks for any help,
Philipp
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
[-- Attachment #1.1.2: testenv.tex --]
[-- Type: text/x-tex, Size: 1501 bytes --]
\enabletrackers[xml.entities]
\enabletrackers[xml.parse]
\enabletrackers[xml.path]
\enabletrackers[xml.profile]
\enabletrackers[xml.remap]
\enabletrackers[lxml.access]
\enabletrackers[lxml.comments]
\enabletrackers[lxml.loading]
\enabletrackers[lxml.manipulations]
\enabletrackers[lxml.setups]
\startxmlsetups xml:testsetups
\xmlsetsetup{\xmldocument}{*}{-}
\xmlsetsetup{\xmldocument}{body|afile|title|sect|content}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:body
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:sect
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:title
\chapter{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:content
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:afile
\section{Filename \xmlatt{#1}{file}}
%\xmlinclude{test} { } {\xmlatt{#1}{file}}
%\xmlinclude{test} {/*} {\xmlatt{#1}{file}}
%\xmlinclude{test} {/sect} {\xmlatt{#1}{file}}
%\xmlinclude{test} {/sect/title} {\xmlatt{#1}{file}}
\xmlinclude{test} {sect} {\xmlatt{#1}{file}}
\stopxmlsetups
%\xmlprependsetup{xml:afile} % from lxml-ini.mkiv, fails
\setuphead[chapter][page=no]
\starttext
\startbuffer
<?xml version="1.0"?>
<body>
<sect><title>First section</title><content>Content</content></sect>
<afile href="inc.xml" file="inc.xml"/>
<sect><title>Last section</title><content>Content</content></sect>
</body>
\stopbuffer
\xmlprocessbuffer{test}{}{}
\stoptext
% vim:ft=context
[-- Attachment #1.1.3: inc.xml --]
[-- Type: application/xml, Size: 121 bytes --]
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 486 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
___________________________________________________________________________________
next prev parent reply other threads:[~2010-03-07 10:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 13:28 Philipp Gesang
2010-03-07 10:14 ` Philipp Gesang [this message]
2010-03-07 12:52 ` Taco Hoekwater
2010-03-07 17:29 ` Philipp Gesang
2010-03-08 9:57 ` Hans Hagen
2010-03-08 12:30 ` Philipp Gesang
2010-03-08 13:22 ` Hans Hagen
2010-03-08 19:33 ` Thomas A. Schmitz
2010-03-08 20:32 ` Hans Hagen
[not found] ` <66F96041-9A2F-4A70-A7B5-9552086807DC@uni-bonn.de>
2010-03-08 21:04 ` Hans Hagen
2010-03-08 21:08 ` Thomas A. Schmitz
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=20100307101456.GA14247@aides \
--to=pgesang@ix.urz.uni-heidelberg.de \
--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).