11.6 Navigation Axes

Path segment: axis::node-test[index/predicate]

Directions of tree traversal:




axis

comments




self

 

6



child

 

8, 9, 10
descendant

attribute and namespace nodes not included

8, 9, 10, 11, 12
descendant-or-self

 

6, 8, 9, 10, 11, 12
attribute

 

 



parent

 

3
ancestor

 

1,3
ancestor-or-self

 

1, 3, 6



preceding-sibling

empty for attribute and namespace nodes

5
following-sibling

 

7
preceding

nodes preceding the current node

2, 5
following

 

4, 7



namespace

the namespace nodes of the current node




/

root

1



         1|
|------------------|
2        3|       4
   |------------|

  5      6|     7
      |-------|
     8   9|  10
        |--|

       11 12
<article title="red"  
         canvas="yellow">  
  <section>  
    <title>First  
       section</title>  
    <sentence>Some  
       text.</sentence>  
    <sentence>More  
       text.</sentence>  
  </section>  
  <appendix/>  
</document>

child::sentence

select the ‘sentence’ element children of the context node



child::*

all element children



/descendant::sentence/following-sibling::*

 



/child::article/attribute::title

 



//*[ancestor::* and not(ancestor::section)]

 



//*[following-sibling::*[1] = 'Some text.']