Queries That Return More Than You Want

Suppose you want the titles of all the books. You might decide to define your query like this:

//title
               

            

This query does return all titles of books, but it also returns the title of a magazine. This query instructs the XPath processor to start at the root node, search all descendants, and return all title elements. In bookstore.xml, this means that the query returns the title of the magazine in addition to the titles of books. In some other document, if all titles are contained in book elements, this query returns exactly what you want.

To query and obtain only the titles of books, you can use either of the following queries. They obtain identical results. However, the first query runs faster.

/bookstore/book/title
               
//book/title
               
 
               

            

The first query runs faster because it uses the child axis, while the second query uses the descendent-or-self axis. In general, the simpler axes, such as child, self, parent, and ancestor, are faster than the more complicated axes, such as descendent, preceding, following, preceding-sibling, and following-sibling. This is especially true for large documents. Whenever possible, use a simpler axis.

Apache FOP

Apache FOP is an open-source engine is available from the Apache project that renders XSL-FO into PDF and other popular document formats. Apache FOP is fully integrated with Stylus Studio's XSL:FO tools.

XML Code Folding

Stylus Studio's XML Editor features XML code folding, a powerful and intuitive way to maximize limited screen real-estate and help make sense of large XML files.

Government Agencies That Use Stylus Studio

Government agencies all around the nation are pledging their allegiance to Stylus Studio. Come see which government agencies are using the only XML IDE by the people and for the people.

XQuery Functions - User Defined Functions in XQuery

Dr. Michael Kay's tutorial entitled: 'Defining your own Functions in XQuery' explains how to write powerful User Defined Functions in XQuery.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member