[NTG-context] Xml filtering in Lua

Thomas A. Schmitz thomas.schmitz at uni-bonn.de
Wed Nov 16 22:09:45 CET 2022

On 11/16/22 21:51, Denis Maier via ntg-context wrote:
> Just a quick question regarding this?
> Is xml.filter equivalent to \xmlfilter? If so, how do you pass the match to a command as you'd do with \xmlfilter?

I'm still digesting and playing with Massi's reply; will probably be 
back with more questions :-)


If you've filtered something out like this

local tree = xml.filter (t, "../chapter[@title='mytitle'")

you can then apply a command to it

lxml.command(lxml.id(tree), ".", "xml:chapter:command")

and have to define the command as

\startxmlsetups xml:chapter:command
	\xmltext {#1} {content}

for example.


More information about the ntg-context mailing list