ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Simon Pepping <spepping@scaprea.hobby.nl>
Subject: Re: DocBook probleempje
Date: Mon, 11 Feb 2002 22:15:47 +0100	[thread overview]
Message-ID: <20020211221547.A14372@scaprea> (raw)
In-Reply-To: <5.1.0.14.1.20020210215623.02f99fc8@server-1>; from pragma@wxs.nl on Sun, Feb 10, 2002 at 10:04:15PM +0100

On Sun, Feb 10, 2002 at 10:04:15PM +0100, Hans Hagen wrote:

First the problem in English:

I want to render the revhistory as a table. But it may have a large
range of fields. Preferably I would like to be able to see which
fields occur, and only include those columns.

This code works fine, and it teaches me that it is not necessary to
write to an auxiliary file. All data can be built in memory.

But I want more. The following is an appropriate test text. Each row
may show a different selection from the possible fields. And all rows
together may only use a subset of the set of possible fields. I only
want to include the fields actually used; so I do not want to show the
field authorinitials if that is not used in any of the rows.

<revhistory>
    <revision>
       <revnumber>0.06</revnumber>
       <date>2001-01-08</date>
       <authorinitials>gjf</authorinitials>
        <revremark>
          Changed date format (YYYY-MM-DD)
       </revremark>
    </revision>
    <revision>
       <revnumber>0.07</revnumber>
       <date>2001-01-09</date>
        <revremark>
          Changed date format (YYYY-MM-DD) again
       </revremark>
    </revision>
    <revision>
       <revnumber>0.08</revnumber>
       <authorinitials>gjf</authorinitials>
        <revremark>
          Changed date format (YYYY-MM-DD) once more
       </revremark>
    </revision>
</revhistory>

> Hi Simon,
> 
> Your problem can be solved in the following way: [i cc to teh list since it 
> may be instructive]
> 
> % output=pdftex
> 
> % This is the first pass: add an \bTD .. \eTD (or \bTH .. eTH) entry
> 
> \def\WhatAHackA#1%
>    {\defineXMLenvironmentsave[#1]
>       {\bTD#1\eTD\defineXMLignore[#1]}
>       \donothing}
> 
> % and this the second pass: actually typeset them
> 
> \def\WhatAHackB#1%
>    {\defineXMLpickup[#1]
>       \bTD
>       \eTD}
> 
> % here we do the two passes (one can add an additional pass
> % over the <revision> element, or even better: store the
> % entries, and flush them when needed skipping empty elements)
> 
> \defineXMLenvironmentsave[revhistory]
>     {\bgroup}
>     {\def\HackList{revnumber,date,revremark,authorinitials}
>      \defineXMLenvironment[revision] \donothing \donothing
>      \processcommacommand[\HackList]\WhatAHackA
>      \bTABLE
>      \bTR\XMLflush{revhistory}\eTR
>      \defineXMLpickup[revision] \bTR \eTR
>      \processcommacommand[\HackList]\WhatAHackB
>      \XMLflush{revhistory}
>      \eTABLE
>      \egroup}
> 

Regards, Simon

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl


  reply	other threads:[~2002-02-11 21:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020208220553.B384@scaprea>
2002-02-10 21:04 ` Hans Hagen
2002-02-11 21:15   ` Simon Pepping [this message]
2002-02-13 20:15     ` Hans Hagen
2002-02-14 22:13       ` Simon Pepping
2002-02-15  7:46         ` Hans Hagen

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=20020211221547.A14372@scaprea \
    --to=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).