Re: [NTG-context] cals tables - UNSOLVED

2011-03-19 Thread R. Ermers
Dear All,

After having succeeded with Aditya's kind help to typeset a table file in a 
separate pdf, I have been trying to typeset the cals tables in my docbook xml 
file in two ways:

A. directly in the document. 

The table is in //section/cals:table.

The cals module is loaded at the beginning of the document. But in the pdf 
there is no trace of any table. Do I need to add 
 definition somewhere? Perhaps in this list where the xml items are introduced?

\xmlsetsetup{#1}{article|footnote|foreignphrase|section [snippet] 
para|quote|itemizedlist|listitem}{xml:*}

This would be contrary to working with the directives and the cals module.

B. as a separate document in a mediaobject
Usually docbook files can contain tables, but there is nothing against imported 
a separate files. I chose to use the graphics wrapper:

  mediaobject role=tabel
imageobject
  imagedata fileref=./test2.xml/  (I also tried 
fileref=test2.xml) 
/imageobject
  /mediaobject

I know that the object is found, because I use a marker (TABEL 3), which is 
printed in the pdf.

\startxmlsetups xml:mediaobject:imageobject:imagedata:tabel
\xmlloaddirectives{directives.xml}
TABEL 3
\xmlprocess{xml:cals:process}{\xmlatt{#1}{fileref}}{}
\stopxmlsetups

The xml file, and I believe here the table file is meant, is not imported 
though. The log file says that the xml file is invalid, but that is not true.  
It is Hans' simple test table (alpha, betha, gamma), it is validated by xml 
software, and moreover, it can be typeset without any problems in a separate 
pdf.

\pagesflushing realpage 24, userpage 24
lxml: 9 directives found in 'directives.xml', 9 valid
load invalid xml file - parsed text

The log file also says that the text is parsed. But there is no text from the 
table in the pdf.

%I tried loading the directives in various places, e.g. directly after the 
module in the top of the document and after the command \startxmlsetups 
xml:dbsetups.

Well, has anyone any advice? Or should I give up on this?

Regards,

Robert





___
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
___


Re: [NTG-context] cals tables - UNSOLVED

2011-03-18 Thread R. Ermers
Dear Aditya,

thanks greatly for your advice! It works! I now can influence how my tables 
look like.

Do you think it is possible to typeset an xml file that contains cals:table, 
or do I need to typeset the tables separately and then import the separate pdf 
files?

Thanks again,

Robert



Op 18 mrt 2011, om 05:08 heeft Aditya Mahajan het volgende geschreven:

 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:entryalpha/cals:entry
cals:entrybeta/cals:entry
cals:entrygamma/cals:entry
  /cals:row
/cals:thead
cals:tbody
  cals:row
cals:entryone/cals:entry
cals:entrytwo/cals:entry
cals:entrythree/cals:entry
  /cals:row
  cals:row
cals:entryfour/cals:entry
cals:entryfive/cals:entry
cals:entrysix/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
 ___

___
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
___


Re: [NTG-context] cals tables - UNSOLVED

2011-03-17 Thread R. Ermers
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.)

Among the many things I tried is putting the table in a separate xml file, and 
then import it:

\starttext
\xmlprocess{main}{\xmlatt{#1}{fileref}}{}
\stoptext

This works, so yes, it is possible to produce a standard table on a pdf page. 
This pd file can be imported as an image (which of course is of no help when 
the table is longer than one page).

But the directives - the ones prepared by Hans - have no influence on the 
tables at all. According to the log file the cdx file file is loaded, but the 
directives are not recognized:

lxml : no directives found in 'x-cals-test.cdx'

To solve this, I tried rephrasing the directives as context instructions:

directive attribute='cdx' value=colors element=cals:table 
setup=cdx:cals:table:colors/

\xmlcontextdirective {cdx} {colors} {cals:table} {cdx:cals:table:colors}

But there is no effect, and I don't know whether I did this right. However, 
loading the separate xml file and processing the table remain the main problem. 
When the process instruction is part of a setup in an environment file, such as:

\startxmlsetups xml:mediaobject:imageobject:imagedata:tabel
\xmlloaddirectives{x-cals-test.cdx}%
\xmlprocess{main}{\xmlatt{#1}{fileref}}{}
\stopxmlsetups

The table is not typeset and the entire file is broken off at this point (the 
table xml file is valid of course). 
So the table is probably read in, but then something happens. Without the 
table, the file is typeset normally.

I already read and reread all information in the manuals on this subject, and 
all archived email correspondence.

Can anyone explain me in more than one line how to set up an environmental 
file? Or show me a working minimal example?

Thanks in advance!

Regards,

Robert






___
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
___


Re: [NTG-context] cals tables - UNSOLVED

2011-03-17 Thread Aditya Mahajan

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:entryalpha/cals:entry
cals:entrybeta/cals:entry
cals:entrygamma/cals:entry
  /cals:row
/cals:thead
cals:tbody
  cals:row
cals:entryone/cals:entry
cals:entrytwo/cals:entry
cals:entrythree/cals:entry
  /cals:row
  cals:row
cals:entryfour/cals:entry
cals:entryfive/cals:entry
cals:entrysix/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
___