Specifying Children or Descendants of Parent Nodes

Sometimes you want a query to return information about a sibling of the context node. One way to obtain a sibling is to define a query that navigates up to the parent and then down to the sibling.

For example, suppose the context node is the first author element. You want to find out the title associated with this author. The following query returns the associated title element:

../title
               

            

The double dot ( ..) at the beginning of the query instructs the XPath processor to select the parent of the context node. This query returns the title elements that are children of the first book element, which is the parent of the first author element. In the bookstore.xml document, there is only one such title element.

Now suppose that the context node is still the first author element and you want to obtain the style attribute for the book that contains this author. The following query does this:

../@style
               

            

The double dot notation need not appear at the beginning of a query. It can appear anywhere in a query string, just like the dot notation.

XQuery Tutorial

This XQuery Tutorial is about "BUILDING XQUERY BASED WEB SERVICE AGGREGATION AND REPORTING APPLICATIONS".

Stylus Studio XQuery Innovator Awards

The Stylus Studio® First Annual XQuery Innovator Awards offers enterprise software developers, systems integrators, and XML professionals the opportunity to have their work publicly showcased and gain valuable recognition as XQuery pioneers.

WSDL Editor

WSDL Editor featuring a graphical WSDL viewer, syntax help, Java Web Service code generation and more. Simplify Web Services development with Stylus Studio's Web Service Description Language (WSDL) Editor today!

Create XML Schema from XML Content

Create XML Schema from XML Content by auto-generating an XML Schema with Stylus Studio.

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.