Obtaining a Union

Specify the | operator to combine collection sets. For example, the following query returns all last-name elements and all first-name elements in the current context:

first-name | last-name 
               

            

The result set can contain zero or more of each element that the | operator applies to. For example, using the previous query, it is possible for the query to contain only first-name elements if no last-name elements are found. The following query finds all book elements and magazine elements in the bookstore element:

/bookstore/book | /bookstore/magazine 
               

            

The next query finds all books and all authors in the current context:

book | book/author 
               

            

The next query returns the first names, last names, and degrees of authors of books or magazines in the current context:

((book | magazine)/author/first-name) | 
               
(book | magazine)/author/last-name | 
               
(book | magazine)/author/degree) )
               

            

A union can appear only as the first step in a location path expression. Consequently, the following is incorrect because there is a union specification that is not in the first step of a location path expression.

(book | magazine)/author/(first-name | last-name | degree)
               

            

The following query finds all books for which the author's first name is Bob and all magazines with prices less than 10 dollars:

/bookstore/book[author/first-name = "Bob"] | magazine[price < 10] 
               

            

XML Schema Quality Checker

Use IBM's alphaWorks XML Schema Quality Checker to check the quality and style of your XML schema documents. Fully integrated with the Stylus Studio XML Schema Editor and XML validator.

EDI to XML Mapping

A tutorial on how to transform EDI files into XML using Stylus Studio's Convert to XML tool. Subsequent post-processing of the converted EDI data is done through XQuery or XSLT, modeling a real world XML data integration application.

Create XML Views of Relational Data Using DataDirect XQuery

DataDirect XQuery simplifies creating, querying and updating of relational databases as XML including Microsoft SQL Server, Oracle, IBM DB2, Sybase and Informix.

Learn XQuery

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

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.