On 12/09/15 13:00, Hans Hagen wrote: > On 9/12/2015 1:37 PM, Toby Miller wrote: >> Thank you! That's exactly what I was looking for. >> >> I have a few other things I'd like to be able to do with this kind of >> thing (print '<br />' self-closed tags for example, and add attributes >> as you say), but I feel bad about posting to the list for them. Is there >> any documentation for these features at all? I couldn't find any >> reference to the \startelement command when I looked, but perhaps I'm >> looking in the wrong place. > > \setupbackend[export=yes] > \setupexport[properties=yes] > > \starttext > \startelement[test][this=that]whatever\stopelement > \stoptext > > arbitrary empty elements are tricky as there is no content then, so > that needs thinking > > (you can of course abuse \startelement > > \startelement[br]x\stopelement > > and then remove the x from the exported xml. I'll think about it (no > time now). > > Hans
Makes sense! I think I have what I need for the moment; thanks for your help. Toby > > >> I'll take your advice and not try to adapt the export system. Now that I >> can print tags at least I think XML transformation should be able to >> deal with everything I need if it comes to it. >> >> Toby >> >> On 12/09/15 10:53, Hans Hagen wrote: >>> 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 >>> ----------------------------------------------------------------- >>> ___________________________________________________________________________________ >>> >>> >>> If your question is of interest to others as well, please add an entry >>> to the Wiki! >>> >>> maillist : ntg-context@ntg.nl / >>> http://www.ntg.nl/mailman/listinfo/ntg-context >>> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >>> archive : http://foundry.supelec.fr/projects/contextrev/ >>> wiki : http://contextgarden.net >>> ___________________________________________________________________________________ >>> >> >> ___________________________________________________________________________________ >> >> If your question is of interest to others as well, please add an >> entry to the Wiki! >> >> maillist : ntg-context@ntg.nl / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >> archive : http://foundry.supelec.fr/projects/contextrev/ >> wiki : http://contextgarden.net >> ___________________________________________________________________________________ >> >> > > ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________