From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: new xml feature (for html lovers)
Date: Wed, 28 Dec 2016 18:07:27 +0100 [thread overview]
Message-ID: <5696349b-2b5e-a368-48b5-53db616e762b@wxs.nl> (raw)
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
___________________________________________________________________________________
reply other threads:[~2016-12-28 17:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5696349b-2b5e-a368-48b5-53db616e762b@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).