On 8/17/2025 2:08 PM, Thomas A. Schmitz wrote:
On 14. Aug 2025, at 18:57, Hans Hagen <[email protected]> wrote:
wrt multiple setups:
I have found a less complex way and am making good progress, I think. There is
one problem that I’m running into for the umpteenth time (when I search the
list archives, I find my own questions of 10 years ago…). Bear with me when I
include a few code snippets. Here’s what I have so far; most of it works except
the last step:
current_file = xml.attribute (t, "/include", "href", "X”) -- retrieve file
name: works
for e in xml.collected (xml.load (current_file), "chapter") do -- load file
from its root element: works
ch_title = xml.text (lxml.id (e), "/chaptertitle”) -- retrieve chapter
title: works
for note in xml.collected (lxml.id (e), "/**/note") do -- collect all notes,
disregarding everything else: works
note_ref = xml.attribute (lxml.id (note), "/", "xml:id", "Y”) -- retrieve
attribute xml:id: works
note_text = xml.first (lxml.id (note), "/“) -- collect content of note
end
end
The one remaining problem is typesetting the content of the note. Whatever I
try, I get the content as a serialized string, not as processed xml. What I
have tried so far:
lxml.flush (lxml.id (note))
lxml.flush (lxml.id (note_text))
xml.cprint (lxml.id (note))
xml.cprint (lxml.id (note_text))
xml.sprint (lxml.id (note))
xml.sprint (lxml.id (note_text))
lxml.command (lxml.id (note), ".", "xml:note:typeset")
lxml.command (lxml.id (note_text), ".", "xml:note:typeset")
with this definition:
\startxmlsetups xml:note:typeset
\xmlflush {#1}
\stopxmlsetups
I must be missing a command that applies my xml setup to the content of note or
of note_text. Any pointers here?
I assume you checked
\xmlcommand
\xmlfilter
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
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
___________________________________________________________________________________