Saxon Configuration File

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 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, and it is probably good practice to only include those parameters that you need to specify explicitly. Some of the example values used in this sample will not work unless you have files with the relevant names at particular locations, or unless you have classes with particular names available on your classpath; if such entries cause problems, you can always delete them.

<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="EE" licenseFileLocation="saxon-license.lic" label="Some label"> <global allowedProtocols="all" allowExternalFunctions="true" allowMultiThreading="true" allowOldJavaUriFormat="false" allowSyntaxExtensions="true" collectionFinder="net.sf.saxon.resource.StandardCollectionFinder" compileWithTracing="false" defaultCollation="http://www.w3.org/2005/xpath-functions/collation/codepoint" defaultCollection="file:///e:/temp" defaultRegexEngine="S" dtdValidation="false" dtdValidationRecoverable="true" eagerEvaluation="true" entityResolver="net.sf.saxon.lib.StandardEntityResolver" environmentVariableResolver="" errorListener="net.sf.saxon.lib.StandardErrorListener" expandAttributeDefaults="true" generateByteCode="true" ignoreSAXSourceParser="false" lazyConstructionMode="false" lineNumbering="true" markDefaultedAttributes="true" maxCompiledClasses="10000" monitorHotSpotByteCode="true" optimizationLevel="10" parser="" preEvaluateDoc="false" preferJaxpParser="true" recognizeUriQueryParameters="true" regexBacktrackingLimit="10000000" retainNodeForDiagnostics="false" schemaValidation="strict" serializerFactory="" sourceResolver="" stableCollectionUri="false" stableUnparsedText="false" standardErrorOutputFile="file:///e:/errorOutput.log" streamability="standard" streamingFallback="true" stripSpace="all" styleParser="" suppressEvaluationExpiryWarning="false" suppressXPathWarnings="false" suppressXsltNamespaceCheck="false" thresholdForFunctionInlining="100" thresholdForHotspotByteCode="100" timing="false" traceExternalFunctions="true" traceListener="net.sf.saxon.trace.XSLTTraceListener" traceOptimizerDecisions="false" treeModel="tinyTreeCondensed" unparsedTextURIResolver="net.sf.saxon.lib.StandardUnparsedTextResolver" uriResolver="net.sf.saxon.lib.StandardURIResolver" usePiDisableOutputEscaping="false" useTypedValueCache="true" validationComments="false" validationWarnings="true" versionOfXml="1.0" xInclude="false" xpathVersionForXsd="20" xpathVersionForXslt="31" /> <xslt disableXslEvaluate="false" enableAssertions="false" initialMode="" initialTemplate="" messageEmitter="" outputUriResolver="" resultDocumentThreads="10" schemaAware="false" staticErrorListener="" staticUriResolver="" styleParser=""> <extensionElement namespace="http://saxon.sf.net/sql" factory="net.sf.saxon.option.sql.SQLElementFactory"/> </xslt> <xsltPackages> <package name="http://package.one/" version="1.0" sourceLocation="packageOne.xsl" exportLocation="packageOne.sef"/> <package name="http://package.one/" version="2.0-beta" sourceLocation="2.0beta/packageOne.xsl" exportLocation="2.0beta/packageOne.sef"/> <package name="http://package.two/" version="8.6.3" sourceLocation="packageTwo.xsl"> <withParam name="debug" select="true()"/> <withParam name="maxTransactions" select="300"/> </package> </xsltPackages> <xquery allowUpdate="true" constructionMode="preserve" defaultElementNamespace="" defaultFunctionNamespace="http://www.w3.org/2005/xpath-functions" emptyLeast="true" inheritNamespaces="true" moduleUriResolver="net.sf.saxon.lib.StandardModuleURIResolver" multipleModuleImports="true" preserveBoundarySpace="false" preserveNamespaces="true" requiredContextItemType="document-node()" schemaAware="false" staticErrorListener="" /> <xsd allowUnresolvedSchemaComponents="false" assertionsCanSeeComments="false" implicitSchemaImports="false" multipleSchemaImports="false" occurrenceLimits="100,250" schemaUriResolver="com.saxonica.config.ee.StandardSchemaResolver" thresholdForCompilingTypes="100" 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.option.xom.XOMObjectModel</externalObjectModel> <extensionFunction>s9apitest.TestIntegrationFunctions$SqrtFunction</extensionFunction> <fileExtension extension="xq" mediaType="text/plain"/> <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.expr.sort.CodepointCollator"/> <collation uri="http://www.microsoft.com/collation/caseblind" class="net.sf.saxon.expr.sort.CodepointCollator"/> <collation uri="http://example.com/french" lang="fr" ignore-case="yes"/> </collations> </configuration>

The configuration element takes three possible attributes:

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.