This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Output conditional on preceding nodes.
- From: Delany Nick <Nick dot Delany at ICL dot com>
- To: "XSL List (E-mail)" <XSL-List at lists dot mulberrytech dot com>
- Date: Thu, 29 Nov 2001 16:35:42 -0000
- Subject: [xsl] Output conditional on preceding nodes.
- Reply-to: xsl-list at lists dot mulberrytech dot com
I'm trying to find a way of saying 'output the third paragraph after the
heading containing the text "foo"' -- to no avail.
If, for example, you have the input
<h1>Best Section</h1>
<p>Best Section - Paragraph One</p>
<p>Best Section - Paragraph Two</p>
<h1>Worst Section</h1>
<p>Worst Section - Paragraph One</p>
<p>Worst Section - Paragraph Two</p>
and you want to output
<p>Best Section - Paragraph Two</p>
only - how would you do it? I have
<xsl:template match="p">
<xsl:if test="preceding::h1[text()='Best Section']
and not(preceding::h1[text()!='Best Section'])">
<xsl:apply-templates />
</xsl:if>
</xsl:template>
which restricts it to the correct section, but how would I output only the
second paragraph?
Thanks
Nick Delany
ICL ITCentre
South County Business Park, Leopardstown, Co. Dublin, Ireland
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list