Wildcards in Queries

In a query, you can include an asterisk (*) to represent all elements. For example:

/bookstore/book/*
               

            

This query searches for all book elements in bookstore. For each book element, this query returns all child elements that the book element contains.

The * collection returns all elements that are children of the context node, regardless of their tag names.

The next query finds all last-name elements that are grandchildren of book elements in the current context:

book/*/last-name 
               

            

The following query returns the grandchild elements of the current context.

*/* 
               

            

Restrictions

Usually, the asterisk (*) returns only elements. It does not return processing instructions, attributes, or comments, nor does it include attributes or comments when it maintains a count of nodes. For example, the following query returns title elements. It does not return style attributes.

/bookstore/book/*[1]
               

            

Wildcards in strings are not allowed. For example, you cannot define a query such as the following:

/bookstore/book[author=" A* "]
               

            

Attributes

To use a wildcard for attributes, you can specify @*. For example:

/bookstore/book/@*
               

            

For each book element, this query returns all attributes. It does not return any elements.

XQuery Talk

Join the XQuery Talk mailing list for a practical discussion about XQuery. It's a place to work together to learn a new language, talk about problem solutions, discuss engines and implementations, chat about the latest XQuery news and more.

XQuery Documentation Generator

Stylus Studio provides integrated support for xqDoc so you can generate XQuery documentation directly from the XQuery editor.

EDIFACT Standards Available Across All Versions

The complete EDIFACT Standards Grid, listing all EDIFACT versions across the top, and the corresponding messages down the left side.

XHTML Tools

Powerful XHTML Tools for converting HTML to XHTML, validating XHTML, transforming XML to XHTML, editing JSP, creating XML driven Websites and more.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member