On 3-8-2012 08:35, Olivier Binda wrote:
On Thu, 2 Aug 2012, Olivier Binda wrote:
1) does lxml.att("#1","some tag") really work ?
I don't know, but please provide a complete minimal example. \startxmlsetups xml:test \xmlsetsetup{maths}{c}{xml:*} \stopxmlsetups \xmlregistersetup{xml:test} \startxmlsetups xml:c \ctxlua{
On 02/08/2012 17:43, Aditya Mahajan wrote: title = "test="..lxml.att("#1","title") context(title)}% \stopxmlsetups
\starttext test : \xmlprocessdata {maths}{<?xml version='1.0' standalone='yes?><c title="My title"></c>} {} \stoptext \endinput
Context gives the "can't concatenate with a nil value" Luatex error when processing this snipet...but if I ignore the error, the pdf output is okey
the functions in the lxml namespace already print to context and return no value so you effectively appends nil which is invalid also, when used in a context run the default serializer is also piping to context so if you want otherwise you need to prefix with xml:// (which is an indication that in principle there can be many variants) here are some valid solutions (whatch the lxml.id): \startxmlsetups xml:test \xmlsetsetup{#1}{c}{xml:*} \stopxmlsetups \xmlregistersetup{xml:test} \startxmlsetups xml:c \ctxlua{title = "test=" .. xml.filter(lxml.id("#1"),"xml://./attribute(title)") context(title)} \par \ctxlua{context("test=") xml.filter(lxml.id("#1"),"./attribute(title)")} \par \ctxlua{context("test=") lxml.att("#1","title")} \stopxmlsetups \starttext \xmlprocessdata {maths} {<?xml version='1.0' standalone='yes?><c title="My title"></c>} {} \stoptext You can wikify this ... Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------