SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
» | Introduction
| Running XQuery from the Command Line
| Invoking XQuery from Java
| Calling XQuery Functions from Java
| Result Format
| Extensibility
| Extensions
| Use Cases
Handling Source Documents
XML Schema Processing
The XPath API
Standards Conformance
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
XSLT Patterns

# Using XQuery

This section describes how to use Saxon as an XQuery processor, either from the command line, or from the Java API.

For details of how to set up collation URIs for use in XQuery, see Implementing a Collating Sequence

Saxon supports XQuery 1.0 as well as XSLT 2.0.

The run-time code for both languages is identical, reflecting the fact that they have very similar semantics. Most of the compile-time code (in particular, the type checking logic and the optimizer) is also common. The XQuery support in Saxon consists essentially of an XQuery parser (which is itself an extension of the XPath parser); the parser generates the same internal interpretable code as the XSLT processor.

The XQuery processor may be invoked either from the operating system command line, or via an API from a Java application. There is no graphical user interface provided.

Saxon is an in-memory processor. Whether you use XSLT or XQuery, Saxon is designed to process source documents that fit in memory. Saxon has been used successfully to process source documents of 100Mbytes or more, but if you attempt anything this large, you need to be aware (a) that you will need to allocate sufficient memory to the Java VM (at least 5 times the size of the source document), and (b) that complex FLWR expressions may be very time-consuming to execute. In fact, large documents are currently easier to process efficiently using XSLT, which offers the `xsl:key` facility for efficient direct access.

Next