[NTG-context] searching in nodes

Hans Hagen j.hagen at xs4all.nl
Mon Dec 17 19:53:17 CET 2018


On 12/12/2018 12:57 PM, Hans van der Meer wrote:
> In a Lua function called from within an \startxmlsetups..\stopxmlsetups 
> code block I would like to search through the current node and all below.
> Using string.match("to-be-searched”,”pattern”).
> The Lua function being called through 
> \def\findmypattern#1#2{\ctxlua{tex.print(hvdm.findmypattern("#1","#2",))}
> 
> But I do not seem to get the node contents in the first argument #1. 
> Using \xmlverbatim{#1} fails with Lua error "hexadecimal digit expected 
> near '"\xm’”. \xmlflushpure{#1} fails with Lua error "invalid escape 
> sequence near …”
you can use lua in your path expressions

[hvhm.findmypattern(text(),'whatever')]

and such


-----------------------------------------------------------------
                                           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