Philipp Gesang wrote:
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?
I don't pretend to understand all of XML processing, but I believe \xmlinclude works like this: take the file that is pointed to by the named attribute #3 from the node pointed to by lpath #2 in tree #1. So in this case, you would have \xmlinclude{test}{afile}{file}. But I have no idea what then happens with the generated tree :-/ To actually make use of inc.xml in the current document, perhaps \xmlprocessfile is what you are after? \startxmlsetups xml:afile \section{Filename \xmlatt{#1}{file}} \xmlprocessfile {test2} {\xmlatt{#1}{file}} {} \stopxmlsetups Best wishes, Taco