% engine=luatex

\usemodule[x][cals]

\setupcolors[state=start]

\startsetups cdx:cals:table:noframe
    \setupTABLE[frame=off]
\stopsetups

\startsetups cdx:cals:table:colors
    \setupTABLE[row]   [odd] [frame=off,background=color,backgroundcolor=red]
    \setupTABLE[row]   [even][frame=off,background=color,backgroundcolor=green]
    \setupTABLE[column][2]   [frame=off,background=color,backgroundcolor=blue]
\stopsetups

\startsetups cdx:cals:table:vertical
    \setupTABLE[row] [odd] [frame=off,background=color,backgroundcolor=lightblue]
\stopsetups

\startsetups cdx:cals:table:horizontal
    \setupTABLE[column] [odd] [frame=off,background=color,backgroundcolor=lightblue]
\stopsetups

\startsetups cdx:cals:table:before:frame
    \framed [offset=overlay,frame=off,topframe=on,bottomframe=on,rulethickness=2pt,framecolor=red,align=normal] \bgroup
        \vskip2pt
        \framed [offset=overlay,frame=off,leftframe=on,rightframe=on,rulethickness=1pt,framecolor=red,align=normal] \bgroup
\stopsetups

\startsetups cdx:cals:table:after:frame
        \egroup
        \vskip2pt
    \egroup
\stopsetups

% \startxmlsetups xml:cals:process
%     \xmlsetsetup {\xmldocument} {cals:table} {*}
% \stopxmlsetups
% \startxmlsetups cals:table
%     \ctxlua{lxml.cals.table("#1")}
% \stopxmlsetups
% \xmlregistersetup{xml:cals:process}

\starttext
    \xmlloaddirectives{x-cals-test.cdx}
    \xmlprocess{main}{x-cals-test.xml}{}
\stoptext
