Thank you for your answer, Thomas. I tried something similar (putting a \noindentation at the end of the "incipit" paragraph, but it failed if I put a \blank after that). The sibling part In the book of the history of luatex (v 0.50) it is said that the sibling functions would not be implemented soon, but at least 3 methods have been implemented. From the release notes 8/5/2010 (http://wiki.con textgarden.net/Context_2010.05.08): "implement following-sibling(), preceding-sibling() and reverse- sibling() lpath methods" If you search for "sibling" in the mailing list archive, you find a pair of threads. I've found no other documentation. "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'". Massi Il giorno gio, 15/10/2015 alle 22.27 +0200, Thomas A. Schmitz ha scritto:
On 10/14/2015 01:34 PM, massifr@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:
\startbuffer[test] <text> <p class="incipit">Dear list,</p> <p>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> </text> \stopbuffer
\startxmlsetups xml:somesetups \xmlsetsetup{#1}{text}{xml:text} \xmlsetsetup{#1}{p}{xml:p} \stopxmlsetups
\xmlregistersetup{xml:somesetups}
\startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:p \doifelse {\xmlatt {#1} {class}} {incipit} {\noindentation \xmlflush {#1}\par \noindentation} {\xmlflush {#1}\par \indentation} \stopxmlsetups
\starttext \setupindenting [medium, yes] \xmlprocessbuffer{main}{test}{} \stoptext
This will suppress indentation for paragraphs with class "incipit" and the following paragraph.
Thomas