Hello!

Processing XML I want to manipulate content of XML elements inside Lua.

I can define the Lua function xml.functions.name(t)where processing happens, and use the command \xmlfunction{#1}{name} to pass the current node #1 from ctx to lua as described in the xml-mkiv.pdf manual. To access the element content xml.text(t,"/element") Lua function is used.

However, using the same function xml.text("#1",/element) directly inside Lua doesn't work for me. Node #1 is available, but not the content of /element.

\startluacode
    local node = "#1"
    local content = xml.text("#1","/color")
    context.par() context("node: ") context(node)
    context.par() context("lua: ")  context(content)
\stopluacode

MWE (mkiv, beta) attached.

I haven't found an example, so is it even possible? If so, which way is more efficient?

Thanks,
Jano