Il 16/11/22 18:33, Thomas A. Schmitz via ntg-context ha scritto:
\startbuffer[test]
<document>
<topics>
<topic t:id="test1">
<title>This is the first test</title>
<date>22/11/16</date>
</topic>
<topic t:id="test2">
<title>This is the second test</title>
<date>22/11/17</date>
</topic>
</topics>
<chapters>
<chapter ch:id="test1">
<content>
This will be the content of the <emph>first</emph> chapter.
</content>
</chapter>
<chapter ch:id="test2">
<content>
This will be the content of the <emph>second</emph> chapter.
</content>
</chapter>
</chapters>
</document>
\stopbuffer
\startxmlsetups xml:testsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{document|chapters|chapter|content|emph}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:document
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:chapters
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:chapter
\xmlfunction {#1} {chapter}
\xmlflush {#1}
\stopxmlsetups
\startxmlsetups xml:chapter:content
\xmltext {#1} {content}
\stopxmlsetups
\startxmlsetups xml:emph
{\em \xmlflush {#1}}
\stopxmlsetups
\startluacode
function xml.functions.chapter (t)
local ch_id = t.at.ch:id
local ch_id = t.at["ch:id"]
local metadata = xml.filter (t,
'../../topics/topic[@t:id=="%s"]', ch_id)
print (inspect(metadata))
lxml.command(t, ".", "xml:chapter:content")
context.par ()
context (ch_id)
context.par ()
end
\stopluacode
Best wishes,
Massi
___________________________________________________________________________________
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
___________________________________________________________________________________