ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: Jaroslav Snajdr <jsnajdr@tinysoftware.cz>, spepping@scaprea.hobby.nl
Subject: docbook
Date: Mon, 21 Jan 2002 21:58:20 +0100	[thread overview]
Message-ID: <5.1.0.14.1.20020121213234.02aecbc0@server-1> (raw)
In-Reply-To: <200201211101.MAA17323@smail.let.uu.nl>

[simon: this is another docbook example]

[non member submission, pleas use registered address]

>Hello,
>
>I'm typesetting a Docbook document with ConTeXt and I cannot get it to
>typeset the index correctly. The index is generated automatically with
>this code:
>
>\defineXMLenvironment[book]{\starttext}{\completeindex\stoptext}
>
>\defineXMLargument[indexterm]{\index}
>\defineXMLcommand[primary]{}
>\defineXMLcommand[secondary]{+}
>
>Index entries in DocBook are coded through the text as:
>
><indexterm><primary>animals</primary></indexterm>
>
>or
>
><indexterm><primary>animals</primary><secondary>dogs</secondary></indexterm>

since you need to distinguish between primary and secondary index entries, 
you can best save/flush them, as in:

\defineXMLenvironment [book]
   {\starttext}
   {\placeindex
    \stoptext}

\defineXMLenvironment [indexterm]
   {\defineXMLenvironmentsave[primary]   \ignorespaces \ignorespaces
    \defineXMLenvironmentsave[secondary] \ignorespaces \ignorespaces}
   {\doifelseXMLdata{secondary}
      {\expanded{\index{\XMLflushdata{primary}+\XMLflushdata{secondary}}}}
      {\expanded{\index{\XMLflushdata{primary}}}}}

\enableXMLelements

<book>
   So we have primary<indexterm> <primary>animals</primary>
   animals </indexterm> as well as secondary<indexterm>
   <primary>animals</primary> <secondary>dogs</secondary>
   </indexterm> ones, at least in the Czech republic.
</book>

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


       reply	other threads:[~2002-01-21 20:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200201211101.MAA17323@smail.let.uu.nl>
2002-01-21 20:58 ` Hans Hagen [this message]
2012-12-18 11:31 DocBook Roger Mason
2012-12-18 11:47 ` DocBook Wolfgang Schuster
2012-12-18 13:21   ` DocBook Hans Hagen
2012-12-18 16:15     ` DocBook Roger Mason
2012-12-18 12:30 ` DocBook Thomas Weißschuh
  -- strict thread matches above, loose matches on Subject: below --
2001-12-11 23:01 docbook Hans Hagen
2001-12-05 18:21 DocBook Lukas Kubin
2001-12-05 19:36 ` DocBook Marco Kuhlmann
2001-12-05 20:13   ` DocBook Berend de Boer
2001-12-30 11:26     ` DocBook Simon Pepping
2002-01-01 12:22       ` DocBook Hans Hagen
2002-01-02 20:36         ` DocBook Simon Pepping
2002-01-03 22:42         ` DocBook Matthias Klose
2002-01-04 11:20           ` DocBook Hans Hagen
2002-01-06 20:12           ` DocBook Simon Pepping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5.1.0.14.1.20020121213234.02aecbc0@server-1 \
    --to=pragma@wxs.nl \
    --cc=jsnajdr@tinysoftware.cz \
    --cc=spepping@scaprea.hobby.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).