XQuery is intended to work with single XML documents or collections of XML documents. In addition, XQuery will be able to query XML document fragments or collections of fragments. It borrows syntax from XSLT 1.0 and XPath 1.0.
For example, to query the chapter elements in a document named book.xml, we could use an XQuery expression—a path expression—such as the following:
As you can see, an XQuery expression is not written in XML. You might recognize the use of the document() function from XSLT 1.0 and a path expression, //chapter, from XPath 1.0. Less basic XQuery expressions add XQuery-specific syntax.
XQuery is not the first attempt at an XML query language. Other such query languages include ...