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
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 -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Pablo Rodriguez