Hi, I played with a little bit with the docbook syntax and came to a problem with headers. The text for chapter headers is written between the title elements, to get the text I use the \xmlfirst command but this did not prevent the text in the element to appear again in the normal document text. As a workaround I introduced the \ifheading to flush the content only in chapter headers, is there a better way to do this? It is also possible to place the title elements outside of the chapter group where it is used as a header by itself, I did this now by another test \ifchapter where I test if it called within a chapter or not but a better solution is welcome. My last question is what I the preferef method to define entities in MkIV, \defineXMLentity is a MkII command and did not fit in the MkIV xmlsetup commands. \startbuffer[test] <?xml version='1.0'?> <book> <title>Document with &ConTeXt;</title> <chapter id="first"><title>The first Chapter</title> <para>Normal Text.</para> <para>Normal Text.</para> </chapter> <chapter id="second"><title>Another Chapter</title> <para>Normal Text.</para> <para>Normal Text.</para> </chapter> </book> \stopbuffer \unprotect \startxmlsetups setup \xmlsetsetup{\xmldocument}{title}{*} \xmlsetsetup{\xmldocument}{chapter}{*} \xmlsetsetup{\xmldocument}{para}{*} \stopxmlsetups \xmlregistersetup{setup} \newif\ifheading \newif\ifchapter \startxmlsetups title \ifchapter \ifheading\xmlflush{#1}\fi \else \title{\xmlflush{#1}} \fi \stopxmlsetups \startxmlsetups chapter \headingtrue \chaptertrue \chapter[\xmlatt{#1}{id}]{\xmlfirst{#1}{title}} \headingfalse \xmlflush{#1} \chapterfalse \stopxmlsetups \startxmlsetups para \xmlflush{#1}\par \stopxmlsetups \defineXMLentity [ConTeXt] \ConTeXt \protect \starttext \xmlprocessbuffer{main}{test}{} \stoptext Wolfgang
Wolfgang Schuster wrote:
\startxmlsetups setup \xmlsetsetup{\xmldocument}{chapter/title}{chapter:title} \stopxmlsetups
\startxmlsetups chapter:title \chapter{\xmlflush{#1}} \stopxmlsetups
----------------------------------------------------------------- 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 Fri, Jun 6, 2008 at 11:03 AM, Hans Hagen
Wolfgang Schuster wrote:
\startxmlsetups setup \xmlsetsetup{\xmldocument}{chapter/title}{chapter:title} \stopxmlsetups
\startxmlsetups chapter:title \chapter{\xmlflush{#1}} \stopxmlsetups
Just one more thing, how can I get the the id attribute from the chapter element as reference entry for \chapter. Wolfgang
Wolfgang Schuster wrote:
On Fri, Jun 6, 2008 at 11:03 AM, Hans Hagen
wrote: Wolfgang Schuster wrote:
\startxmlsetups setup \xmlsetsetup{\xmldocument}{chapter/title}{chapter:title} \stopxmlsetups
\startxmlsetups chapter:title \chapter{\xmlflush{#1}} \stopxmlsetups
Just one more thing, how can I get the the id attribute from the chapter element as reference entry for \chapter.
\startxmlsetups chapter:title \expanded{\chapter[\xmlatt{#1}{id}]{\xmlflush{#1}}} \stopxmlsetups ----------------------------------------------------------------- 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 (2)
-
Hans Hagen
-
Wolfgang Schuster