Examples of XPath Expression Results

Table 84 provides examples of XPath expression results:

Expression
Result

              /a
               

            
Returns the document element of the document if it is an a element

              /a/b
               

            
Returns all b elements that are immediate children of the document element, which is the a element

              //a
               

            
Returns all a elements in the document

              //a/b
               

            
Returns all b elements that are immediate children of a elements that are anywhere in the document

              a or ./a
               

            
Returns all a elements that are immediate children of the context node

              a/b
               

            
Returns all b elements that are immediate children of a elements that are immediate children of the context node

              a//b
               

            
Returns all b elements that descend from a elements that are immediate children of the context node

              .//a
               

            
Returns all a elements in the document tree branch that starts with the context node

              ../a
               

            
Returns all a elements in the document tree branch that are children of the parent node of the context node.
Table 84. XPath Expression Results

Learn XQuery Visually

Stylus Studio offers three infomative XQuery demonstration videos illustrating Stylus Studio's XQuery Editor, Mapper, Debugger and other advanced functionality. Watch them today!

XML Schema Library

The Stylus Studio XML Schema Library provides a detailed reference of many of the world's most commonly used XML vocabularies in an easy-to-read format.

XML Schema Validation

Validate XML using XML Schema with MSXML, XERCES, XSV, SYSTEM.XML, & other XSD Validators. Stylus Studio's XML Schema-Aware XML Editing makes XML Schema Validation a snap!

Using DTD in Java Applications

Learn how to validate XML documents using industry-standard DTD's from within your Java applications using Java DTD components including Apache Xerces and XSV.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member