Example 4     Previous      Next    

Expresion in square brackets can further specify an element. A number in the brackets gives the position of the element in the selected set. The function last() selects the last element in the selection.
 
/AAA/BBB[1]
Select the first BBB child of element AAA

     <AAA>
          <BBB/>
          <BBB/>
          <BBB/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)
 
/AAA/BBB[last()]
Select the last BBB child of element AAA

     <AAA>
          <BBB/>
          <BBB/>
          <BBB/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)



_____________________________________________
Reference Search | Sitemap | XML Glossary       ZVON | IDOOX