[NTG-context] Xml filtering in Lua
Hans Hagen
j.hagen at xs4all.nl
Wed Nov 16 23:19:34 CET 2022
On 11/16/2022 10:09 PM, Thomas A. Schmitz via ntg-context wrote:
> 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 :-)
>
> Anyway:
>
> If you've filtered something out like this
>
> local tree = xml.filter (t, "../chapter[@title='mytitle'")
always keep in mind that some expressions return a list of matches, that
can be looped over and some commands just process the first
anyway, it can sometimes help to add
print(tstring(tree))
so see what you got
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
-----------------------------------------------------------------
More information about the ntg-context
mailing list