On 01/15/2016 06:21 PM, Kate F wrote:
Hi. I'm using MkIV's XML stuff. I have two related questions.
Firstly, can I have entities in XML expand out to TeX markup?
I thought this was how you'd do it, but this produces a document that says literally "xxx~yyy\thinspace zzz", whereas I want the ~ and \thinspace to be executed as TeX commands. Test case below.
Secondly, is it possible to have ConTeXt load such entities from a DTD? If I use a DOCTYPE in my XML, entities from that DTD seem to not be loaded.
What do you mean? The way ConText processes entities is completely independent from your DTD.
Thanks.
a.xml: <?xml version="1.0"?> <a>xxx yyy zzz</a>
a.tex: \startxmlsetups xml:mysetups \xmlsetsetup{\xmldocument}{a}{xml:*} \stopxmlsetups \xmlregistersetup{xml:mysetups}
\startxmlsetups xml:a \xmlflush{#1} \stopxmlsetups
\enabledirectives[lxml.escapedentities] \xmltexentity{nbsp}{~} \xmltexentity{thinsp}{\thinspace}
\xmlsetentity{nbsp}{~} \xmlsetentity{thinsp}{\thinspace}
\starttext \xmlprocessfile{main}{a.xml}{} \stoptext
Thomas