[NTG-context] Accessing current XML node in Lua function

Birke, Gabriel Gabriel.Birke at tib.uni-hannover.de
Tue Feb 25 11:13:32 CET 2014


I'd like to write a Lua function that processes the href attribute from a
HTML file and outputs different content depending on the URL.
However, I don't know how to convert the XML attribute and the contents of
the link tag to a string value for the Lua function. I've tried the
following, which does not work but makes my intention clearer:

\startxmlsetups xml:a
    \directlua{getlinkcode("\\xmlatt{#1}{href}", "\\xmlflush{#1}")}

It's probably calls to lxml.att and lxml.flush instead of the strings, but
how do I convert the "#1" ?

Kind regards,


Gabriel Birke
Open Science Lab
Technische Informationsbibliothek / German National Library of Science and
Welfengarten 1 B, 30167 Hannover, Germany
Telefon: +49 511 762 14235
E-Mail: gabriel.birke at tib.uni-hannover.de
Internet: http://www.tib.uni-hannover.de

More information about the ntg-context mailing list