[NTG-context] xmlpos values doubled

Pablo Rodriguez oinos at gmx.es
Wed Apr 20 16:53:23 CEST 2022


On 4/20/22 11:51, Ben Moon via ntg-context wrote:
> Hello again,
>
> I wonder whether anyone has some thoughts to help with my problem?
> Either why \xmlpos gives double values or alternatives to arrange my
> table format?

Hi Ben,

I think that both \xmlpos and \xmldepth give weird results.

With this minimal sample:

  \startbuffer[text]
  <doc>first level
  <s>second level
  <ss>third level</ss>
  <ss>third level</ss>
  </s>
  <s>second level
  <ss>third level</ss>
  <ss>third level</ss>
  </s>
  <s>second level
  <ss>third level</ss>
  <ss>third level</ss>
  </s>
  </doc>
  \stopbuffer

  \startxmlsetups xml:text
      \xmlsetsetup{#1}{doc|s|ss}{xml:*}
  \stopxmlsetups

  \xmlregistersetup{xml:text}

  \startxmlsetups xml:doc
      \chapter{\xmlpos{#1}\letterat\xmldepth{#1}: \xmlflush{#1}}
  \stopxmlsetups

  \startxmlsetups xml:s
      \section{\xmlpos{#1}\letterat\xmldepth{#1}: \xmlflush{#1}}
  \stopxmlsetups

  \startxmlsetups xml:ss
      \subsection{\xmlpos{#1}\letterat\xmldepth{#1}: \xmlflush{#1}}
  \stopxmlsetups

  \setuphead[chapter,section,subsection][before=,after=,]
  \starttext
  \xmlprocessbuffer{main}{text}{}
  \stoptext

\xmldepth shows values that I think are +1 than they should be.

\xmlpos counts in pairs and not in units (as you wrote, 2, 4, 6...).

Hans, could you check whether this is working as expected?

Sorry, but if this isn’t a bug, I have no idea of what I may be missing.

Pablo



More information about the ntg-context mailing list