Saxonica.com

Changes to XQuery

The new syntax declare variable $x := expr; is supported in the query prolog. For the time being the old syntax declare variable $x { expr }; is also supported.

A constructed element no longer inherits the namespaces of its new parent. Note that this is equivalent to inherit-namespaces="no" in XSLT. The difference will probably not be noticeable unless the result is serialized with version="1.1" undeclare-namespaces="yes". (Since this change was implemented, the XQuery WG has decided to add a declaration to the Query prolog to control whether namespaces are inherited, with the default being "yes". Saxon has not yet implemented this change.)

XML-like entity references and character references are now recognized in the fixed text portions of attribute values within a direct element constructor, for example, <a ampersand="&amp;"/>

Attribute values within direct element constructors may now double the delimiting quotation mark to represent itself, for example <quote phrase="She said, ""I won't"""/>.

The extension functions saxon:evaluate, saxon:expression, and saxon:eval are now available under XQuery as well as XSLT.

The syntax for declare ordering in the Query Prolog, and for the ordered{} and unordered{} expressions, is accepted. In Saxon these currently have no effect on the result of the query: the result order will always be predictable. (Since unordered allows the results to be delivered in any order, this is a conformant implementation).

It is now possible to have two functions with the same name, provided they have different arity (number of arguments).

Values of external variables supplied on the command line are now treated as untypedAtomic values rather than strings. This means they will automatically be cast to the required type. For example, if $p has a required type of xs:integer, you can now specify p=3 on the command line, whereas this would previously have given a type error.

Line endings within the character content of a direct element constructor are now normalized (according to the XML 1.1 rules). In particular, the Windows line ending CRLF is treated as equivalent to a single newline character.

Invalid content in a computed comment or processing instruction is now a fatal error.

The default collation if none is specified in the query prolog is now the Unicode codepoint collation (it was previously a collation based on the Java locale).

The query prolog may now contain the declaration declare default order empty greatest|least.

Some of the new extension functions described below, such as saxon:for-each-group, saxon:analyze-string, and saxon:format-date will be of particular interest in XQuery as they provide capabilities missing from the W3C language specification.

Next