[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Preceding Ancestors
> n:/s/m/m[2]/p[2]/preceding::p > <!-- XPATH:/s/m/m[2]/p[2]/preceding::p --> > <xpath-query query="/s/m/m[2]/p[2]/preceding::p"> > <p a="1" /> > <p a="2" /> > <p a="3" /> > <p a="4" /> > <p a="5" /> > <p a="6" /> > </xpath-query> > > Giving me 3,4,5 where I shouldn't have them :) Alright, I was too fast with my answer. Trevor got it right. Another solution (extending my proposal): the intersection of your idea ancestor::*/p and my one preceding::p This leads to <xsl:template match="p[@a='7']"> <xsl:variable name="a" select="ancestor::*/p" /> <xsl:variable name="p" select="preceding::p" /> <xsl:copy-of select="$a[count(.|$p)=count($p)]" /> </xsl:template> and the output <p a="1"/><p a="2"/><p a="6"/> Cheers, Oliver /-------------------------------------------------------------------\ | ob|do Dipl.Inf. Oliver Becker | | --+-- E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx | | op|qo WWW: http://www.informatik.hu-berlin.de/~obecker | \-------------------------------------------------------------------/ 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
|