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

Re: Not So Newbie XPath Question

Subject: Re: Not So Newbie XPath Question
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 19 Feb 2001 14:03:51 +0000
Re:  Not So Newbie XPath Question
Hi Bernard,

> Amongst the child elements there is a sequence of zero or more "a"
> elements. I need an XPath expression to select/match the first
> element after this sequence of "a" elements(if present). The first
> element's name after the "a" sequence is unknown. In the above
> example it just happens to be "xp"

It depends if you're selecting or matching.  If you're selecting, then
you can say:

go to the z element:

  z

from there go to the a elements:

  z/a

and from there to any immediately following sibling...

  z/a/following-sibling::*[1]

that isn't itself an 'a' element:

  z/a/following-sibling::*[1][not(self::a)]

This will only work in a select expression because match patterns
don't allow following-sibling:: axes.  For a match pattern, you need
something like you have already or one of its equivalents, like:

  z/*[preceding-sibling::a and not(self::a)][1]

or:
  
  z/*[not(self::a)][preceding-sibling::*[1][self::a]]

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.