On 12/16/2012 10:07 PM, Schmitz Thomas A. wrote:
On Dec 16, 2012, at 2:46 PM, Hans Hagen <pra...@wxs.nl> wrote:
Using xml sounds ok to me (esp as you know how to do it) ... with xinclude you
mean combining multiple files into one? It's what we do in all xml related
projects here. There is actually an \xmlinclude command
\xmlinclude{main}{include}{filename|href|name}
this will include from elements with tags 'include' and one of the attributes
mentioned. Do this as one of the first steps as it merges xml trees.
Hans
Hi Hans,
thanks for your suggestion. Yes, I mean combining multiple files into one
document. Sorry that I didn't see \xmlinclude, that's of course just what I was
looking for. But after searching the list, I saw a couple old messages by Hans
dan der Meer which made me realise I have no idea yet how to use it. Something
like this?
file chapter_1.xml
<chapter>
text
</chapter>
file <chapter_2.xml
<chapter>
text
</chapter>
and then
file master.xml
<document>
<xi:include href="chapter_1.xml/>
<xi:include href="chapter_2.xml/>
</document>
Would translate to
\startxmlsetups xml:xi:include
\startchapter
\xmltext{#1}{chapter}
\stopchapter
\stopchapter
Is that the basic structure, or am I misunderstanding the way this could be
used?
well, that bit of code is *not* going so save the world
(1) master tex file
\startxmlsetups xml:setups
\xmlinclude{#1}{xi:include}{href}
\xmlsetsetup{#1}{document|chapter}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:setups}
\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:chapter
\startchapter[title=\xmltext{#1}{title}]
\xmlall{#1}{content}
\stopchapter
\stopxmlsetups
\starttext
\xmlprocessfile{main}{master.xml}{}
\stoptext
(2) master xml file (with balanced quotes)
<document>
<xi:include href="chapter_1.xml"/>
<xi:include href="chapter_2.xml"/>
</document>
(3) proper chapters:
<chapter>
<title>one</title>
<content>text</content>
</chapter>
and
<chapter>
<title>two</title>
<content>text</content>
</chapter>
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________