XML/TEI parsing issue in LMTX: lxp.lom not found (small test case)
Hello everyone, I am currently trying to build a minimal example showing how to process TEI-XML inside ConTeXt (see here for explanations : https://wiki.contextgarden.net/TEI_xml). To do this I created two small test files: 1. cicero-sample-tei.xml (a very small TEI fragment), which is : % cicero-sample-tei.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Exemple simplifié sans espace de noms TEI --> <TEI> <text> <body> <div type="edition" xml:lang="la"> <head>Exemple d'édition critique (Cicero)</head> <p> <persName ref="#cicero">Marcus Tullius Cicero</persName> in <placeName ref="#roma">Roma</placeName> <app> <lem wit="#A">virtutem magnam</lem> <rdg wit="#B">virtutem magni</rdg> </app> laudavit. </p> <note xml:lang="fr"> L'apparat signale une variation sur l'adjectif qualifiant <code>virtus</code>. </note> </div> <div type="translation" xml:lang="fr"> <head>Traduction française (exemple)</head> <p> Marcus Tullius Cicéron, à Rome, loua la vertu. </p> </div> </body> </text> </TEI> 2.**cicero-tei-demo.tex (a ConTeXt file using Lua to parse the XML), which is : % cicero-tei-demo.tex \setuppapersize[A5] \setupbodyfont[latin-modern] \starttext \startluacode local lom = require("lxp.lom") -- Fonctions utilitaires local function readfile(name) local f = assert(io.open(name,"r")) local c = f:read("*all") f:close() return c end local function find_child(node, tag) for _, child in ipairs(node) do if type(child) == "table" and child.tag == tag then return child end end return nil end local function find_children(node, tag) local t = {} for _, child in ipairs(node) do if type(child) == "table" and child.tag == tag then t[#t+1] = child end end return t end local function find_div_by_type(body, dtype) for _, child in ipairs(body) do if type(child) == "table" and child.tag == "div" and child.attr and child.attr.type == dtype then return child end end return nil end local function text_content(node) local parts = {} for _, item in ipairs(node) do if type(item) == "string" then parts[#parts+1] = item elseif type(item) == "table" and item[1] and type(item[1]) == "string" then parts[#parts+1] = item[1] end end return table.concat(parts, " ") end -- Index simples (collections de noms) local persons, places = {} local function add_unique(tbl, s) if not s or s == "" then return end tbl._seen = tbl._seen or {} if not tbl._seen[s] then tbl._seen[s] = true tbl[#tbl+1] = s end end -- Lecture du fichier TEI local xml_data = readfile("cicero-sample-tei.xml") local parsed = assert(lom.parse(xml_data)) local TEI = parsed[1] local text = find_child(TEI, "text") local body = find_child(text, "body") local edition_div = find_div_by_type(body, "edition") local head_edition = find_child(edition_div, "head") local p_edition = find_child(edition_div, "p") local extra_note = find_child(edition_div, "note") local trans_div = find_div_by_type(body, "translation") local head_trans = trans_div and find_child(trans_div, "head") local p_trans = trans_div and find_child(trans_div, "p") -- Traitement éditorial du paragraphe latin local function process_edition_paragraph(pnode) for _, item in ipairs(pnode) do if type(item) == "string" then context(item) elseif type(item) == "table" then if item.tag == "persName" then local n = text_content(item) add_unique(persons, n) context("\\sc{" .. n .. "} ") elseif item.tag == "placeName" then local n = text_content(item) add_unique(places, n) context("\\em{" .. n .. "} ") elseif item.tag == "app" then local lem = find_child(item, "lem") local rdgs = find_children(item, "rdg") context(text_content(lem)) if #rdgs > 0 then local note_parts = {} for _, r in ipairs(rdgs) do local wit = r.attr and r.attr.wit or "" local txt = text_content(r) if wit ~= "" then note_parts[#note_parts+1] = wit .. ": " .. txt else note_parts[#note_parts+1] = txt end end context.footnote(table.concat(note_parts, "; ")) end elseif item.tag == "note" then context.footnote(text_content(item)) else context(text_content(item)) end end end end -- Composition du document context.chapter(head_edition[1]) process_edition_paragraph(p_edition) context.par() if extra_note then context.footnote(extra_note[1]) end if head_trans and p_trans then context.blank() context.subject(head_trans[1]) context(p_trans[1]) context.par() end -- Mini-index context.blank() context.section("Personnes mentionnées") for _, p in ipairs(persons) do context.par() context(p) end context.blank() context.section("Lieux mentionnés") for _, l in ipairs(places) do context.par() context(l) end \stopluacode \stoptext The goal is simply to read the XML file, extract a few nodes, and print them in ConTeXt — nothing advanced, just a proof of concept to understand the workflow. However, when compiling the TeX file with LMTX, ConTeXt aborts immediately with the following error: |lua error: module'lxp.lom'notfound: no field package.preload['lxp.lom'] no file '.../lua/lxp/lom.lua'... | So the problem appears before any XML processing takes place: LMTX cannot load |lxp.lom|. I understand that LMTX uses a sandboxed Lua environment, so maybe |lxp| is not part of the allowed modules anymore. My question is therefore quite simple: Is there a recommended way (or example) to parse XML/TEI within LMTX today, given that |lxp.lom| is unavailable? Should one use the built-in ConTeXt XML tools instead (|lxml|, |xml.filter|, etc.)? Any advice or pointer to an up-to-date example would be very helpful. Thank you very much, JP
Am 29.11.25 um 13:44 schrieb Jean-Pierre Delange via ntg-context:
local lom = require("lxp.lom")
|lua error: module'lxp.lom'notfound: no field package.preload['lxp.lom'] no file '.../lua/lxp/lom.lua'... |
When ConTeXt can’t find your lua library, everything else makes no sense to share (while I find your project interesting). Where is this file? Why do you think ConTeXt should be able to find it without a path? If it’s within one of the texmf trees, did you run "mtxrun --generate"? Mayybe try to delete the caches – in case you installed ConTeXt (or TeX live) as root/Administrator, there might be a conflict with user caches. Hraban
Thanks Hraban for your reply! No, I'm not as root, and my directories and work files are in the distribution tree in a directory called “Work”... I didn't think to clear the cache or use mtxrun --generate. If I encounter this problem again, I'll code this example in a different way... As always, JP Le 29/11/2025 à 14:10, Henning Hraban Ramm a écrit :
When ConTeXt can’t find your lua library, everything else makes no sense to share (while I find your project interesting).
Where is this file? Why do you think ConTeXt should be able to find it without a path?
If it’s within one of the texmf trees, did you run "mtxrun --generate"? Mayybe try to delete the caches – in case you installed ConTeXt (or TeX live) as root/Administrator, there might be a conflict with user caches.
I fellows (and Hraban) ! I looked into how to use only the XML embedded by ConTeXt. And I found the solution for a simple (and functional) MWE. Now I just need to apply the principle to a slightly more complex example. Here are the two files used to display the plain text, its translation, and the footnote. 1. the xml file 'cicero-sample-tei.xml' : <?xml version="1.0" encoding="UTF-8"?> <TEI> <text> <body> <div type="edition" xml:lang="la"> <head>Exemplum Ciceronis</head> <p> <persName>Marcus Tullius Cicero</persName> in <placeName>Arpino</placeName> natus est. <note>Simple note.</note> </p> </div> <div type="translation" xml:lang="fr"> <head>Traduction française</head> <p>Cicéron naquit à Arpinum.</p> </div> </body> </text> </TEI> 2. The ConTeXt file, cicero-tei-setup.tex % cicero-tei-setup.tex \setuppapersize[A5] \setupbodyfont[latin-modern] % Load the TEI xml file \xmlload{cicero}{cicero-sample-tei.xml}{} \starttext % 1. Title of edition (head of the "edition" part) \chapter{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/head}} % 2. Paragraphe latin, with manual configuration % % <persName> -> petites capitales % <placeName> -> italique % <note> -> note de bas de page % \sc{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/persName}} \space in \em{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/placeName}} \space natus est.\footnote{% \xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/note}% } \blank[2*big] % 3. Translation tiltle \subject{\xmltext{cicero}{/TEI/text/body/div[@type='translation']/head}} % 4. Translation Paragraph \xmltext{cicero}{/TEI/text/body/div[@type='translation']/p} \stoptext I'm trying to develop some documentation on processing multilingual texts with XML-TEI... I hope I'll get somewhere! JP Le 29/11/2025 à 14:10, Henning Hraban Ramm a écrit :
Am 29.11.25 um 13:44 schrieb Jean-Pierre Delange via ntg-context:
local lom = require("lxp.lom")
|lua error: module'lxp.lom'notfound: no field package.preload['lxp.lom'] no file '.../lua/lxp/lom.lua'... |
When ConTeXt can’t find your lua library, everything else makes no sense to share (while I find your project interesting).
Where is this file? Why do you think ConTeXt should be able to find it without a path?
If it’s within one of the texmf trees, did you run "mtxrun --generate"? Mayybe try to delete the caches – in case you installed ConTeXt (or TeX live) as root/Administrator, there might be a conflict with user caches.
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________
Hi ConTeXters ! I reply to myself regarding the issue of compiling tex-xml-tei files. ConTeXt was complaining that it could not find the ‘lxp.lom’ module, which is actually a Lua module... The reason was that I was compiling with LMTX and not with MKIV. All I had to do was run the command: context --luatex myfile.tex and the complaint disappeared. I would like to take this opportunity to ask Hans: is it a scientific and demonstrable fact that the implementation of Luatex in ConTeXt-LMTX left out this ‘lpx.lom’? Thank you very much, JP Le 30/11/2025 à 09:00, Jean-Pierre Delange via ntg-context a écrit :
I fellows (and Hraban) !
I looked into how to use only the XML embedded by ConTeXt. And I found the solution for a simple (and functional) MWE. Now I just need to apply the principle to a slightly more complex example. Here are the two files used to display the plain text, its translation, and the footnote.
1. the xml file 'cicero-sample-tei.xml' :
<?xml version="1.0" encoding="UTF-8"?> <TEI> <text> <body>
<div type="edition" xml:lang="la"> <head>Exemplum Ciceronis</head> <p> <persName>Marcus Tullius Cicero</persName> in <placeName>Arpino</placeName> natus est. <note>Simple note.</note> </p> </div>
<div type="translation" xml:lang="fr"> <head>Traduction française</head> <p>Cicéron naquit à Arpinum.</p> </div>
</body> </text> </TEI>
2. The ConTeXt file, cicero-tei-setup.tex
% cicero-tei-setup.tex
\setuppapersize[A5]
\setupbodyfont[latin-modern]
% Load the TEI xml file
\xmlload{cicero}{cicero-sample-tei.xml}{}
\starttext
% 1. Title of edition (head of the "edition" part)
\chapter{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/head}}
% 2. Paragraphe latin, with manual configuration
%
% <persName> -> petites capitales
% <placeName> -> italique
% <note> -> note de bas de page
%
\sc{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/persName}}
\space in
\em{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/placeName}}
\space natus est.\footnote{%
\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/note}%
}
\blank[2*big]
% 3. Translation tiltle
\subject{\xmltext{cicero}{/TEI/text/body/div[@type='translation']/head}}
% 4. Translation Paragraph
\xmltext{cicero}{/TEI/text/body/div[@type='translation']/p}
\stoptext
I'm trying to develop some documentation on processing multilingual texts with XML-TEI... I hope I'll get somewhere!
JP
Le 29/11/2025 à 14:10, Henning Hraban Ramm a écrit :
Am 29.11.25 um 13:44 schrieb Jean-Pierre Delange via ntg-context:
local lom = require("lxp.lom")
|lua error: module'lxp.lom'notfound: no field package.preload['lxp.lom'] no file '.../lua/lxp/lom.lua'... |
When ConTeXt can’t find your lua library, everything else makes no sense to share (while I find your project interesting).
Where is this file? Why do you think ConTeXt should be able to find it without a path?
If it’s within one of the texmf trees, did you run "mtxrun --generate"? Mayybe try to delete the caches – in case you installed ConTeXt (or TeX live) as root/Administrator, there might be a conflict with user caches.
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist :ntg-context@ntg.nl /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 ___________________________________________________________________________________
On 11/30/2025 9:24 PM, Jean-Pierre Delange via ntg-context wrote:
Hi ConTeXters !
I reply to myself regarding the issue of compiling tex-xml-tei files. ConTeXt was complaining that it could not find the ‘lxp.lom’ module, which is actually a Lua module... The reason was that I was compiling with LMTX and not with MKIV. All I had to do was run the command: context --luatex myfile.tex and the complaint disappeared. I would like to take this opportunity to ask Hans: is it a scientific and demonstrable fact that the implementation of Luatex in ConTeXt-LMTX left out this ‘lpx.lom’?
mkxl (lmtx) and mkiv have theit own cache and therefore their own database I have no clue what lpx.lom is but do you need something that is not already in context xml support? (We try tbe self-contained.) 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 -----------------------------------------------------------------
Hans, Thank you for your clarification ! Just to answer your question: 'lxp.lom' is not something specific to ConTeXt — it comes from LuaExpat, a very common XML parser used in many Lua examples and libraries. When writing a small didactic TEI-demo in MkIV (my purpose is to document ConTeXt Garden and some pages on TEI-XML for a Wikibook in French, which I'm currently writing), I instinctively used it because it provides a very simple Lua object model (tag attr, array-like children) , which is handy for beginners experimenting with XML in Lua. I lately understand that ConTeXt aims to remain completely self-contained, and that the internal XML machinery should be preferred. The failure occurred simply because 'lxp.lom' is not part of the standalone environment, both in MkIV and in LMTX. No problem at all: I will rewrite the TEI example using ConTeXt’s native XML interface(\xmlload, xml-first, xml-text, etc.). This will make it fully portable across both MkIV and LMTX. Thanks again ! JP Le 30/11/2025 à 21:45, Hans Hagen via ntg-context a écrit :
On 11/30/2025 9:24 PM, Jean-Pierre Delange via ntg-context wrote:
Hi ConTeXters !
I reply to myself regarding the issue of compiling tex-xml-tei files. ConTeXt was complaining that it could not find the ‘lxp.lom’ module, which is actually a Lua module... The reason was that I was compiling with LMTX and not with MKIV. All I had to do was run the command: context --luatex myfile.tex and the complaint disappeared. I would like to take this opportunity to ask Hans: is it a scientific and demonstrable fact that the implementation of Luatex in ConTeXt-LMTX left out this ‘lpx.lom’?
mkxl (lmtx) and mkiv have theit own cache and therefore their own database
I have no clue what lpx.lom is but do you need something that is not already in context xml support? (We try tbe self-contained.)
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 : ntg-context@ntg.nl / 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 ___________________________________________________________________________________
On 12/1/2025 12:06 AM, Jean-Pierre Delange via ntg-context wrote:
Hans,
Thank you for your clarification ! Just to answer your question: 'lxp.lom' is not something specific to ConTeXt — it comes from LuaExpat, a very common XML parser used in many Lua examples and libraries. When writing a small didactic TEI-demo in MkIV (my purpose is to document ConTeXt Garden and some pages on TEI-XML for a Wikibook in French, which I'm currently writing), I instinctively used it because it provides a very simple Lua object model (tag attr, array-like children) , which is handy for beginners experimenting with XML in Lua.
I lately understand that ConTeXt aims to remain completely self- contained, and that the internal XML machinery should be preferred. The failure occurred simply because 'lxp.lom' is not part of the standalone environment, both in MkIV and in LMTX.
No problem at all: I will rewrite the TEI example using ConTeXt’s native XML interface(\xmlload, xml-first, xml-text, etc.). This will make it fully portable across both MkIV and LMTX.
The built in interface has been around more or less from the start and is quite integrated (you can also use the xml processing code from the lua end if needed as is also sits in mtxrun). Integration has advantages for dealing with special characters, entities etc. It's also quite efficient and fast (my collegue needs it for some math books where thousands of xml files have to be loaded runtime without much noticable overhead so those are our benchmarks). For those who need it, there is also synctex support for loaded xml files. You can also find examples / replies in the mail archive by Thomas, Massi etc who use advanced xml processing for books, lecture notes etc. so the interfaces are rather stable and tested. ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hi Jean-Pierre,
Why do you use \xmlload etc? Perhaps you could tell us a bit more about your use case?
In any case, I'd use the example in the mkiv-xml as a starting point and adapt that (example below). You can see that this works in a declerative way. You essentially map source nodes to the target document rather than rebuilding the document manually in tex and pulling data in where needed as in your example (obviously, there are situations where you might want to do that, but I don't know if TEI processing is a good use case for that).
Best,
Denis
%%%%%%%% TEI-Example %%%%%%%%%%%%%%%%%%%%%%%
\startxmlsetups xml:TEIsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{TEI|text|body}{xml:*}
\xmlsetsetup{#1}{p|persName|placeName|note}{xml:*}
\xmlsetsetup{#1}{div[@type='edition']}{xml:div-edition}
\xmlsetsetup{#1}{div[@type='translation']}{xml:div-translation}
\stopxmlsetups
\xmlregisterdocumentsetup{TEI}{xml:TEIsetups}
\startxmlsetups xml:TEI
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:text
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:body
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:div-edition
\chapter{\xmltext{#1}{head}}
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:div-translation
\subject{\xmltext{#1}{head}}
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:p
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:persName
\sc{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:placeName
\emph{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:note
\footnote{\xmlflush{#1}}
\stopxmlsetups
\startbuffer[TEI]
<?xml version="1.0" encoding="UTF-8"?>
<TEI>
<text>
<body>
<div type="edition" xml:lang="la">
<head>Exemplum Ciceronis</head>
<p>
<persName>Marcus Tullius Cicero</persName>
in
<placeName>Arpino</placeName>
natus est.
<note>Simple note.</note>
</p>
</div>
<div type="translation" xml:lang="fr">
<head>Traduction française</head>
<p>Cicéron naquit à Arpinum.</p>
</div>
</body>
</text>
</TEI>
\stopbuffer
\starttext
\xmlprocessbuffer{TEI}{TEI}{}
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Von: Jean-Pierre Delange via ntg-context
Hi Denis, Many thanks for your message and for the example you shared. You are absolutely right to ask why I used\xmlload and targeted extraction in my first attempts. My initial goal was simply to build a small pedagogical demonstration for a French Wikibook on ConTeXt (a chapter on TEI-XML approach with ConTeXt). I therefore started with a more “manual” and imperative style, to make clear what happens at each step and to keep the entry point as simple as possible for beginners. Your example, which follows the declarative mapping approach provided by ConTeXt’s XML interface, is indeed much closer to what I ultimately need for larger or more realistic TEI samples. It is also more idiomatic ConTeXt and definitely better suited for users who want to structure a whole document rather than extract small pieces of XML. I’ll therefore integrate your approach in the didactic material, after the minimal introductory example. Thank you again for pointing me in the right direction ! Best , Jean-Pierre Le 01/12/2025 à 10:29, denismaier@mailbox.org a écrit :
Hi Jean-Pierre,
Why do you use \xmlload etc? Perhaps you could tell us a bit more about your use case?
In any case, I'd use the example in the mkiv-xml as a starting point and adapt that (example below). You can see that this works in a declerative way. You essentially map source nodes to the target document rather than rebuilding the document manually in tex and pulling data in where needed as in your example (obviously, there are situations where you might want to do that, but I don't know if TEI processing is a good use case for that).
Best,
Denis
%%%%%%%% TEI-Example %%%%%%%%%%%%%%%%%%%%%%%
\startxmlsetups xml:TEIsetups
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{TEI|text|body}{xml:*}
\xmlsetsetup{#1}{p|persName|placeName|note}{xml:*}
\xmlsetsetup{#1}{div[@type='edition']}{xml:div-edition}
\xmlsetsetup{#1}{div[@type='translation']}{xml:div-translation}
\stopxmlsetups
\xmlregisterdocumentsetup{TEI}{xml:TEIsetups}
\startxmlsetups xml:TEI
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:text
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:body
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:div-edition
\chapter{\xmltext{#1}{head}}
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:div-translation
\subject{\xmltext{#1}{head}}
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:p
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:persName
\sc{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:placeName
\emph{\xmlflush{#1}}
\stopxmlsetups
\startxmlsetups xml:note
\footnote{\xmlflush{#1}}
\stopxmlsetups
\startbuffer[TEI]
<?xml version="1.0" encoding="UTF-8"?>
<TEI>
<text>
<body>
<div type="edition" xml:lang="la">
<head>Exemplum Ciceronis</head>
<p>
<persName>Marcus Tullius Cicero</persName>
in
<placeName>Arpino</placeName>
natus est.
<note>Simple note.</note>
</p>
</div>
<div type="translation" xml:lang="fr">
<head>Traduction française</head>
<p>Cicéron naquit à Arpinum.</p>
</div>
</body>
</text>
</TEI>
\stopbuffer
\starttext
\xmlprocessbuffer{TEI}{TEI}{}
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*Von:*Jean-Pierre Delange via ntg-context
*Gesendet:* Sonntag, 30. November 2025 21:25 *An:* ntg-context@ntg.nl *Cc:* Jean-Pierre Delange *Betreff:* [NTG-context] Re: XML/TEI parsing issue in LMTX: lxp.lom not found (small test case) Hi ConTeXters !
I reply to myself regarding the issue of compiling tex-xml-tei files. ConTeXt was complaining that it could not find the ‘lxp.lom’ module, which is actually a Lua module... The reason was that I was compiling with LMTX and not with MKIV. All I had to do was run the command: context --luatex myfile.tex and the complaint disappeared. I would like to take this opportunity to ask Hans: is it a scientific and demonstrable fact that the implementation of Luatex in ConTeXt-LMTX left out this ‘lpx.lom’?
Thank you very much,
JP
Le 30/11/2025 à 09:00, Jean-Pierre Delange via ntg-context a écrit :
I fellows (and Hraban) !
I looked into how to use only the XML embedded by ConTeXt. And I found the solution for a simple (and functional) MWE. Now I just need to apply the principle to a slightly more complex example. Here are the two files used to display the plain text, its translation, and the footnote.
1. the xml file 'cicero-sample-tei.xml' :
<?xml version="1.0" encoding="UTF-8"?> <TEI> <text> <body>
<div type="edition" xml:lang=" <xml:lang=>la"> <head>Exemplum Ciceronis</head> <p> <persName>Marcus Tullius Cicero</persName> in <placeName>Arpino</placeName> natus est. <note>Simple note.</note> </p> </div>
<div type="translation" xml:lang=" <xml:lang=>fr"> <head>Traduction française</head> <p>Cicéron naquit à Arpinum.</p> </div>
</body> </text> </TEI>
2. The ConTeXt file, cicero-tei-setup.tex
% cicero-tei-setup.tex
\setuppapersize[A5]
\setupbodyfont[latin-modern]
% Load the TEI xml file
\xmlload{cicero}{cicero-sample-tei.xml}{}
\starttext
% 1. Title of edition (head of the "edition" part)
\chapter{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/head}}
% 2. Paragraphe latin, with manual configuration
%
% <persName> -> petites capitales
% <placeName> -> italique
% <note> -> note de bas de page
%
\sc{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/persName}}
\space in
\em{\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/placeName}}
\space natus est.\footnote{%
\xmltext{cicero}{/TEI/text/body/div[@type='edition']/p/note}%
}
\blank[2*big]
% 3. Translation tiltle
\subject{\xmltext{cicero}{/TEI/text/body/div[@type='translation']/head}}
% 4. Translation Paragraph
\xmltext{cicero}{/TEI/text/body/div[@type='translation']/p}
\stoptext
I'm trying to develop some documentation on processing multilingual texts with XML-TEI... I hope I'll get somewhere!
JP
Le 29/11/2025 à 14:10, Henning Hraban Ramm a écrit :
Am 29.11.25 um 13:44 schrieb Jean-Pierre Delange via ntg-context:
local lom = require("lxp.lom")
|lua error: module'lxp.lom'notfound: no field package.preload['lxp.lom'] no file '.../lua/lxp/lom.lua'... |
When ConTeXt can’t find your lua library, everything else makes no sense to share (while I find your project interesting).
Where is this file? Why do you think ConTeXt should be able to find it without a path?
If it’s within one of the texmf trees, did you run "mtxrun --generate"? Mayybe try to delete the caches – in case you installed ConTeXt (or TeX live) as root/Administrator, there might be a conflict with user caches.
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist :ntg-context@ntg.nl /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
___________________________________________________________________________________
participants (4)
-
denismaier@mailbox.org -
Hans Hagen -
Henning Hraban Ramm -
Jean-Pierre Delange