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

Re: Quick Xpath


xpath preceding sibling
Jeni,

Thanks!, a question from Eric's answer:

Is it file://b[preceding-sibling::*[1][self::a]]
or file://b[preceding-sibling::*[last()][self::a]]

Meanwhile for XML-SPY users you should use
Is it file://b[preceding-sibling::*[position()=1][self::a]]
Because
Is it file://b[preceding-sibling::*[1][self::a]]
doesn't work.

This is a XMLSPY bug isn't it?


----- Original Message -----
From: Jeni Tennison <jeni@j...>
To: Garland foster <garland_foster@s...>
Cc: Mark Feblowitz <mfeblowitz@f...>; 'Dare Obasanjo'
<dareo@m...>; <xml-dev@l...>
Sent: Wednesday, July 17, 2002 6:44 PM
Subject: Re:  Quick Xpath


> Hi Garland,
>
> > XMLCooktop works with
> > file://b[preceding-sibling::*[self::a]]
> > or
> > file://b[preceding-sibling::*[1][self::a]]
> > or
> > file://b[local-name(preceding-sibling::*[1])='a']
> >
> > While XML-SPY works with
> > file://b[preceding-sibling::*[self::a]]
> > but not with
> > file://b[preceding-sibling::*[1][self::a]]
> > and doesn't work either with
> > file://b[local-name(preceding-sibling::*[1])='a']
> >
> > Interesting, which processor is wrong/right and why?
>
> Well, the path:
>
>   file://b[preceding-sibling::*[self::a]]
>
> should give you all the b elements (in no namespace) that follow an a
> element (in no namespace), whether or not that a element is their
> immediately preceding sibling or not -- it's exactly the same as:
>
>   file://b[preceding-sibling::a]
>
> The path:
>
>   file://b[preceding-sibling::*[1][self::a]]
>
> should give you all the b elements (in no namespace) that immediately
> follow an a element (in no namespace).
>
> The path:
>
>   file://b[local-name(preceding-sibling::*[1]) = 'a']
>
> should give you all the b elements (in no namespace) that immediately
> follow an a element (in any namespace).
>
> If that's not what XML Spy's processor is giving you, then that
> processor is wrong. I tried with Saxon, MSXML4, MSXML3, Xalan-J,
> Xalan-C++, and jd.xslt and they all behaved as expected. (libxslt
> didn't though.)
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.373 / Virus Database: 208 - Release Date: 7/1/02


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.