[NTG-context] use of preceding-sibling in xmlsetsetup

massifr at fastwebnet.it massifr at fastwebnet.it
Tue Oct 20 11:48:44 CEST 2015

Here's the (complete) code:

  <p class="incipit">Dear list,</p>
  <p class="dopo-incipit">this paragraph should not be indented, because it follows the “incipit”
  of the letter.</p>
  <p>This one and the following ones should be indented.</p>
  <p>You may question whether “Dear list,” should be a paragraph of his own,
  but my text is already formatted like that and I can’t do anything 
  about it.</p>
\startxmlsetups xml:somesetups
  % the following lpath expression does not work
  % \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 'incipit']}{xml:p:noindent}


\startxmlsetups xml:text

\startxmlsetups xml:p
\startxmlsetups xml:p:noindent

It's the example of the original message of this thread, with the 
modifications posted in the second message.

In the \startxmlsetups section I tried to put that condition in a
\xmlsetsetup, but I commented it out because it did not work.
Here's where I found an example with reverse-sibling:
I was searching for "sibling" in the mailing list archive to see whether
"sibling expressions" had been implemented.


> > On 10/17/2015 11:19 AM, mf wrote:
> > > "reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
> > > preceding-sibling", so that you find the nearest sibling at index [1].
> > > I've used it successfully in a \doif statement, but I failed in
> > > translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
> > > setup is for an element p whose nearest preceding sibling p has class
> > > 'incipit'".
> > 
> > In that case, why don't you show the code where you've used it 
> > successfully and maybe we can take it from there.
> > 
> > Thomas
> > 

More information about the ntg-context mailing list