Chapter 6. XQuery for eXist

Most of your work using eXist will be done in the XQuery programming language. This chapter covers what is and is not supported. It will also describe some eXist XQuery specifics, like controlling serialization and available pragmas.

eXist’s XQuery Implementation

Currently, 2.0+ versions of eXist support almost the full XQuery 1.0 specification (as eXist has done for years) and quite a lot of XQuery 3.0. This section will provide you with the details.

XQuery 1.0 Support

eXist implements almost all of the full XQuery 1.0 specification, with the following exceptions:

  • eXist’s XQuery processor does not support the schema import and schema validation features. This is perfectly reasonable as they are defined as optional in the XQuery specification (validate and import schema). The database does not store type information along with the (values of) nodes; consequently it cannot know the typed value of a node and has to assume xs:untypedAtomic. This is compliant with the behavior defined by the XQuery specification.

  • You cannot specify a data type in an element or attribute test. eXist suports the node test element(test-node), but the test element(test-node, xs:integer) results in a syntax error.


The absence of the features does not mean that eXist is not type-safe; it is, very much so. It only means that type checking based on schema imports is not implemented.

eXist tested its implementation against the official XQuery Test Suite (XQTS version 1.0.2). Of the more ...

Get eXist now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.