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
\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: inc.xml
Description: XML document

Attachment: pgpjrMedLsxNa.pgp
Description: PGP signature

___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to