Changes

Jump to navigation Jump to search
902 bytes added ,  17:16, 17 December 2012
m
Inserted Hans' explanation from mailing list.
== Example ==
 
Here is an example how to use {{cmd|xmlinclude}} to combine several xml files into one document. The xml files represent single chapters of a book project. Their structure is:
 
<xmlcode>
<chapter title="Chapter 1">
<content>
Text of chapter
</content>
</chapter>
</xmlcode>
 
Then, one master file combines all these into one structure via the xi:include element [http://www.w3.org/TR/2003/WD-xinclude-20031110/]:
<xmlcode>
<exampledocument> <chapter>text 1<xi:include href="chapter_1.xml"/chapter> <chapter>text 2<xi:include href="chapter_2.xml"/chapter></exampledocument>
</xmlcode>
 
And finally, you process this with a master tex file:
<texcode>
\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=\xmlatt{#1}{title}] \xmlall{#1}{content} \stopchapter\stopxmlsetups \starttext  \xmlprocessfile{main}{master...xml}{} \stoptext
</texcode>
gardener
111

edits

Navigation menu