[NTG-context] redefining xmlsetups inside a XML document

Hans Hagen j.hagen at xs4all.nl
Thu Mar 10 17:52:20 CET 2022


On 3/10/2022 4:59 PM, mf via ntg-context wrote:
> Hello,
> I'm trying to add new templates (xmlsetups) from the XML document itself.
> 
> See the attached MWE.
> 
> - the XML document is a simple XHTML file
> 
> - in the "head" element there's a "script" element with the "type" 
> attribute set to "text/vnd.context", whose contents are then passed to 
> \xmlcontext
> 
> - the "body" element has a "data-xmlsetups" attribute whose value should 
> tell which xmlsetups is to be applied on the body contents (it's defined 
> in the "script" element above)
> 
> If it worked, the resulting PDF should show the body element, followed 
> by a "Hello world!" paragraph written in red.
> But it does not work, because there's something I'm missing in the 
> redefinition and application of xmlsetups.
> 
> To try the MWE, type:
> 
> context --environment=nested-xmlsetup.tex --forcexml nested-xmlsetup.xhtml
     <script type="text/vnd.context">
       \startxmlsetups myHtml
        \xmlsetsetup{#1}{p}{myHtml:p}
        % you're missing this
        \xmlsetup{#1}{xml:process}
        % which is
        %  \xmlregistereddocumentsetups{#1}{#1}
        %  \xmlmain{#1}
       \stopxmlsetups

       \startxmlsetups myHtml:p
          \dontleavehmode\red\xmlflush{#1}\par
       \stopxmlsetups
     </script>


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list