On Fri, 11 Jan 2019, Henri Menke wrote: > On 11/01/19 10:26 AM, Aditya Mahajan wrote: >> Hi, >> >> I have an XML file (which is generated via a program that I have no >> control over), which contains elements as follows: >> >>         

>>             >>                $$y_1(t) = 1, t \geq 0$$> height="15px" src="Lab01_eq10401623798909303081.png" width="95px"/> >>             >>         

>> >> I want to typeset the `text` attribute of equation (and ignore the >> tag). So, I tried: >> >> \startxmlsetups matlab >>   % Bunch of missing definitions >>   \xmlsetsetup{#1}{equation}{matlab:*} >> \stopxmlsetups >> >> \startxmlsetups matlab:equation >>   \xmlatt{#1}{text} >> \stopxmlsetups >> >> This literally typesets `$$y_1(t) = 1, t \geq 0$$`. How can I flush the >> attribute using ctxcatcodes? (There is \xmlflushcontent, but that is for >> content and not attributes). > > You could write your own attribute fetcher in Lua. Probably there is a > more elegant method. > > \startbuffer[test] >

> > $$y_1(t) = 1, t \geq 0$$ height="15px" src="Lab01_eq10401623798909303081.png" width="95px"/> > >

> \stopbuffer > > \startxmlsetups matlab > % Bunch of missing definitions > \xmlsetsetup{#1}{p}{matlab:*} > \xmlsetsetup{#1}{equation}{matlab:*} > \stopxmlsetups > > \startxmlsetups matlab:p > \xmlflush{#1} > \stopxmlsetups > > \startxmlsetups matlab:equation > \xmlfunction{#1}{equation} > \stopxmlsetups > \startluacode > local a = "text" > local ctxcatcodes = catcodes.numbers.ctxcatcodes > > function xml.functions.equation(id) > local e = lxml.getid(id) > if e then > local at = e.at > if at then > local att = at[a] > if att ~= "" then > context.sprint(ctxcatcodes,att) > end > end > end > end > \stopluacode > > \xmlregistersetup{matlab} > > \starttext > \xmlprocessbuffer{test}{test}{} > \stoptext Thanks! Aditya