[NTG-context] expansion of xml userdata

Jano Kula jano.kula at gmail.com
Sun Jan 17 21:22:16 CET 2021


Hello to everybody!

\setuphead[section][expansion=yes] expands xml reference to the actual
content in TUC file:

\xmlatt {xml:name::4}{title} → First section

for titles & bookmarks. The same is not true for userdata (mkiv & mkxl). Do
you know how to force expansion of userdata?

MWE attached.

Thank you,
Jano

\startbuffer[doc]
<?xml version "1.0"?>
<document>
    <section title="First section">
        text
    </section>
    <section title="Second section">
        text
    </section>
</document>
\stopbuffer

\setuphead[section][expansion=yes]
\setuplist[section][alternative=command,
                    command=\SectionListCommand]

\define[3]\SectionListCommand{%
   {\bf#1\par
   title: #2\par
   usertitle: \structurelistuservariable{usertitle}}\par
   \blank
   \endgraf}

\startxmlsetups xml:name
    \xmlsetsetup{\xmldocument}{document|section}{xml:name:*}
\stopxmlsetups
\xmlregistersetup{xml:name}

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

\startxmlsetups xml:name:section
    \startsection[title=\xmlatt{#1}{title}]
                 [usertitle=\xmlatt{#1}{title}]
    \stopsection
\stopxmlsetups

\starttext
\placelist[section]
\xmlprocessbuffer{xml:name}{doc}{}
\stoptext
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20210117/55ebb352/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xml-one-file-head-toc.tex
Type: application/octet-stream
Size: 949 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20210117/55ebb352/attachment.obj>


More information about the ntg-context mailing list