ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* new xml feature (for html lovers)
@ 2016-12-28 17:07 Hans Hagen
  0 siblings, 0 replies; only message in thread
From: Hans Hagen @ 2016-12-28 17:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-28 17:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-28 17:07 new xml feature (for html lovers) Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).