more of an aspiration than a claim

XQuery 1.0 Overview - Querying XML

XQuery (or XML Query) is to XML what SQL is to databases. Recently XQuery 1.0 progressed to W3C “recommendation” status.

XQuery runs into some of the transformation areas of XSLT. XQuery 1.0 and XSLT were developed by seperate W3C groups. XPath 2.0 is a subset of XQuery 1.0 and developed in collaboration with the XSLT group for XSLT use as well.

XQuery has been designed to query XML data and was derived from the Quilt language. This allows users of XQuery to retreive data from XML data collections in a similar way to users of SQL query databases.

XQuery uses what is called a FLWOR expression. This is constructed from the five clauses, FOR, LET, WHERE, ORDER BY and RETURN.

An XQuery is made up of expressions. An example of the syntax taken from the w3.org site follows:

for $d in fn:doc("depts.xml")/depts/deptno
let $e := fn:doc("emps.xml")/emps/emp[deptno = $d]
where fn:count($e) >= 10
order by fn:avg($e/salary) descending
return

{
$d,
{fn:count($e)},
{fn:avg($e/salary)}
}

Data types are defined using XML Schema.

Note that XQuery does not perform updates of XML. This is the province of XUpdate.

It will be interesting to see if XQuery becomes a major part of the programming toolkit.