ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* xml question
@ 2008-06-06  8:19 Wolfgang Schuster
  2008-06-06  9:03 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2008-06-06  8:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xml question
  2008-06-06  8:19 xml question Wolfgang Schuster
@ 2008-06-06  9:03 ` Hans Hagen
  2008-06-06  9:07   ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2008-06-06  9:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xml question
  2008-06-06  9:03 ` Hans Hagen
@ 2008-06-06  9:07   ` Wolfgang Schuster
  2008-06-06  9:56     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2008-06-06  9:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Jun 6, 2008 at 11:03 AM, Hans Hagen <pragma@wxs.nl> 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.

Wolfgang
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xml question
  2008-06-06  9:07   ` Wolfgang Schuster
@ 2008-06-06  9:56     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2008-06-06  9:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster wrote:
> On Fri, Jun 6, 2008 at 11:03 AM, Hans Hagen <pragma@wxs.nl> 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
-----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-06  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-06  8:19 xml question Wolfgang Schuster
2008-06-06  9:03 ` Hans Hagen
2008-06-06  9:07   ` Wolfgang Schuster
2008-06-06  9:56     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).