[NTG-context] use of preceding-sibling in xmlsetsetup
massifr at fastwebnet.it
massifr at fastwebnet.it
Wed Oct 14 13:34:19 CEST 2015
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.
> 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