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

massifr at fastwebnet.it massifr at fastwebnet.it
Mon Oct 12 17:38:08 CEST 2015


Hello list,
I need a lpath expression to intercept the first p (HTML paragraph) 
after a p of class "incipit". Here's a (not) working example:

\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}
  \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
  % the following lpath expression does not work
  \xmlsetsetup{#1}{p[./preceding-sibling::[-1][@class = 'incipit']]}{xml:p:noindent}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:p:noindent
  \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

Thanks for any help.


More information about the ntg-context mailing list