At 10:15 PM 2/11/2002 +0100, you wrote:
>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.

I already gambled on you asking this:

% watch how we now redefine the #1 element to a saved one

\def\WhatAHackA#1%
    {\defineXMLenvironmentsave[#1]
       {\doglobal\addtocommalist{#1}\CrapList
        \bTD#1\eTD\defineXMLsave[#1]}
       \donothing}

% here we first erase them all, then save them when present, and finaly add 
them to the table

\def\WhatAHackB#1%
   {\bTR
    \processcommacommand[\CrapList]\XMLerase
    #1% sets content
    \processcommacommand[\CrapList]\WhatAHackC
    \eTR}

% a cell

\def\WhatAHackC#1%
    {\expanded{\bTD\XMLflush{#1}}\eTD}

% a slightly different main macro

\defineXMLenvironmentsave[revhistory]
   {\bgroup}
   {\def\HackList{revnumber,date,revremark,authorinitials}
    \gdef\CrapList{}
    \defineXMLenvironment[revision] \donothing \donothing
    \processcommacommand[\HackList]\WhatAHackA
    \bTABLE
    \bTR\XMLflush{revhistory}\eTR
    \defineXMLargument[revision] \WhatAHackB
    \XMLflush{revhistory}%
    \eTABLE
    \egroup}

% [still no aux file needed]

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
                       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 via email to