On 10/14/2015 01:34 PM, mass...@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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to