On Thu, 17 Mar 2011, R. Ermers wrote:

Dear All,

I am still trying to typeset cals tables.

I have
1. an environment document with instructions.
2. an xml docbook file containing cals tables

Note that the original cals tables (docbook standard) use <table, <tgroup, etc. but 
for ConTeXt purposes this  - as far as I understand - needs to be: <cals:table, 
<cals:tgroup, etc. (My xml reader does not recognize them anymore.)


There is a bug in lxml-dir.lua. Open lxml-dir.lua and change

local collection = xml.applylpath({ getid(xml.load(filename)) },"directive") -- 
is { } needed ?

to

local collection = xml.applylpath(getid(xml.load(filename)),"directive") -- AM: removed { }

[@Hans: I do not checked if this affects other uses of directives.load(...).]

Then run c --make to regenerate formats. After that create three files:

%% directives.xml
<?xml version="1.0" standalone="yes"?>
<directives>
  <directive attribute="cdx" value="color" element="cals:table"
             setup="cdx:cals:table:colors"/>
</directives>


%% table.xml
<?xml version="1.0" standalone="yes"?>

<cals:table cdx="color">
  <cals:tgroup cols="3">
    <cals:thead>
      <cals:row>
        <cals:entry>alpha</cals:entry>
        <cals:entry>beta</cals:entry>
        <cals:entry>gamma</cals:entry>
      </cals:row>
    </cals:thead>
    <cals:tbody>
      <cals:row>
        <cals:entry>one</cals:entry>
        <cals:entry>two</cals:entry>
        <cals:entry>three</cals:entry>
      </cals:row>
      <cals:row>
        <cals:entry>four</cals:entry>
        <cals:entry>five</cals:entry>
        <cals:entry>six</cals:entry>
      </cals:row>
    </cals:tbody>
  </cals:tgroup>
</cals:table>


%% test.tex
\usemodule[cals]

\startsetups cdx:cals:table:colors
  \setupTABLE[each][each][background=color,backgroundcolor=red]
\stopsetups

\starttext
\xmlloaddirectives{directives.xml}
\xmlprocess{xml:cals:process}{table.xml}{}
\stoptext


Then compile test.tex to get a table with a red background.

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

Reply via email to