![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 1/10/2019 10:26 PM, 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:
<p> <equation text="$$y_1(t) = 1, t \geq 0$$"> <img alt="$$y_1(t) = 1, t \geq 0$$" class="equation" height="15px" src="Lab01_eq10401623798909303081.png" width="95px"/> </equation> </p>
I want to typeset the `text` attribute of equation (and ignore the <img> 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). Time for an "aha, I knew it" moment ...
\starttext \startbuffer[test] <p> <equation text="$$y_1(t) = 1, t \geq 0$$"> <img alt="$$y_1(t) = 1, t \geq 0$$" class="equation" height="15px" src="Lab01_eq10401623798909303081.png" width="95px"/> </equation> </p> \stopbuffer \startxmlsetups whatever \xmlsetsetup{#1}{p|equation}{xml:*} \stopxmlsetups \xmlregistersetup{whatever} \startxmlsetups xml:p \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:equation \cldcontext{lxml.getid("#1").at.text} \stopxmlsetups \startxmlsetups xml:equation \startformula \cldcontext{(string.gsub(lxml.getid("#1").at.text,"[$][$]",""))} \stopformula \stopxmlsetups \xmlprocessbuffer{main}{test}{} \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------