ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* question about an lpath
@ 2016-05-31 17:21 Pablo Rodriguez
  2016-05-31 17:56 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Rodriguez @ 2016-05-31 17:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 "+".

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about an lpath
  2016-05-31 17:21 question about an lpath Pablo Rodriguez
@ 2016-05-31 17:56 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2016-05-31 17:56 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-31 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31 17:21 question about an lpath Pablo Rodriguez
2016-05-31 17:56 ` 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).