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

RE: XPATH restricting preceding nodes

Subject: RE: XPATH restricting preceding nodes
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 10 Sep 2003 14:28:52 +0100
xpath preceding
As David said, using the preceding axis is a very inefficient way of
doing this. Use Muenchian grouping, described at
www.jenitennison.com/xslt/grouping. 

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Kloeck, Erwin
> Sent: 10 September 2003 10:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: AW:  XPATH restricting preceding nodes 
> 
> 
> 
> Hi,
> 
> I made this XML document too simple in the last post. Entries 
> are not siblings! The XML document should rather something like this: 
> 
> <top>
> 	<page>
> 		<paragraph>
> 			<entry text='aaa'/>
> 		</paragraph>
> 		<paragraph>
> 			<entry text='bbb'/>
> 		</paragraph>
> 		<paragraph>
> 			<entry text='aaa'/>
> 		</paragraph>
> 	</page>
> 	<page>
> 		<paragraph>
> 			<entry text='ccc'/>
> 		</paragraph>
> 		<paragraph>
> 			<entry text='bbb'/>   ***
> 		</paragraph>
> 		<paragraph>
> 			<entry text='ccc'/>
> 		</paragraph>
> 	</page>
> </top>
> 
> I only want to select entries with the same text once for 
> each page. For the first page I want to get only one 
> aaa-entry and one bbb-entry. For the second page I want to 
> get only one ccc-entry and ond bbb-entry.
> 
> I did this with the following XPATH expression :
> 	<xsl:for-each 
> select="ancestor::page/descendant::entry[not(@text = 
> preceding::entry/@text)]">
> 
> but then I don't get the bbb-entry for the second page. 
> I cannot figure out a way to restrict the preceding::entry 
> result set to the current page. What am I doing wrong?
> 
> Thanks
> 
> ..............................
> 
> Erwin Kloeck
> 
>  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.