[NTG-context] new xml feature (for html lovers)

Hans Hagen pragma at wxs.nl
Wed Dec 28 18:07:27 CET 2016


Hi,

As a side effect of a fun project I've added css like selectors to the 
xml interface, so one can do:

\xmlall{#1}{{foo bar .whatever, bar foo .whatever}}

\starttext

\startbuffer[selector-003]
<?xml version="1.0" ?>

<document>
     <title    class="one">title 1</title>
     <subtitle class="sub">title 1.1</subtitle>
     <title    class="two">title 2</title>
     <subtitle class="sub">title 2.1</subtitle>
     <title    class="one">title 3</title>
     <subtitle class="sub">title 3.1</subtitle>
     <title    class="two">title 4</title>
     <subtitle class="sub">title 4.1</subtitle>
</document>
\stopbuffer

\xmlloadbuffer{selector-003}{selector-003}

\startxmlsetups xml:selector:demo
     \xmlverbatim{#1}\par
\stopxmlsetups

\xmlcommand
   {selector-003}
   {{document title .one + subtitle, document title .two + subtitle}}
   {xml:selector:demo}

\stoptext

Performance should be ok although (currently) a combined selector 
triggers a result sorter which has a small speed penalty. After all you 
don't want your document to come out in the wrong order.

like things. In the process I optimized an aspect of the parser and 
hopefully I didn't break anything.

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


More information about the ntg-context mailing list