Hi fellows !
I am returning to you with some XML-TEI issues. I am trying to produce a
MWE that shows how to handle the literary analysis of versification and
how to typeset the results properly. To reach this goal, I turned to the
XML-TEI approach, but I have encountered an issue ...Then, this MWE is
now a M(N)WE ...
• Goal: produce a PDF from a TEI-XML source containing
– original poem
– translation
– commentary
– notes (<note>)
– apparatus (<app><lem><rdg>)
• Desired layout in ConTeXt:
– original text with line numbers
– translation in parallel
– commentary in a third column
– proper rendering of notes and apparatus
• Reason for using TEI:
– separation between content and layout
– reuse of the same TEI source for different typesettings
– scalable workflow for wider scholarly editions
• TEI structure (poem.xml):
– <lg type="orig">, <lg type="trans">, <lg type="comm">
– <l> elements for individual lines
– optional <note> and <app><lem><rdg> elements
– valid XML and valid TEI namespace declaration
Minimal TEI file:
|<?xml version="1.0"encoding="UTF-8"?>
<TEIxmlns="http://www.tei-c.org/ns/1.0"> <text> <body> <lgtype="stanza">
<lgtype="orig"> <l>Sometimes I hear the distant call</l> <ln="2">Of
nights I thought would never fade</l> </lg> <lgtype="trans"> <l>Parfois
j’entends un appel lointain</l> <ln="2">Des nuits que je croyais
éternelles</l> </lg> <lgtype="comm"> <l>Commentary for line 1</l>
<l>Commentary for line 2</l> </lg> </lg> </body> </text> </TEI> |
• Minimal ConTeXt debugging file:
– declares the TEI namespace
– assigns all elements to a debug setup
– defines an entry setup for starting the XML traversal
– calls \xmlprocessfile
%mwe-xmltei-debug.tex
|\setuppapersize[A4]\setupbodyfont[modern,11pt]\xmlnamespace{tei}{http://www.tei-c.org/ns/1.0}
\xxmlsetsetup{main}{*}{tei:all} \startxmlsetups tei:all \type{NODE:
\xmlname{#1} -- TEXT: \xmltext{#1}} \stopxmlsetups
\xmlsetsetup{main}{/}{tei:start} \startxmlsetups tei:start
\xmlflush{main}{/TEI/text/body} \stopxmlsetups \starttext
\xmlprocessfile{main}{poem.xml}{tei:start} \stoptext |
• Expected result:
– the PDF should list TEI nodes (NODE: TEI, NODE: lg, NODE: l, etc.)
– confirms that namespace and setup dispatching work correctly
• Actual problem:
– ConTeXt aborts with the TeX error “You can't use the letter U+0041 A
in horizontal mode”
– this happens before any TEI node is processed
– the setup name appears internally as something like “\18>:tei:start”
– this suggests that the setup identifier is not read as a normal
control sequence at runtime
• Technical implication:
– the entry setup cannot be resolved normally by the XML processor
– the dispatch never reaches the TEI tree
– ConTeXt attempts to execute a malformed control sequence and aborts
Any insights into why the setup name is degraded at runtime, or how to
stabilise the entry point for XML processing in this context, would be
warmly welcome (as I've struggled hours on this issue !).
Best regards,
JP
___________________________________________________________________________________
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
___________________________________________________________________________________