Hello Hans,
just to remind the other issues. The code from xml-mkiv.pdf doesn't work
as expected. Only in \TestMode=2 the index is rendered as supposed.
demo.tex + demo.xml below
Jano
%%%%%%%%%%
% demo.tex
\newcount\TestMode
\TestMode=0 % expansion=xml
%\TestMode=1 % expansion=yes, index, setup
%\TestMode=2 % expansion=yes
\startxmlsetups xml:mysetups
\xmlsetsetup{\xmldocument}{demo|index|content|chapter|title|em}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:mysetups}
% main document
\startxmlsetups xml:demo
\xmlflush{#1}
\subject{contents}
\placelist[chapter][criterium=all]
\subject{index}
\placeregister[index][criterium=all]
\page % else buffer is forgotten when placing header
\stopxmlsetups
\startxmlsetups xml:chapter
\ifcase \TestMode
% xml code travels around
\setuphead[chapter][expansion=xml]
\startchapter[title=eh: \xmltext{#1}{title}]
\or
% index is used for access via setup
\setuphead[chapter][expansion=yes,xmlsetup=xml:title:flush]
\startchapter[title=\xmlgetindex{#1}]
\or
% tex call to xml using index is used
\setuphead[chapter][expansion=yes]
\startchapter[title=hm: \xmlreference{#1}{xml:title:flush}]
\fi
\xmlfirst{#1}{content}
\stopchapter
\stopxmlsetups
\startxmlsetups xml:title:flush
\xmltext{#1}{title}
\stopxmlsetups
% We need to deal with emphasis and the content of the chapter.
\startxmlsetups xml:em
\begingroup\em\xmlflush{#1}\endgroup
\stopxmlsetups
\startxmlsetups xml:content
\xmlflush{#1}
\stopxmlsetups
%A similar approach is followed with the index entries. Watch how we use
the numbered entries variant (in this case we could also have used just
entries and keys.
\startxmlsetups xml:index
\ifcase \TestMode
\setupregister[index][expansion=xml,xmlsetup=]
\setstructurepageregister
[index]
[entries:1=\xmlfirst{#1}{content},
keys:1=\xmltext{#1}{key}]
\or
\setupregister[index][expansion=yes,xmlsetup=xml:index:flush]
\setstructurepageregister
[index]
[entries:1=\xmlgetindex{#1},
keys:1=\xmltext{#1}{key}]
\or
\setupregister[index][expansion=yes,xmlsetup=]
\setstructurepageregister
[index]
[entries:1=\xmlreference{#1}{xml:index:flush},
keys:1=\xmltext{#1}{key}]
\fi
\stopxmlsetups
\startxmlsetups xml:index:flush
\xmlfirst{#1}{content}
\stopxmlsetups
% The file is processed by:
\starttext
\xmlprocessfile{main}{demo.xml}{}
\stoptext
% additional control
%\startxmlsetups xml:ctx:sectionentry
%\xmlflush{#1}
%\stopxmlsetups
%\startxmlsetups xml:ctx:registerentry
%\xmlflush{#1}
%\stopxmlsetups
%%%%%%%%%%
% demo.xml
<?xml version='1.0' ?>
<demo>
<chapter>
<title>Some <em>short</em> title</title>
<content>
zeta
<index>
<key>zeta</key>
<content>zeta again</content>
</index>
alpha
<index>
<key>alpha</key>
<content>alpha <em>again</em></content>
</index>
gamma
<index>
<key>gamma</key>
<content>gamma</content>
</index>
beta
<index>
<key>beta</key>
<content>beta</content>
</index>
delta
<index>
<key>delta</key>
<content>delta</content>
</index>
done!
</content>
</chapter>
</demo>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________