Example 5     Previous      Next    

Attributes are specified by @ prefix.
 
//@id
Select all attributes @id

     <AAA>
          <BBB id = "b1"/>
          <BBB id = "b2"/>
          <BBB name = "bbb"/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)
 
//BBB[@id]
Select BBB elements which have attribute id

     <AAA>
          <BBB id = "b1"/>
          <BBB id = "b2"/>
          <BBB name = "bbb"/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)
 
//BBB[@name]
Select BBB elements which have attribute name

     <AAA>
          <BBB id = "b1"/>
          <BBB id = "b2"/>
          <BBB name = "bbb"/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)
 
//BBB[@*]
Select BBB elements which have any attribute

     <AAA>
          <BBB id = "b1"/>
          <BBB id = "b2"/>
          <BBB name = "bbb"/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)
 
//BBB[not(@*)]
Select BBB elements whithout an attribute

     <AAA>
          <BBB id = "b1"/>
          <BBB id = "b2"/>
          <BBB name = "bbb"/>
          <BBB/>
     </AAA>
Open the example in XLab. | Tree view (PNG)



_____________________________________________
Reference Search | Sitemap | XML Glossary       ZVON | IDOOX