ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: "Schmitz Thomas A." <thomas.schmitz@uni-bonn.de>
Subject: Re: here is ae
Date: Mon, 17 Dec 2012 10:15:47 +0100	[thread overview]
Message-ID: <50CEE2C3.9030107@wxs.nl> (raw)
In-Reply-To: <EBACE5DA-610D-452E-BC66-2C4F86693629@uni-bonn.de>

On 12/16/2012 10:07 PM, Schmitz Thomas A. wrote:
>
> On Dec 16, 2012, at 2:46 PM, Hans Hagen <pragma@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
___________________________________________________________________________________


  parent reply	other threads:[~2012-12-17  9:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-15 16:07 one small remark and one broad question Thomas A. Schmitz
2012-12-16  0:45 ` Cecil Westerhof
2012-12-16 13:46 ` here is ae Hans Hagen
2012-12-16 21:07   ` Schmitz Thomas A.
2012-12-16 22:08     ` Sietse Brouwer
2012-12-16 22:19       ` Schmitz Thomas A.
2012-12-16 23:22         ` Sietse Brouwer
2012-12-17  9:15     ` Hans Hagen [this message]
2012-12-17  9:22       ` Thomas A. Schmitz
2012-12-17 15:02       ` Thomas A. Schmitz
2012-12-19  8:14 ` one small remark and one broad question 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=50CEE2C3.9030107@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    --cc=thomas.schmitz@uni-bonn.de \
    /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).