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

Thomas A. Schmitz thomas.schmitz at uni-bonn.de
Thu Oct 15 22:27:41 CEST 2015

On 10/14/2015 01:34 PM, massifr at fastwebnet.it wrote:
> I've found a better solution:
> \startxmlsetups xml:p
>    \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}%
>    \xmlflush{#1}\par
> \stopxmlsetups
> Still I did not manage to put that rule in a xmlsetsetup.
> Tried this:
> \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 'incipit']}{xml:p:noindent}
> but it does not work.

I'm not sure if the "sibling" part of xpath syntax has been integrated 
into context. The best I can come up with is a hack which may help:

   <p class="incipit">Dear list,</p>
   <p>this paragraph should not be indented, because it follows the 
   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 
   but my text is already formatted like that and I can’t do anything
   about it.</p>

\startxmlsetups xml:somesetups


\startxmlsetups xml:text

\startxmlsetups xml:p
	\doifelse {\xmlatt {#1} {class}} {incipit}
	  {\noindentation \xmlflush {#1}\par \noindentation}
	  {\xmlflush {#1}\par \indentation}

   \setupindenting [medium, yes]

This will suppress indentation for paragraphs with class "incipit" and 
the following paragraph.


More information about the ntg-context mailing list