XQuery 1.0 implementation

The changes affecting XPath also affect XQuery.

Improved documentation for the XQuery API is available on the Using XQuery page, and also in the JavaDoc for the relevant classes.

I have implemented the changes to the Query Prolog syntax introduced in the August Working Draft. These include the addition of semicolons as separators between declarations in the prolog; replacement of the keyword "define" by "declare" throughout; removal of the "=" symbol except in "declare namespace"; and relaxing the rules on ordering of declarations.

The declare base-uri declaration in the prolog is now supported.

The default element namespace now works as specified. This is somewhat different from the XSLT specification: in XQuery, the default element namespace affects unprefixed element names whether they appear in element constructors or in path expressions. It isn't possible (as in XSLT 2.0) to specify different defaults for names in the input document and names in the output document. {ns/addq2}

The typeswitch expression is now implemented. {xmp/addq10}

The collation option of the order by clause in a FLWOR expression is now implemented. See Collation URIs for details of the URIs that can be specified. {r/addq1}

Sorting a set of numeric values now handles NaNs correctly (NaNs are considered equal to each other and less than any other value).

Computed comment constructors and processing-instruction constructors are supported. {xmp/addq4}

Entity references and character references are supported in string literals (previously they were supported only in element and attribute content).