B2B Integration : Trading Networks Administrator's Guide : XQL Reference : Example XQL Queries
Example XQL Queries
The following lists sample XQL queries.
/bookstore
Find the root element (bookstore) of the document
//author
Find all author elements anywhere within the current document.
//author/first-name
Find all first-name elements within an author element anywhere in the current document.
bookstore/*/title
Find all title elements that are grandchildren of bookstore elements.
//@style
Find all style attributes anywhere within the current document.
bookstore/book/price/@exchange
Find the exchange attributes of price elements that are contained inside book elements that are contained in a bookstore element.
//book[excerpt]
Anywhere within the current document, find all book elements containing at least one child excerpt element.
//book[excerpt]/author[degree]
Anywhere within the current document, find all author elements containing at least one child degree element that are contained inside a book element that has at least one excerpt element.
//book[excerpt][title]
Anywhere within the current document, find all book elements containing at least one excerpt element and at least one title element.
//author[(degree $or$ award) $and$ publication]
Anywhere within the current document, find all author elements that contain at least one degree element or award element and at least one publication element.
//degree[@from $ne$ 'Harvard']
Anywhere within the current document, find all degree elements where the from attribute is not equal to Harvard.
//(book/author)[end()]
Anywhere within the current document, find the last author element from the entire set of author elements that are contained within book elements.
//my:book
Anywhere within the current document, find all book elements with the namespace my.
/*/my:book/my:title
Find the title element with a my prefix within a book element with a my prefix that is a child of the root node of the document.
//book[index() $le$ 1]
Find the first two books anywhere within the current document.
//author[publication!count() $gt$ 1]
Anywhere within the current document, find all author elements that contain more than one publication element.
//author[$any$ last-name = 'Bob']
Find all author elements where at least one of the last-name elements is "Bob" anywhere within the current document.
//book $union$ //book/author
Anywhere within the current document, find all book elements and all author elements that are children of book elements.
/bookstore/book/author[last-name/regex('Bo.')]
Find all the author elements that have last-name elements that contain the string "Bo." and another single character.
//book[@style/regex("no.*")]
Find all the book elements that have a style attribute that contains the regular expression pattern "no.*"
/comment()[0]
Find the first comment element starting from the root of the current document.
Copyright © 2016- 2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback