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,

> Return all the "b" nodes that are inmediately preceded by an "a"
> element (the bold nodes).

Use:

  /foo/b[preceding-sibling::*[1][self::a]]

preceding-sibling::*[1] gets you the immediately preceding element;
the [self::a] predicate tests whether the element that you select is
an 'a' element or not.

It's better doing it this way than using local-name() because it deals
properly with namespaces (i.e. it looks for 'a' elements in no
namespace rather than all elements that are called 'a' no matter what
namespace they're in).
  
Cheers,

Jeni

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


  • References:
    • Quick Xpath
      • From: "Garland foster" <garland_foster@salutia.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