Dear list,

I have the following way to get text from the current XML node:

  \xmltext{#1}{.}

I would like to have the same results matching the same element.

I thought the command should read, but I don‘t get the right results:

  \xmltext{#1}{../*[match()==lxml.match("#1")]}

Minimal sample here:

  \startbuffer[demo]
  <root>
    <div id="one">
      <p>first</p>
      <p>second</p>
      <p>third</p>
    </div>
    <div id="two">
      <p>First</p>
      <p>Second</p>
      <p>Third</p>
    </div>
  </root>
  \stopbuffer

  \startxmlsetups xml:initialize
    \xmlsetsetup{#1}
      {root|div|p}
      {xml:*}
  \stopxmlsetups

  \xmlregistersetup{xml:initialize}

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

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

  \startxmlsetups xml:p
    \xmlmatch{#1}: \xmltext{#1}{.}\\
    \xmltext{#1}{../*[match()==lxml.match("#1")]}
  \stopxmlsetups

  \starttext
     \xmlprocessbuffer{main}{demo}{}
  \stoptext

How could I match only the current n-th child?

Many thanks for your help,

Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to