Neighboring Siblings?

 

Found an Interesting observation on C.M.Spielberg McQueen’s Blog – XPath 1.0 describes, amongst other axes, ones that allow access to immediate parent and immediate child nodes, as well as access to ancestor and descendant node-sets, but does not provide for immediate siblings – The only way to access these are via predicates – preceding-sibling::*[1] or following-sibling::*[1], and not explicit next-sibling and a previous-sibling axes.

 

Comments:

And there is no "sibling-or-self" axis, such as for example "following-sibling-or-self" - which causes problems when you are trying to find a certain node and its following siblings.

A work-around that works when there are preceding siblings (not part of the match) is to move to the immediate preceding sibling before doing a following-sibling call. But, of course, when there are no such preceding siblings, you can't use that technique.

Posted by guest on October 23, 2011 at 10:50 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Principal Product Manager

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today