-------- Forwarded Message --------
Subject: Re: Fwd: [NTG-context] (again) issue with lpath and conditional
Date: Thu, 22 Mar 2018 17:56:54 +0100
From: Hans Hagen
---------- Forwarded message ---------- From: Pablo Rodriguez
Date: Wed, Mar 21, 2018 at 8:29 PM Subject: [NTG-context] (again) issue with lpath and conditional To: mailing list for ConTeXt users Dear list,
I have the following sample:
\startbuffer[demo] <doc> <pre class="tex typeset fullwidth"> <code> a </code> </pre> <pre class="tex typeset"> <code> b </code> </pre> </doc> \stopbuffer
\startxmlsetups xml:initialize \xmlsetsetup{#1}{doc}{xml:*} \xmlsetsetup{\xmldocument} {pre[contains(@class,'typeset')]/code} {xml:pre:code} \stopxmlsetups
\xmlregistersetup{xml:initialize}
\startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:pre:code \xmlinfo{#1} \xmlpath{#1} \xmldoifelse{#1}{../pre[contains(@class,'fullwidth')]} %~ \xmldoifelse{#1}{{pre[class*="fullwidth"]}} {\startpar Full–width.\stoppar} {\startpar Another width.\stoppar} \stopxmlsetups
\starttext \xmlprocessbuffer{main}{demo}{} \stoptext
It is beyond my kmowledge why the lpath "{../pre[contains(@class,'fullwidth')]}" doesn’t return true, when \xmlinfo shows "[code]" and \xmlpath is "doc/pre/code" (indices aren’t relevant here).
Neither does the css selector work.
What am I missing in the lpath and the css selector? \xmldoifelse {#1} {..[contains(@class,'fullwidth')]}
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------