Class XsltExecutable
XsltTransformer
.
An XsltExecutable is immutable, and therefore thread-safe. It is simplest to load a new XsltTransformer each time the stylesheet is to be run. However, the XsltTransformer is serially reusable within a single thread.
An XsltExecutable is created by using one of the compile
methods on the
XsltCompiler
class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Inner class containing information about a global parameter to a compiled stylesheet -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
XsltExecutable
(Processor processor, PreparedStylesheet preparedStylesheet) -
Method Summary
Modifier and TypeMethodDescriptionvoid
explain
(Destination destination) Produce a diagnostic representation of the compiled stylesheet, in XML form.void
export
(OutputStream destination) Produce a representation of the compiled stylesheet, in XML form, suitable for distribution and reloading.void
export
(OutputStream destination, String target) Produce a representation of the compiled stylesheet for a particular target environment, in XML form, suitable for distribution and reloading.Get the names of the xsl:param elements defined in this stylesheet, with details of each parameter including its required type, and whether it is required or optionalGet the Processor that was used to create this XsltExecutableGet the underlying implementation object representing the compiled stylesheet.Get the whitespace stripping policy defined by this stylesheet, that is, the policy defined by the xsl:strip-space and xsl:preserve-space elements in the top-level package of this stylesheetload()
Load the stylesheet to prepare it for execution.load30()
Load the stylesheet to prepare it for execution.
-
Constructor Details
-
XsltExecutable
-
-
Method Details
-
getProcessor
Get the Processor that was used to create this XsltExecutable- Returns:
- the original Processor object
- Since:
- 9.6
-
load
Load the stylesheet to prepare it for execution. This version of the load() method creates anXsltTransformer
which offers interfaces for stylesheet invocation corresponding to those described in the XSLT 2.0 specification. It can be used with XSLT 2.0 or XSLT 3.0 stylesheets, but does not offer new XSLT 3.0 functionality such as the ability to supply parameters to the initial template, or the ability to invoke stylesheet-defined functions, or the ability to return an arbitrary sequence as a result without wrapping it in a document node. If such facilities are required, use the methodload30()
in preference.- Returns:
- An XsltTransformer. The returned XsltTransformer can be used to set up the dynamic context for stylesheet evaluation, and to run the stylesheet.
-
load30
Load the stylesheet to prepare it for execution. This version of the load() method creates anXslt30Transformer
which offers interfaces for stylesheet invocation corresponding to those described in the XSLT 3.0 specification. It can be used with XSLT 2.0 or XSLT 3.0 stylesheets, and in both cases it offers new XSLT 3.0 functionality such as the ability to supply parameters to the initial template, or the ability to invoke stylesheet-defined functions, or the ability to return an arbitrary sequence as a result without wrapping it in a document node.- Returns:
- An Xslt30Transformer. The returned Xslt30Transformer can be used to set up the dynamic context for stylesheet evaluation, and to run the stylesheet.
-
explain
Produce a diagnostic representation of the compiled stylesheet, in XML form.The detailed form of this representation is not stable (or even documented).
Note that although the format of the output is similar to the format of a stylesheet exported in SEF format, it is not identical, and the diagnostic explain output cannot be re-imported to reconstitute the stylesheet. For that purpose, use
export(OutputStream, String)
.- Parameters:
destination
- the destination for the XML document containing the diagnostic representation of the compiled stylesheet- Throws:
SaxonApiException
- if an error is detected- Since:
- 9.1
-
export
Produce a representation of the compiled stylesheet, in XML form, suitable for distribution and reloading. If the configuration under which the export takes place is suitably licensed, then license information will be included in the export file allowing execution of the stylesheet without any additional license.The detailed form of the output representation is not documented.
- Parameters:
destination
- the destination for the XML document containing the diagnostic representation of the compiled stylesheet. The stream will be closed when writing has finished.- Throws:
SaxonApiException
- if the stylesheet was compiled with just-in-time compilation enabled.- Since:
- 9.7
-
export
Produce a representation of the compiled stylesheet for a particular target environment, in XML form, suitable for distribution and reloading. If the configuration under which the export takes place is suitably licensed, then license information will be included in the export file allowing execution of the stylesheet without any additional license.The detailed form of the output representation is not documented.
- Parameters:
destination
- the destination for the XML document containing the diagnostic representation of the compiled stylesheet. The stream will be closed when writing has finished.target
- the target environment (for example "EE" or "JS")- Throws:
SaxonApiException
- if an error is detected, including the case where the stylesheet was compiled with just-in-time compilation enabled.- Since:
- 9.7
-
getWhitespaceStrippingPolicy
Get the whitespace stripping policy defined by this stylesheet, that is, the policy defined by the xsl:strip-space and xsl:preserve-space elements in the top-level package of this stylesheet- Returns:
- a newly constructed WhitespaceStrippingPolicy based on the declarations in
the top-level package of this stylesheet. This policy can be used as input to a
DocumentBuilder
.
-
getGlobalParameters
Get the names of the xsl:param elements defined in this stylesheet, with details of each parameter including its required type, and whether it is required or optional- Returns:
- a Map whose keys are the names of global parameters in the stylesheet,
and whose values are
XsltExecutable.ParameterDetails
objects giving information about the corresponding parameter. - Since:
- 9.3
-
getUnderlyingCompiledStylesheet
Get the underlying implementation object representing the compiled stylesheet. This provides an escape hatch into lower-level APIs. The object returned by this method may change from release to release.- Returns:
- the underlying implementation of the compiled stylesheet
-