Hi Wolfgang,

powerful and elegant, as always! I think I have a solution with xml; I will have to test it more extensively with my complex real file; but here comes, also for Hraban (if it works in real life, I'll add it to the wiki...).

Thanks a lot!

Thomas

\startbuffer[test]
<document>
  <chapter>
    <p>Dummy text.<indexentry key="Dummy1"/><footnote
    id="chapter1:ftn1">Dummy footnote.<indexentry
    key="footnote1"/></footnote></p>
  </chapter>
  <chapter>
    <p>Dummy text.<indexentry key="Dummy2"/><footnote
    id="chapter1:ftn1">Dummy footnote.<indexentry
    key="footnote2"/></footnote></p>
  </chapter>
  <index/>
</document>
\stopbuffer

\startxmlsetups xml:testsetups
  \xmlsetsetup{#1}{*}{-}
  \xmlsetsetup{#1}{document|chapter|p|footnote|indexentry|index}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

\startxmlsetups xml:chapter
  \xmlflush {#1} \page
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush {#1} \par
\stopxmlsetups

\startxmlsetups xml:footnote
  \footnote[\xmlatt{#1}{id}]{\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:indexentry
  \xmldoiftext {#1} {ancestor::footnote}
{\setregisterentry [index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}][footnote={\rawcountervalue[footnote]}]}

{\setregisterentry[index][keys:1=\xmlatt{#1}{key},entries:1=\xmlatt{#1}{key}]}
\stopxmlsetups

\startxmlsetups xml:index
  \page \placeregister [index]
\stopxmlsetups

\def\IndexPageCommand#1%
  {#1\doifsomething
     {\currentregisterpageuserdata{footnote}}
     {\high{\currentregisterpageuserdata{footnote}}}}

\setupregister[index][pagecommand=\IndexPageCommand]
\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext




On 5/3/24 12:18, Wolfgang Schuster wrote:
You can play with the following example, the main point use to use the \setregisterentry command and pass the footnote counter with the third (optional) argument.

\def\IndexPageCommand#1%
   {#1\doifsomething
      {\currentregisterpageuserdata{footnote}}
      {\high{\currentregisterpageuserdata{footnote}}}}

\setupregister[index][pagecommand=\IndexPageCommand]

\starttext

\dorecurse{200}
{\samplefile{lorem}\expanded{\setregisterentry[index][entries=\recurselevel]}%
\samplefile{lorem}\footnote{xxx\expanded{\setregisterentry[index][entries=\recurselevel][footnote={\rawcountervalue[footnote]}]}}%
    \samplefile{lorem}}

\page \placeindex

\stoptext

Wolfgang

--
Prof. Dr. Thomas A. Schmitz
Institut für Klassische und Romanische Philologie
Universität Bonn
Rabinstr. 8
53111 Bonn
http://www.philologie.uni-bonn.de/de/personal/schmitz

___________________________________________________________________________________
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