[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Output conditional on preceding nodes.

Subject: RE: Output conditional on preceding nodes.
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 29 Nov 2001 17:28:23 -0000
kay delany
> I'm trying to find a way of saying 'output the third 
> paragraph after the
> heading containing the text "foo"' -- to no avail.

select="h1[.='foo']/following-sibling::p[3]"

Mike Kay
(with best wishes to friends at the ITCentre)

> 
> 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
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.