arbitrary context commands in xml file
Hi Is there a way to add arbitrary context commands to an xml file without defining an injector first? Best Denis
I mean without breaking the xml of course. Something like an ad hoc injector...
________________________________________
Von: ntg-context
Thanks. But won't that break the xml? I'll need a new element for this right? But what if the schema doesn't allow this?
________________________________________
Von: Wolfgang Schuster
I mean without breaking the xml of course. Something like an ad hoc injector...
\startxmlsetups ... \xmlflushcontext{#1} \stopxmlsetups Wolfgang
Just to provide more information about what I was thinking: You do your typesetting based on an XML doc. Now it is time for the finishing touches. In a tex document you'd add the usual commands to manipulate the layout: \adaptlayout[lines=+1] \testpage[3] \looseness=-1 / \looseness=+1 \blank \setuptolerance etc. Now, of course you can define an injector for these commands, some are predefined, like page, column, blank. But, if my understanding is correct, you'd have to define one for each of the possible parameters. So, you'll need: \startsetups xml:directive:injector:testpagethree \testpage[3] \stopsetups \startsetups xml:directive:injector:testpagefour \testpage[4] \stopsetups etc., and \startsetups xml:directive:injector:addoneline \adaptlayout[lines=+1] \stopsetups \startsetups xml:directive:injector:addtwolines \adaptlayout[lines=+1] \stopsetups Here, I was thinking if something like this could be easier: <?context-directive raw-tex-injector \testpage[4]?> Wolfgang's solutions seems to provide that with different means. If I understand correctly, you'd just map an arbitrary XML element to this setup, and you can then do this: <rawtex> \testpage[4] </rawtex> Correct? If yes, that would be a nice solution, but those elements are probably not allowed if your document needs to be validated against a schema, yet processor instructions will be ignored during validation. Any ideas for alternative approaches? What do you think about a raw-tex injector? (Another possibility would be to use Wolfgang's suggestion, and then to use an XSLT stylesheet to remove those illegal nodes for validation purposes...) Best, Denis
On 3/5/2021 10:27 PM, denis.maier@ub.unibe.ch wrote:
<testpage n="4"/> \startxmlsetups xml:testpage \testpage[\xmlatt{#1}{n}] \stopxmlsetup and register that one (as in previous examples) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Mon, 8 Mar 2021 at 10:21,
I'd like to second Denis' request for support for XML processing instructions to execute ConTeXt code, rather than elements which can cause big problems if one is working to a fixed schema. It would be a boon to be able to drop in <?context \whatever{fdfd}?> in an XML source. Duncan
On 3/8/2021 12:48 PM, Duncan Hothersall wrote:
one of the things that can already be done ... \def\xmltexdirective#1#2{\doif{#1}{command}{#2}} \xmlinstalldirective{tex}{xmltexdirective} <?context-directive tex command \inframed{xxx} ?> <?context-directive tex command \page ?> (the #2 is something without spaces btu one can work around that) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Indeed. That's very useful. Thanks!
Von: ntg-context
\def\xmltexdirective#1#2{\doif{#1}{command}{#2}} \xmlinstalldirective{tex}{xmltexdirective} <?context-directive tex command \inframed{xxx} ?> <?context-directive tex command \page ?> (the #2 is something without spaces btu one can work around that) Aha. Useful, thanks!
participants (4)
-
denis.maier@ub.unibe.ch
-
Duncan Hothersall
-
Hans Hagen
-
Wolfgang Schuster