XQuery 1.0

The syntax for declare option saxon:output "parameter=value" now allows the value to be zero-length.

The default serialization options have been changed to align with the defaults in Appendix C.3 of the W3C specification: specifically, the default for indent is now "no". The old default of "yes" can be achieved by setting the value from the command line, from the Java API, from the Query prolog, or from the Saxon configuration file.

For the two serialization parameters doctype-system and doctype-public, supplying "" (a zero-length string) as the value of the parameter is taken as setting the parameter to "absent". This is equivalent to omitting the parameter. For example, this allows a value set in the query prolog to be overridden from the API or from the command line (where the syntax is simply !doctype-system=).

The doc-available() function, when it returns false, now ensures that the document remains unavailable for the rest of the query: previously, if called repeatedly it would check repeatedly, and therefore could return different results on different calls. Also, once doc-available() has returned false, subsequent calls on doc() are now guaranteed to fail. A call on doc-available() that returns false does not prevent the document being created using put(), but any such document will not be available during the same query.

The new function element-with-id(), introduced in the errata for Functions and Operators, is available. It behaves the same as the id() function, except in the case of ID-valued elements, where it returns the parent of the element having the is-ID property, rather than the element itself.

A query that does not use an import schema declaration is now (by default) compiled with schema-awareness disabled. This means that it will not be able to handle schema-typed input documents, or to validate temporary trees created within the query, though it can still validate the final output tree. This is for performance reasons: generating code to handle typed input data when it will not be encountered adds to the execution cost. It is possible to override this setting from the s9api API on Java or from the Saxon.Api on .NET, or from the configuration file. From the command line, schema-awareness is set automatically if the -sa option or any other option implying schema-awareness is used (for example -val:strict). With XQJ, schema-awareness is set automatically if Saxon-EE is loaded.

The amount of compile-time checking when schema-awareness is used has been further increased. In particular, if the expected type of a constructed element is known, Saxon now attempts to check (a) that the sequence constructor delivering the content of the element is capable of delivering a sequence of elements that matches the content model (previously it only checked that each child element could legitimately belong to the content model), and (b) that the sequence constructor is capable of creating each mandatory attribute required by the complex type of the element.

Command line changes

If the filename specified in the -o option is in a directory that does not exist, the directory is now created.

A new option -config:filename is available. This refers to a configuration file in which many configuration options can be specified. Options specified directly on the command line override corresponding options in the configuration file. The format of the configuration file is given in The Saxon configuration file.

A new option is available (-dtd:recover on the command line) to perform DTD validation but treat the error as non-fatal if it fails.

In the command line interface, Saxon-defined serialization parameters can now be defined using a lexical QName, for example !saxon:indent-spaces=3 as an alternative to the Clark-format expanded name.

The command line interface (net.sf.saxon.Query) now allows an external variable to be supplied as the value of an XPath expression. For example, java net.sf.saxon.Query -xsl:style.xsl ?p=current-dateTime() sets the external variable p to the value of the current date and time (as an instance of xs:dateTime). The fact that the value needs to be evaluated as an XPath expression is signalled by the leading "?" before the parameter name. Note that the context for evaluating the expression includes only the "standard" namespaces, no context item, and no variables.

XQJ changes

XQJ support has been updated to the final JSR 225 specification published on 24 June 2009.

This involves the removal of two methods, the overloads of bindDocument() on XQDataFactory and XQDynamicContext that took an XMLReader as argument. It's unlikely anyone was using these methods because the specification was so weird, but it should be easy to replace any call with a call on the overload that accepts a Source (by supplying a StreamSource that wraps the XMLReader).