saxonica.com

The Saxon configuration file

This facility is not available in Saxon-HE (home edition)

Configuration parameters for Saxon can be defined in a configuration file. This file is optional. It can be applied by using the option -config:filename on the Transform, Query, or Validate command line, or using the factory method Configuration.readConfiguration().

In both the s9api interface on Java, and the Saxon.Api interface on .NET, there is a new constructor on the Processor class that takes a configuration file as input.

Here is an example configuration file. It is designed to show as many options as possible; in practice, no option needs to be included if it is to take its default value.


<configuration xmlns="http://saxon.sf.net/ns/configuration"
               edition="EE">
  <global
    allowExternalFunctions="true"
    collationUriResolver="net.sf.saxon.sort.StandardCollationURIResolver"
    collectionUriResolver="net.sf.saxon.functions.StandardCollectionURIResolver"
    compileWithTracing="false"
    defaultCollation="http://www.w3.org/2005/xpath-functions/collation/codepoint"
    defaultCollection="file:///e:/temp"
    dtdValidation="false"
    dtdValidationRecoverable="true"
    errorListener="net.sf.saxon.StandardErrorListener"
    expandAttributeDefaults="true"
    lazyConstructionMode="false"
    lineNumbering="true"
    optimizationLevel="10"
    preEvaluateDocFunction="false"
    preferJaxpParser="true"
    recognizeUriQueryParameters="true"
    schemaValidation="strict"
    serializerFactory=""
    sourceParser=""
    sourceResolver=""
    stripWhitespace="all"
    styleParser=""
    timing="false"
    traceExternalFunctions="true"
    traceListener="net.sf.saxon.trace.XSLTTraceListener"
    traceOptimizerDecisions="false"
    treeModel="tinyTreeCondensed"
    uriResolver="net.sf.saxon.StandardURIResolver"
    usePiDisableOutputEscaping="false"
    useTypedValueCache="true"
    validationWarnings="true"
    versionOfXml="1.0"
    xInclude="false"
  />

  <xslt
    messageReceiver=""
    outputUriResolver=""
    recoveryPolicy="recoverWithWarnings"
    schemaAware="false"
    staticErrorListener=""
    staticUriResolver=""
    styleParser=""
    versionWarning="false">
    <extensionElement namespace="http://net.sf.saxon/sql" 
        factory="net.sf.saxon.option.sql.SQLElementFactory"/>
  </xslt>

  <xquery
    allowUpdate="true"
    constructionMode="preserve"
    defaultElementNamespace=""
    defaultFunctionNamespace="http://www.w3.org/2005/xpath-functions"
    emptyLeast="true"
    inheritNamespaces="true"
    moduleUriResolver="net.sf.saxon.query.StandardModuleURIResolver"
    preserveBoundarySpace="false"
    preserveNamespaces="true"
    requiredContextItemType="document-node()"
    schemaAware="false"
    staticErrorListener=""
    version="1.1"
    />
    
  <xsd
    occurrenceLimits="100,250"
    schemaUriResolver="com.saxonica.sdoc.StandardSchemaResolver"
    useXsiSchemaLocation="false"
    version="1.1"
  />
  
  <serialization
    method="xml"
    indent="yes"
    saxon:indent-spaces="8"
    xmlns:saxon="http://saxon.sf.net/"/>
    
  <localizations defaultLanguage="en" defaultCountry="US">
    <localization lang="da" class="net.sf.saxon.option.local.Numberer_da"/>
    <localization lang="de" class="net.sf.saxon.option.local.Numberer_de"/>
  </localizations>
  
  <resources>
    <externalObjectModel>net.sf.saxon.xom.XOMObjectModel</externalObjectModel>
    <extensionFunction>s9apitest.TestIntegrationFunctions$SqrtFunction</extensionFunction>
    <schemaDocument>file:///c:/MyJava/samples/data/books.xsd</schemaDocument>
    <schemaComponentModel/>
  </resources>
  
  <collations>
    <collation uri="http://www.w3.org/2005/xpath-functions/collation/codepoint" 
               class="net.sf.saxon.sort.CodepointCollator"/>
    <collation uri="http://www.microsoft.com/collation/caseblind" 
               class="net.sf.saxon.sort.CodepointCollator"/>
    <collation uri="http://example.com/french" lang="fr" ignore-case="yes"/>
  </collations>  
</configuration>

The configuration element takes a single attribute, edition, whose value indicates the Saxon edition in use: HE (home edition), PE (professional edition), or EE (enterprise edition). The default value is HE. If PE or EE is specified, then the appropriate license file must be installed.

The children of the configuration element may appear in any order.

The contents of the different sections of the configuration file are described in the following subsections.

Next