In this case you have to provide a working minimal example.

Wolfgang

Here an example as minimal as I could construct.
Hans van der Meer

The following example outputs show what happens with and without the \unskip's 
in the code.
[cid:E7DC008D-E8CB-4F0A-BC45-9E8E4969C8DB]
[cid:8A14737A-52AE-4B90-A03B-FA36FFF321E0]

Also I am adding two other examples made by the same code, one in 2012 and one 
just now. Note the extensions to the right of each row. They are absent in the 
older version.

[cid:1110D708-ADD3-46B8-A49B-143200704DA7][cid:539F8473-CC40-4CDB-AFC6-48AF306DD3F5]
The example code follows here:

% Switching on attribute being present (even if empty) or absent.
\def\doifexistattribute#1#2{\doifnot{\xmlattdef{#1}{#2}{__NOT__}}{__NOT__}}%{#3}
% Translate attribute: #1 = node, #2 = category #3 = attribute #4 = default 
value.
\def\xlat#1#2#3#4{\xmlvalue{#2}{\xmlatt{#1}{#3}}{#4}}
% Setup parameter to attribute.
% #1 = node, #2 = setup, #3 = param, #4 = attrib, #5 = category, #6 = default.
\def\setupToAttribute#1#2#3#4#5#6{%
% Only executed if attribute is present.
\doifexistattribute{#1}{#4}%
% Attribute is present but category can be empty.
{\doifelse{#5}{\empty}%
{\doifelse{\xmlatt{#1}{#4}}{\empty}%
{#2[#3=#6]}% attribute present but empty then take default
{#2[#3=\xmlatt{#1}{#4}]}% attribute has content
}%
{#2[#3=\xlat{#1}{#5}{#4}{#6}]}% translate from category
}%
}
% Setup flag (an TeX-if) from attribute values on,off,no,yes,true,false.
% #1=node #2=flag: execute \attributetrue or \attributefalse
\def\setFlagToAttribute#1#2{%
\doifexistattribute{#1}{#2}%
{%
\doifinset{\xmlatt{#1}{#2}}{on,yes,true}{\csname#2true\endcsname}%
\doifinset{\xmlatt{#1}{#2}}{off,no,false}{\csname#2false\endcsname}%
}%
}
\startxmlsetups xmlcommon
\xmlsetsetup{\xmldocument}{error|store|restore|include
|table|tr|td|tbody
}{xmlcommon:*}
\stopxmlsetups
\xmlregistersetup{xmlcommon}
% Place at top/middle(default)/bottom location.
\def\startlocationbox#1{%
\let\templocation\relax
\doif{\xmlatt{#1}{location}}{top}{\def\templocation{\vtop}}%
\doif{\xmlatt{#1}{location}}{middle}{\def\templocation{\vcenter}}%
\doif{\xmlatt{#1}{location}}{center}{\def\templocation{\vcenter}}%
\doif{\xmlatt{#1}{location}}{bottom}{\def\templocation{\vbox}}%
\templocation\bgroup\ifx\templocation\relax\else\vss\fi
}
\let\stoplocationbox\egroup
\def\setupframeparameters#1#2{%
% color
% Always set background to color if backgroundcolor is set.
\doifnot{\xmlatt{#1}{bgcolor}}{\empty}{#2[background=color]}%
% But it can be overridden.
\doifnot{\xmlatt{#1}{background}}{\empty}{#2[background=\xmlatt{#1}{background}]}%
\setupToAttribute{#1}{#2}{foregroundcolor}{color}{}{darkblue}%
\setupToAttribute{#1}{#2}{backgroundcolor}{bgcolor}{}{green}%
% frame
\doifnot{\xmlatt{#1}{frame}}{\empty}%
{#2[frame=off]\setframeparts{\xmlatt{#1}{frame}}{#2}}%
\setupToAttribute{#1}{#2}{framecolor}{framecolor}{}{black}%
\setupToAttribute{#1}{#2}{corner}{corner}{}{rectangular}%
\setupToAttribute{#1}{#2}{radius}{radius}{}{0.5ex}%
\setupToAttribute{#1}{#2}{backgroundcorner}{bgcorner}{}{rectangular}%
\setupToAttribute{#1}{#2}{backgroundradius}{bgradius}{}{0.5ex}%
% dimensions
\setupToAttribute{#1}{#2}{rulethickness}{rulethickness}{}{3pt}%
\doifnot{\xmlatt{#1}{height}}{\empty}%
{#2[height=\NumberCollect{"\xmlattdef{#1}{height}{fit}","\the\makeupheight"}]}%
\doifnot{\xmlatt{#1}{width}}{\empty}%
{#2[width=\NumberCollect{"\xmlattdef{#1}{width}{fit}","\the\textwidth"}]}%
% alignment
\setupToAttribute{#1}{#2}{strut}{strut}{}{on}%
\setupToAttribute{#1}{#2}{align}{align}{html}{normal}%
\setupToAttribute{#1}{#2}{align}{valign}{html}{lohi}%
}
% Setups for tables with xtable.
\def\setupxtableparameters#1{%
\setupframeparameters{#1}{\setupxtable}%
\setupToAttribute{#1}{\setupxtable}{foregroundstyle}{style}{style}{\tf}%
\setupToAttribute{#1}{\setupxtable}{offset}{cellpadding}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{columndistance}{cellspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{spaceinbetween}{rowspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{option}{option}{}{}%
}
\startxmlsetups xmlcommon:table
\bgroup
\xmlstripanywhere{#1}{.}
\setupxtable[% Setup defaults
leftmargindistance=0pt,rightmargindistance=0pt,
offset=2pt,height=fit,width=fit,
align={center,lohi},columndistance=0pt]
\setupxtableparameters{#1}
\startlocationbox{#1}
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
\stoplocationbox
\egroup
\stopxmlsetups
\startxmlsetups xmlcommon:tbody
\xmlstripanywhere{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxtablebody
\xmlflush{#1}
\stopxtablebody
\egroup
\stopxmlsetups
\startxmlsetups xmlcommon:tr
\unskip
\xmlstripanywhere{#1}{.}
\unskip
\bgroup
\unskip
\setupxtableparameters{#1}
\unskip
\startxrow
\unskip
=\xmlflush{#1}
\stopxrow
\egroup
\unskip
\stopxmlsetups

\startxmlsetups xmlcommon:td
\unskip
\xmlstrip{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxcell[nc=\xmlattdef{#1}{colspan}{1},nr=\xmlattdef{#1}{rowspan}{1}]
\xmlflush{#1}
\stopxcell
\egroup
\stopxmlsetups

\starttext
\startbuffer[the-table]
<?xml version="1.0" encoding="UTF-8"?>
<root>
<table>
<tbody>
<tr><td>A</td></tr>
<tr><td>B</td></tr>
<tr><td>C</td></tr>
<tr><td>D</td></tr>
</tbody>
</table>
</root>
\stopbuffer
\midaligned{\xmlprocessbuffer{root}{the-table}{}}
\blank
The equalsign (=) is added to \type{\startxmlsetups xmlcommon:tr} in order to 
show the spurious whitespace injected.
\stoptext

___________________________________________________________________________________
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