fn:transform

Invokes a transformation using a dynamically-loaded XSLT stylesheet.

transform($options as map(*)) ➔ map(*)

Arguments

 

$options

map(*)

The input options for the transformation

Result

map(*)

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

Saxon availability

Available in XPath 3.1, XSLT 3.0, and XQuery 3.1. From Saxon 9.8, available in all editions. Implemented in Saxon-PE and Saxon-EE since Saxon 9.7.

Notes on the Saxon implementation

Available since Saxon 9.7. The input options available are listed in the specification, with the additions and caveats noted below.

Prior to Saxon 9.8.0.8, the vendor-options parameter allowed entries of the form "vendor-options": map { QName('http://saxon.sf.net/feature/', 'defaultLanguage'): 'de'} to set configuration options for the transformation. This feature has been withdrawn (see bug 3624) because the configuration options were set globally (affecting the caller's configuration as well as that of the target transformation) which could cause obscure failures.

From Saxon 9.8.0.8, the vendor-options parameter allows an entry of the form "vendor-options": map {QName('http://saxon.sf.net/', 'configuration'): $config} where $config is the root node of a configuration file expressed as an XML tree. If this option is present, the target transformation is run in a different configuration from the calling application, so that settings in the configuration file do not affect the environment of the caller. The calling and called configurations share the same NamePool and document number pool, so that XDM nodes can be safely passed from one environment to the other; however they do not share the same schema components, so typed (schema-validated) documents cannot be passed.

Options that can usefully be set in the target configuration file include the URIs and locations of schema documents and of XSLT library packages.

An additional top-level option source-location is available. This has the same effect as source-node except that it supplies the location of a source (lexical XML) document rather than a parsed XDM tree. This option is useful if the target transformation is streamed; it has been added as an extension to the spec because there is no other way of executing a stylesheet that expects a streamed input document.

Validation of source documents may be requested either (a) by supplying a configuration file in which the option <global schemaValidation="strict"/> has been set, or (b) by setting the option "vendor-options": map {QName('http://saxon.sf.net/', 'schema-validation'): 'strict'}. (The value 'lax' can also be used.) Either option affects documents supplied using the source-node, source-location, or global-context-item options. Setting the option in the configuration file also affects documents read using the doc() or document() functions. Neither option affects documents supplied in the initial-match-selection option, or in any of the xxx-params options (such as stylesheet-params).