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

RE: [xpath] all following sibling nodes upto first oc

Subject: RE: [xpath] all following sibling nodes upto first occurace of specific text value
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Aug 2005 23:59:32 +0100
xpath all
In general in XPath if you want to find all nodes on an axis up to the first
one that satisfies condition X, the approach is:

following-sibling::node() except
following-sibling::node()[X][1]/following-sibling::node()

The except operator is in XPath 2.0 but not in XPath 1.0. In XPath 1.0, to
write "A except B", you code it as

A[count(.|B)!=count(B)]

You can expect the performance of the resulting expression to be fairly
awful; a recursive solution at the XSLT level that steps along the axis
until it finds a node satisfying X is likely to be much more efficient.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: geoff hopkins [mailto:geoffhopkins123@xxxxxxxxx] 
> Sent: 11 August 2005 13:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  [xpath] all following sibling nodes upto first 
> occurace of specific text value
> 
>  I understand this is a xslt forum but there does not
>  seem to be any decent xpath places...
>  
>  I need a xpath expression to be used with a for-each
>  loop... context node is X.Parent select the next
>  items
>  until it finds the next occurance of X.Parent or
>  END-OF-DATA as the text value of the node
>  
>  e.g. the following xml is a typical xml file
>  
>  <?xml version="1.0" encoding="utf-8"?>
>  <root>
>  	<node>X.Parent</node>
>  	<node>Y.Child</node>
>  	<node>Y.Child</node>
>  	<node>X.Parent</node>
>  	<node>Y.Child</node>
>  	<node>END-OF-DATA</node>
>  </root>
>  
>  Thanks...
>  
>  Geoff
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

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.