Interestingly, we should be in the right subtree as this modified example is supposed to demonstrate (we're getting the correct numbers under each index-entry-term, just the terms are incorrect in all but the first case):
\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>4</ext-link> </nav-pointer> </nav-pointer-group> </index-entry> <index-entry> <term>Third</term> <nav-pointer-group> <nav-pointer> <ext-link>5</ext-link> </nav-pointer> <nav-pointer> <ext-link>6</ext-link> </nav-pointer> <nav-pointer> <ext-link>7</ext-link> </nav-pointer> </nav-pointer-group> </index-entry> </index> \stopbuffer \starttext \xmlprocessbuffer{test}{test}{} \stoptext Von: denis.ma...@unibe.ch <denis.ma...@unibe.ch> Gesendet: Montag, 24. Juli 2023 13:38 An: ntg-context@ntg.nl Betreff: [NTG-context] xml: matches always child of other element 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
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________