<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="changes" page="intro92" subpage="xquery1092"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: XQuery 1.0</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: XQuery 1.0"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>XQuery 1.0</h1>
      <p>The syntax for <code>declare option saxon:output "parameter=value"</code> now allows the value to be zero-length.</p>
      <p>The default serialization options have been changed to align with the defaults in Appendix C.3 of the W3C specification:
specifically, the default for <code>indent</code> 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.</p>
      <p>For the two serialization parameters <code>doctype-system</code> and <code>doctype-public</code>,
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
<code>!doctype-system=</code>).</p>
      <p>The <code>doc-available()</code> 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 <code>doc-available()</code> has returned false, subsequent
calls on <code>doc()</code> are now guaranteed to fail. A call on <code>doc-available()</code>
that returns false does not prevent the document being created using <code>put()</code>, but any such
document will not be available during the same query.</p>
      <p>The new function <code>element-with-id()</code>, introduced in the errata for Functions and Operators, is available.
It behaves the same as the <code>id()</code> function, except in the case of ID-valued elements, where it returns the
parent of the element having the <code>is-ID</code> property, rather than the element itself.</p>
      <p>A query that does not use an <code>import schema</code> 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 <code>-val:strict</code>). With XQJ, schema-awareness is set automatically
if Saxon-EE is loaded.</p>
      <p>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.</p>
      <p class="subhead">Command line changes</p>
      <p>If the filename specified in the -o option is in a directory that does not exist, the directory is now created.</p>
      <p>A new option <code>-config:filename</code> 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 
<a class="bodylink" href="../../configuration/configuration-file.xml">The Saxon configuration file</a>.</p>
      <p>A new option is available (<code>-dtd:recover</code> on the command line) to perform DTD validation but treat the error
as non-fatal if it fails.</p>
      <p>In the command line interface, Saxon-defined serialization parameters can now be defined using a lexical QName, for example
<code>!saxon:indent-spaces=3</code> as an alternative to the Clark-format expanded name.</p>
      <p>The command line interface (<code>net.sf.saxon.Query</code>) now allows an external variable to be supplied as the value
of an XPath expression. For example, <code>java net.sf.saxon.Query -xsl:style.xsl ?p=current-dateTime()</code> sets the external
variable <code>p</code> to the value of the current date and time (as an instance of <code>xs:dateTime</code>). 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.</p>
      <p class="subhead">XQJ changes</p>
      <p>XQJ support has been updated to the final JSR 225 specification published on 24 June 2009.</p>
      <p>This involves the removal of two methods, the overloads of <code>bindDocument()</code> on <code>XQDataFactory</code>
 and <code>XQDynamicContext</code> that took an <code>XMLReader</code> 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 <code>Source</code> (by supplying a <code>StreamSource</code> that wraps the <code>XMLReader</code>).</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="updates92.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>