Hello All,

I'm trying to render a table stored in XML JATS format (https://jats.nlm.nih.gov/archiving/) and eventually want to use the <colgroup> tag to setup column aligning from the @align attribute, e.g.,

    \setupTABLE [column] [\xmlpos{#1}] [align=\xmlatt{#1}{align}]

Including \xmlpos{#1} I get double the value returned, i.e.: the first element in colgroup returns 2, the second returns 4 etc.

Below is a MWE to show my issue. I show \xmlpos for each <col> tag in <colgroup>  above the table, which returns 2, 4, 6, 8 but I expected 1, 2, 3, 4. Am I missing something or is there another way I could do this?

~~~~~~~~~~~~
\startbuffer[table]
  <table-wrap>
    <table>
      <colgroup>
        <col align="center" />
        <col align="right" />
        <col />
        <col />
      </colgroup>
      <thead>
        <tr>
          <th>H1 (centre)</th>
          <th>H2 (right)</th>
          <th>H3</th>
          <th>H4</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>A1</td>
          <td>A2</td>
          <td>A3</td>
          <td>A4</td>
        </tr>
        <tr>
          <td>B1</td>
          <td>B2</td>
          <td>B3</td>
          <td>B4</td>
        </tr>
      </tbody>
    </table>
  </table-wrap>
\stopbuffer

\startxmlsetups xml:tabletestsetups
    \xmlsetsetup{#1}{*}{-}
    % tables
    \xmlsetsetup{#1}{table-wrap|table}{xml:*}
    \xmlsetsetup{#1}{thead|tbody|tr|th|td}{xml:table:*}
    \xmlsetsetup{#1}{colgroup|col}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:tabletestsetups}

\startxmlsetups xml:table-wrap
    \startplacetable
        % \contextversion \par
        \xmlflush{#1}
    \stopplacetable
\stopxmlsetups

\startxmlsetups xml:table
    \bTABLE
        \xmlflush{#1}
    \eTABLE
\stopxmlsetups

\startxmlsetups xml:colgroup
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:col
    \xmlpos{#1} \xmlatt{#1}{align}\par
\stopxmlsetups

\startxmlsetups xml:table:thead
    \bTABLEhead
        \xmlflush{#1}
    \eTABLEhead
\stopxmlsetups

\startxmlsetups xml:table:tr
    \bTR
        \xmlflush{#1}
    \eTR
\stopxmlsetups

\startxmlsetups xml:table:th
    \bTH
        \xmlflush{#1}
    \eTH
\stopxmlsetups

\startxmlsetups xml:table:tbody
    \bTABLEbody
        \xmlflush{#1}
    \eTABLEbody
\stopxmlsetups

\startxmlsetups xml:table:td
    \bTC
        \xmlflush{#1}
    \eTC
\stopxmlsetups

\xmlprocessbuffer{main}{table}{}
~~~~~~~~~~~~

All the best,
Ben

Ben Moon
ben@themoons.uk