Hi,

 

I must be missing something obvious, but in this example the pattern for <term> always matches the first element, not the one under the current <index-entry>.

Interestingly, using xml:index-entry-2 instead of the normal version matches correctly… Any hints what is going off the rails here?

 

Best,

Denis

 

\startxmlsetups xml:test

                \xmlsetsetup{#1}{*}{-}

                \xmlsetsetup{#1}{index}{xml:*}

                \xmlsetsetup{#1}{index-entry}{xml:index-entry}

                %\xmlsetsetup{#1}{index-entry}{xml:index-entry-2}

                \xmlsetsetup{#1}{term}{xml:index-entry-term}

                \xmlsetsetup{#1}{nav-pointer-group}{xml:*}

                \xmlsetsetup{#1}{nav-pointer}{xml:nav-pointer}

                \xmlsetsetup{#1}{nav-pointer/ext-link}{xml:nav-pointer-link}

\stopxmlsetups

 

\xmlregisterdocumentsetup{test}{xml:test}

 

% Index

 

\startxmlsetups xml:book-back

                \xmlflush{#1}

\stopxmlsetups

 

\startxmlsetups xml:index

  \startsectionlevel[title={\xmlfilter{#1}{/index-title-group/title/command(xml:index-title)}},]

                \xmlflush{#1}

  \stopsectionlevel

\stopxmlsetups

 

\startxmlsetups xml:index-title

                \xmlflush{#1}

\stopxmlsetups

 

\definedescription[indexentry]

                [alternative=top,

                headstyle=normal,

    headcommand=\hskip-1cm,

                margin=1cm,

                inbetween=,

                ]

 

\startxmlsetups xml:index-entry

                \xmlflush{#1}

\stopxmlsetups

   

\startxmlsetups xml:index-entry-2

    \xmlfilter{#1}{/term/command(xml:index-entry-term)}%

    \xmlverbatim{#1}

\stopxmlsetups

   

\startxmlsetups xml:index-entry-term

                \indexentry{\xmlflush{#1}}

\stopxmlsetups

 

\startxmlsetups xml:nav-pointer-group

                \xmlconcat{#1}{/nav-pointer}{, }

\stopxmlsetups

 

\startxmlsetups xml:nav-pointer

                \xmlflush{#1}

\stopxmlsetups

 

\startxmlsetups xml:nav-pointer-link

                \xmlflush{#1}

\stopxmlsetups

 

\startbuffer[test]

<?xml version="1.0" encoding="UTF-8"?>

<index>

      <index-title-group>

        <title>Index</title>

      </index-title-group>

      <index-entry>

        <term>First</term>

        <nav-pointer-group>

          <nav-pointer>

            <ext-link>1</ext-link>

          </nav-pointer>

          <nav-pointer>

            <ext-link>2</ext-link>

          </nav-pointer>

          <nav-pointer>

            <ext-link>3</ext-link>

          </nav-pointer>

        </nav-pointer-group>

      </index-entry>

      <index-entry>

        <term>Second</term>

        <nav-pointer-group>

          <nav-pointer>

            <ext-link>1</ext-link>

          </nav-pointer>

        </nav-pointer-group>

      </index-entry>

      <index-entry>

        <term>Third</term>

        <nav-pointer-group>

          <nav-pointer>

            <ext-link>1</ext-link>

          </nav-pointer>

        </nav-pointer-group>

      </index-entry>

</index>

\stopbuffer

 

\starttext

 

\xmlprocessbuffer{test}{test}{}

 

\stoptext