[NTG-context] Custom XML Export

Hans Hagen pragma at wxs.nl
Sat Sep 12 11:53:02 CEST 2015


On 9/11/2015 4:21 PM, Toby Miller wrote:
> I'm using ConTeXt's export to XML feature, but I'd like more control
> over the XML output. Is there a way to define a TeX command that will
> output a specific tag (<tag>content</tag>) around some text in the output?

\setupbackend[export=yes]

\definehighlight[this]

\starttext
     \startelement[what]
          \this{that}  \input ward
     \stopelement
\stoptext

(there are also ways to add extra properties)

> Ideally I'd like to write a completely custom XML printer; it would be
> very simple, but would allow me to define what tags I want for different
> things. Is there a way to change the behaviour of the existing one, or
> could you recommend a starting point for writing a new one?

the export resembles the structure used in the source and making each 
aspect configurable not only adds much overhead but is also kind of 
useless as one can easily transform xml into other xml; it's no problem 
to add a few more details here or there , but th emain indea behind the 
export is to have standardized and predictable output that then can be 
either rendered using css or converted (for that the raw file is best).

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
-----------------------------------------------------------------


More information about the ntg-context mailing list