Hi,
it actually depends on what you do ... anyway here is some insight (as xml-tex old-timer you'll probably recognize the madness)
What I am mostly trying to do is to have as much of the xml processing in lua as possible.
% \enabletrackers[context*]
\starttext
% here is your missing mwe
Yes, sorry about that. My question was intended to be more of an documentation-related one. Using your MWE as guideline, my minimal file looks like this: % BEGIN ENVIRONMENT \startluacode function xml.functions.document(t) lxml.flush(t) end function xml.functions.b(t) context.start() context.bf() lxml.flush(t) context.stop() context("{}") end function xml.functions.section(t) context.section("{") lxml.flush(t) context("}") end \stopluacode \startxmlsetups mysetups % to be converted to lua later \xmlsetfunction {main}{document}{xml.functions.document} \xmlsetfunction {main}{section} {xml.functions.section} \xmlsetfunction {main}{b} {xml.functions.b} \stopxmlsetups \xmlregistersetup{mysetups} % to be converted to lua later % XML normally in separate file \starttext \startbuffer[test] <document> <section>some <b>bold</b> title</section> </document> \stopbuffer \xmlprocessbuffer{main}{test}{} \stoptext % END EXAMPLE I know it would be simple to write e.g. \startsetups xml:section \section{\xmlflush{#1}} \stopsetups but I was aiming for a simple, clean-looking CLD as style setup of the XML document. I doubt I could explain your MWE to one of my coworkers, as I hardly understand it myself :) What I was really hoping for was something like the fictional: function xml.functions.section(t) context.section(lxml.process_into_context_string(t)) end or some CLD extension so that it would actually understand function xml.functions.section(t) context.section(lxml.flush(t)) end I hope this makes more sense now. Unless something magical is possible, it seems my best bet is to stick with \startsetups instead of lua for these cases, just to make sure I can explain to the rest of the office what is going on. Thanks, Taco