[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Finding immediately preceding node.
[ Betty Harvey] > I want to get the a true when I am inside <b name="cde"> and > the preceding <b> contains the attribute 'name="abc"'. > > <?xml version="1.0"?> > <a> > <b name="abc"/> > <c/> > <b> > <c/> > </b> > <b name="abc"> > <c/> > </b> > <b name="cde"> > <c/> > Only guessing without more info (see my previous post), but it seems to me that the easiest thing, if you are going to use templates for "b" nodes that call templates for their child nodes, is to test the condition in the "b" template and then pass it along as a parameter to all other templates that get invoked. Something like this - <xsl:template match="/a"> <result> <xsl:apply-templates select='b'/> </result> </xsl:template> <xsl:template match='b'> <xsl:variable name='meets-condition' select='@name="cde" and preceding-sibling::b[1]/@name="abc"'/> <xsl:apply-templates select='c'> <xsl:with-param name='meets-condition' select='$meets-condition'/> </xsl:apply-templates> </xsl:template> Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|