I would like to use the header of a table as a section for the TOC (while parsing an XML to pdf)

\startxmlsetups xml:table

\startxmlsetups xml:tr

\startxmlsetups xml:h2

\startxmlsetups xml:th
\doifnumberelse {\xmlatt{#1}{colspan}}
            {\bTD [nc=\xmlatt{#1}{colspan},background=color,backgroundcolor=UniGelb] 

Part of the XHTML

                <table class="module">
                        <th colspan="2">
                            <h2 class="">

The Problem: The section part gets flushed 3 times so the TOC is broken and the numbers are wrong:

structure       > sectioning > section @ level 3 : 0.0.1 -> \xmlflush {main::9}
structure       > sectioning > section @ level 3 : 0.0.2 -> \xmlflush {main::9}
structure       > sectioning > section @ level 3 : 0.0.3 -> \xmlflush {main::9}

Result: Broken TOC with Section "3 Section" instead of "1 Section"

closed as unclear what you're asking by Henri Menke, Stefan Pinnow, TeXnician, Troy, CarLaTeX Jul 12 '17 at 7:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See minimal working example (MWE). – Henri Menke Jul 12 '17 at 5:47