Hi all, what is the recommended way of including an xml tree from one file in another? Right now I'm stuck with the following \startxmlsetups xml:inc \xmlprocessfile{inc}{\xmlatt{#1}{file}}{} \stopxmlsetups combined with <inc file="inc.xml"/> in the xml source. But although the content of inc.xml is processed the headings it contains don't show up in the toc (there _is_ an entry for them and a page reference as well but no title). Personally, I'd prefer some include method like file entities (<!ENTITY inc SYSTEM "inc.xml">) but they don't seem to work. Thanks for any suggestions, Philipp -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
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
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
Good evening, On 2010-03-07 <13:52:34>, Taco Hoekwater wrote:
\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).
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}. Yes, that did it. I thoroughly confused the notion of “lpath” in xml-mkiv.pdf.
But I have no idea what then happens with the generated tree :-/ It's processed on the spot where <afile file="incfile"/> is found. The document should contain \xmlprependsetup{xml:afile} somewhere, too (lxml-ini.mkiv, line 115).
To actually make use of inc.xml in the current document, perhaps \xmlprocessfile is what you are after? [...] snip That's actually what troubled me in the first mail of this thread. I don't think \xmlprocessfile is intended to include files this way.
Thanks again, Philipp PS: XML in ConTeXt rocks!
Best wishes, Taco
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
On 7-3-2010 18:29, Philipp Gesang wrote:
So in this case, you would have \xmlinclude{test}{afile}{file}. Yes, that did it. I thoroughly confused the notion of “lpath” in xml-mkiv.pdf.
it's not xpath but shares quite some properties with it
To actually make use of inc.xml in the current document, perhaps \xmlprocessfile is what you are after? [...] snip That's actually what troubled me in the first mail of this thread. I don't think \xmlprocessfile is intended to include files this way.
xml in mkiv is still somewhat experimental although the commands and interfaces will stay; the current implementation is the second one and has the advanage that it stays closer to xpath and also is more roundtrip safe (tables of contents and so); i expect further improvements i use the xml code in production environments so it's performing quite ok now Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 2010-03-08 <10:57:00>, Hans Hagen wrote:
On 7-3-2010 18:29, Philipp Gesang wrote:
So in this case, you would have \xmlinclude{test}{afile}{file}. Yes, that did it. I thoroughly confused the notion of “lpath” in xml-mkiv.pdf.
it's not xpath but shares quite some properties with it Well, what I meant was that I thought the second parameter of \xmlinclude to be a path within the include-file, not the main document. The xpath--lpath relation is clear enough, I just got this one wrong because I read lines 111--115 of lxml-ini.mkiv first but the definition in xml-mkiv only later …
To actually make use of inc.xml in the current document, perhaps \xmlprocessfile is what you are after? [...] snip That's actually what troubled me in the first mail of this thread. I don't think \xmlprocessfile is intended to include files this way.
xml in mkiv is still somewhat experimental although the commands and interfaces will stay; the current implementation is the second one and has the advanage that it stays closer to xpath and also is more roundtrip safe (tables of contents and so); i expect further improvements Will there be documentation on the lua internals? It is tedious tracing things down all the way through ConTeXt -> lxml-ini -> lxml-tex -> lxml-aux to find out (or not) what they're supposed to do.
Regards Philipp
i use the xml code in production environments so it's performing quite ok now
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 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 ___________________________________________________________________________________
-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
On 8-3-2010 13:30, Philipp Gesang wrote:
Will there be documentation on the lua internals? It is tedious tracing things down all the way through ConTeXt -> lxml-ini -> lxml-tex -> lxml-aux to find out (or not) what they're supposed to do.
once i know what will be exposed, yes, Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Mar 8, 2010, at 10:57 AM, Hans Hagen wrote:
xml in mkiv is still somewhat experimental although the commands and interfaces will stay; the current implementation is the second one and has the advanage that it stays closer to xpath and also is more roundtrip safe (tables of contents and so); i expect further improvements
i use the xml code in production environments so it's performing quite ok now
Just a quick question as I'm writing something on ConTeXt + various xml variants for MAPS: does ConTeXt insist on finding the extension .xml with \xmldocument ? I tried and am having trouble processing a file such as foo.xhtml; when I rename the same file to foo.xml, it works flawlessly. All best Thomas
On 8-3-2010 20:33, Thomas A. Schmitz wrote:
On Mar 8, 2010, at 10:57 AM, Hans Hagen wrote:
xml in mkiv is still somewhat experimental although the commands and interfaces will stay; the current implementation is the second one and has the advanage that it stays closer to xpath and also is more roundtrip safe (tables of contents and so); i expect further improvements
i use the xml code in production environments so it's performing quite ok now
Just a quick question as I'm writing something on ConTeXt + various xml variants for MAPS: does ConTeXt insist on finding the extension .xml with \xmldocument ? I tried and am having trouble processing a file such as foo.xhtml; when I rename the same file to foo.xml, it works flawlessly.
not that i know of ... i use several suffixes here Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Philipp Gesang
-
Taco Hoekwater
-
Thomas A. Schmitz