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

RE: Preceding Ancestors

Subject: RE: Preceding Ancestors
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Aug 2001 18:29:25 +0200 (MEST)
xpath 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


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.