Hi,
I’m getting unexpected results for \xmlpos
With the example below, I was expecting to get the following positions:
1 2 3 4
However the result is: 2 4 6 8, i.e. each time it’s exactly the double.
What am I missing?
Background: I need to define column alignment based on the value of the <col> element inside the colgroup, so I was thinking about something like this :
\xmlmapvalue{colstyle}{dir: rtl}{align=righttolef }
\xmlmapvalue{colstyle}{dir: ltr}{align=lefttoright}
\startxmlsetups xml:table:colgroup:col
\setupTABLE[c][\xmlpos{#1}][\xmlvalue{colstyle}{\xmlatt{#1}{style}}{}]
\stopxmlsetups
Best,
Denis
\startbuffer[test]
<?xml version='1.0' standalone='yes?>
<document>
<table-wrap>
<table>
<colgroup>
<col/>
<col style="dir: rtl"/>
<col style="dir: rtl"/>
<col/>
</colgroup>
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
</tr>
</tbody>
</table>
</table-wrap>
</document>
\stopbuffer
\startxmlsetups xml:test
\xmlsetsetup{\xmldocument}{document}{xml:*}
\xmlsetsetup{#1}{table-wrap}{xml:table-wrap}
\xmlsetsetup{#1}{table}{xml:table}
\stopxmlsetups
\xmlregistersetup{xml:test}
\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:table-wrap
\startplacetable
\xmlflush{#1}
\stopplacetable
\stopxmlsetups
\startxmlsetups xml:table:colgroup
%\xmlvalue{colstyle}{\xmlatt{#1}{style}}{}
\xmlfilter {#1} {/col/command(xml:table:colgroup:col)}
\stopxmlsetups
\startxmlsetups xml:table:colgroup:col
%\xmlvalue{colstyle}{\xmlatt{#1}{style}}{}
\xmlpos {#1}
\stopxmlsetups
\startxmlsetups xml:table
\xmlfilter {#1} {/colgroup/command(xml:table:colgroup)}
\bTABLE
\xmlfilter{#1}{/thead/command(xml:table:thead)}
\xmlfilter{#1}{/tbody/command(xml:table:tbody)}
\eTABLE
\stopxmlsetups
\startxmlsetups xml:table:thead
\bTABLEhead
\xmlfilter{#1}{/tr/command(xml:table:thead:tr)}
\eTABLEhead
\stopxmlsetups
\startxmlsetups xml:table:thead:tr
\bTR
\xmlfilter{#1}{/th/command(xml:table:thead:tr:th)}
\eTR
\stopxmlsetups
\startxmlsetups xml:table:thead:tr:th
\bTH
\xmlflush{#1}
\eTH
\stopxmlsetups
\startxmlsetups xml:table:tbody
\bTABLEbody\xmlfilter{#1}{/tr/command(xml:table:tbody:tr)}\eTABLEbody
\stopxmlsetups
\startxmlsetups xml:table:tbody:tr
\bTR\xmlfilter{#1}{/td/command(xml:table:tbody:tr:td)}\eTR
\stopxmlsetups
\startxmlsetups xml:table:tbody:tr:td
\bTC \xmlflush{#1} \eTC
\stopxmlsetups
\starttext
\xmlprocessbuffer{test}{test}{}
\stoptext