Enabling 4.0 features

Because the features in the draft 4.0 specifications cannot be considered stable, they are not enabled by default, and in most cases they are not available in Saxon-HE. To enable 4.0 functionality:

  • On the XQuery command line, use the option -qversion:4.0.
  • On the XSLT command line, use the option -xsltversion:4.0.
  • On the XQueryCompiler class, call setLanguageVersion("4.0").
  • On the XsltCompiler class, call setXsltLanguageVersion("4.0").
  • On the XPathCompiler class, call setLanguageVersion("4.0").
  • To use XPath 4.0 in XSD assertions, set the global Configuration property Feature.XPATH_VERSION_FOR_XSD, or set the attribute saxon:extensions="any-xpath-version" on the xs:schema element.

In addition, if only for good documentation, any XSLT stylesheet module that uses 4.0 syntax should specify version="4.0" on the outermost element (xsl:stylesheet, xsl:transform, or xsl:package), and any XQuery module that uses 4.0 syntax should specify xquery version 4.0; in the module header. The effect of using a version declaration that differs from the processor version is defined in the language specifications.

Saxon also recognizes the configuration property ALLOW_SYNTAX_EXTENSIONS to enable both extensions defined in the 4.0 specifications, and Saxon-specific language extensions.