OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Quick Xpath

[ Lists Home | Date Index | Thread Index ]

Hi Garland,

> XMLCooktop works with
> //b[preceding-sibling::*[self::a]]
> or
> //b[preceding-sibling::*[1][self::a]]
> or
> //b[local-name(preceding-sibling::*[1])='a']
>
> While XML-SPY works with
> //b[preceding-sibling::*[self::a]]
> but not with
> //b[preceding-sibling::*[1][self::a]]
> and doesn't work either with
> //b[local-name(preceding-sibling::*[1])='a']
>
> Interesting, which processor is wrong/right and why?

Well, the path:

  //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:

  //b[preceding-sibling::a]

The path:

  //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:

  //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/





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS