ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: question about an lpath
Date: Tue, 31 May 2016 19:56:52 +0200	[thread overview]
Message-ID: <ff13cb37-3c1c-4e25-0cbb-108be9fc63d1@wxs.nl> (raw)
In-Reply-To: <c496884b-c1ef-4fbb-ec6e-e9ce8f4c0bbf@gmx.es>

On 5/31/2016 7:21 PM, Pablo Rodriguez wrote:
> Dear list,
>
> I have the following sample:
>
>     \startbuffer[demo]
>     <div class="super">
>           <h1>Chapter</h1>
>           <p>This is the only paragraph in red.</p>
>           <p>This is another paragraph.</p>
>           <p>This is another paragraph.</p>
>           <p>This is another paragraph.</p>
>           <p>This is another paragraph.</p>
>     </div>
>     \stopbuffer
>
>     \startxmlsetups xml:initialize
>           \xmlsetsetup{#1}{*}{xml:*}
>           \xmlsetsetup{#1}
>             {div[contains(@class,'super')]/p[position()==1]}
>             {xml:p:super}
>     \stopxmlsetups
>
>     \xmlregistersetup{xml:initialize}
>
>     \startxmlsetups xml:div
>           \xmlflush{#1}
>     \stopxmlsetups
>
>     \startxmlsetups xml:h1
>           \title{\xmlflush{#1}}
>     \stopxmlsetups
>
>     \startxmlsetups xml:p
>           \xmlflush{#1}\par
>     \stopxmlsetups
>
>     \startxmlsetups xml:p:super
>           \bgroup\red\xmlflush{#1}\egroup\par
>     \stopxmlsetups
>
>     \starttext
>
>     \xmlprocessbuffer{main}{demo}{}
>
>     \stoptext
>
> Would it be possible to have another lpath for xml:p:super similar to
> the following CSS selector? (Sorry, this is much easier for me.)
>
>     div.super > h1 + p {}
>
> After searching in xml-mkiv.pdf, I’m afraid I haven’t been able to find
> which might be the lpath replacement for "+".

maybe this?

{div[contains(@class,'super')]/h1/../p[position()==1]}

> Many thanks for your help,
>
>
> Pablo
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2016-05-31 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 17:21 Pablo Rodriguez
2016-05-31 17:56 ` Hans Hagen [this message]

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=ff13cb37-3c1c-4e25-0cbb-108be9fc63d1@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).