Package net.sf.saxon
Class PreparedStylesheet
- java.lang.Object
-
- net.sf.saxon.expr.instruct.Executable
-
- net.sf.saxon.PreparedStylesheet
-
public class PreparedStylesheet extends Executable
This PreparedStylesheet class represents a Stylesheet that has been prepared for execution (or "compiled").Note that the PreparedStylesheet object does not contain a reference to the source stylesheet tree (rooted at an XSLStyleSheet object). This allows the source tree to be garbage-collected when it is no longer required.
The PreparedStylesheet in XSLT 3.0 represents the set of all packages making up an executable stylesheet.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.instruct.Executable
schemaAware
-
-
Constructor Summary
Constructors Constructor Description PreparedStylesheet(Compilation compilation)
Constructor - deliberately protected
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkSuppliedParameters(GlobalParameterSet params)
Check that all required parameters have been supplied.void
explain(ExpressionPresenter presenter)
Produce an XML representation of the compiled and optimized stylesheet, as a human-readable entityvoid
explainNamedTemplates(ExpressionPresenter presenter)
Explain the expression tree for named templates in a stylesheetPreparedStylesheet
getCachedStylesheet(java.lang.String href, java.lang.String baseURI)
Get a "next in chain" stylesheet.GlobalParameterSet
getCompileTimeParams()
Get the parameters that were set at compile time.Component
getComponent(SymbolicName name)
SerializationProperties
getDeclaredSerializationProperties()
Get the properties for xsl:output, including character maps.StructuredQName
getDefaultInitialTemplateName()
Get the default initial template nameRuleManager
getRuleManager()
Get the RuleManager which handles template rulesStylesheetPackage
getTopLevelPackage()
boolean
isEligibleInitialMode(Component.M component)
Ask whether a mode is eligible for invoking from outside the stylesheetXsltController
newController()
Make a Controller from this stylesheet object.void
putCachedStylesheet(java.lang.String href, java.lang.String baseURI, PreparedStylesheet pss)
Save a "next in chain" stylesheet in compiled form, so that it can be reused repeatedly.void
putNamedTemplate(StructuredQName templateName, NamedTemplate template)
Register the named template with a given namevoid
setComponentIndex(java.util.Map<SymbolicName,Component> index)
Register the index of componentsvoid
setRuleManager(RuleManager rm)
Set the RuleManager that handles template rules-
Methods inherited from class net.sf.saxon.expr.instruct.Executable
addPackage, addQueryLibraryModule, addQueryLocationHintProcessed, checkInitialContextItem, createsSecondaryResult, explainGlobalVariables, fixupQueryModules, getCharacterMapIndex, getConfiguration, getFunctionLibrary, getGlobalContextRequirement, getGlobalParameter, getGlobalParameters, getHostLanguage, getOutputProperties, getOutputProperties, getPackages, getPrimarySerializationProperties, getQueryLibraryModules, getQueryLibraryModules, getQueryModuleWithSystemId, isQueryLocationHintProcessed, isSchemaAware, registerGlobalParameter, setCharacterMapIndex, setConfiguration, setCreatesSecondaryResult, setDefaultOutputProperties, setFunctionLibrary, setGlobalContextRequirement, setHostLanguage, setOutputProperties, setSchemaAware, setTopLevelPackage
-
-
-
-
Constructor Detail
-
PreparedStylesheet
public PreparedStylesheet(Compilation compilation)
Constructor - deliberately protected- Parameters:
compilation
- Compilation options
-
-
Method Detail
-
newController
public XsltController newController()
Make a Controller from this stylesheet object.- Returns:
- the new Controller
- See Also:
Controller
-
getCompileTimeParams
public GlobalParameterSet getCompileTimeParams()
Get the parameters that were set at compile time. These will generally be static parameters, but it is also permitted to set non-static parameters at compile time.- Returns:
- the parameters that were set prior to XSLT compilation
-
checkSuppliedParameters
public void checkSuppliedParameters(GlobalParameterSet params) throws XPathException
Check that all required parameters have been supplied. Also checks that the supplied parameters dynamically do not conflict with parameters supplied statically. Used in XSLT only.- Overrides:
checkSuppliedParameters
in classExecutable
- Parameters:
params
- the set of parameters that have been supplied dynamically to the transformer (null represents an empty set).- Throws:
XPathException
- if there is a required parameter for which no value has been supplied
-
getTopLevelPackage
public StylesheetPackage getTopLevelPackage()
- Overrides:
getTopLevelPackage
in classExecutable
-
setRuleManager
public void setRuleManager(RuleManager rm)
Set the RuleManager that handles template rules- Parameters:
rm
- the RuleManager containing details of all the template rules
-
getRuleManager
public RuleManager getRuleManager()
Get the RuleManager which handles template rules- Returns:
- the RuleManager registered with setRuleManager
-
putNamedTemplate
public void putNamedTemplate(StructuredQName templateName, NamedTemplate template)
Register the named template with a given name- Parameters:
templateName
- the name of a named XSLT templatetemplate
- the template
-
getDefaultInitialTemplateName
public StructuredQName getDefaultInitialTemplateName()
Get the default initial template name- Returns:
- the default initial template name
-
setComponentIndex
public void setComponentIndex(java.util.Map<SymbolicName,Component> index)
Register the index of components- Parameters:
index
- the component index
-
getComponent
public Component getComponent(SymbolicName name)
-
isEligibleInitialMode
public boolean isEligibleInitialMode(Component.M component)
Ask whether a mode is eligible for invoking from outside the stylesheet- Parameters:
component
- the component- Returns:
- true if the component can be referenced from the calling application
-
explainNamedTemplates
public void explainNamedTemplates(ExpressionPresenter presenter) throws XPathException
Explain the expression tree for named templates in a stylesheet- Parameters:
presenter
- destination for the explanatory output- Throws:
XPathException
- if writing to the output fails
-
getDeclaredSerializationProperties
public SerializationProperties getDeclaredSerializationProperties()
Get the properties for xsl:output, including character maps. The object returned will be a clone of the internal values, and thus it can be mutated without affecting the value held in thisPreparedStylesheet
.This method gets the output properties for the unnamed output format in the stylesheet.
- Returns:
- An OutputProperties object reflecting the output properties defined for the default (unnamed) output format in the stylesheet. It may be mutated and supplied to the setOutputProperties() method of the Transformer, without affecting other transformations that use the same stylesheet.
- See Also:
Transformer.setOutputProperties(java.util.Properties)
-
getCachedStylesheet
public PreparedStylesheet getCachedStylesheet(java.lang.String href, java.lang.String baseURI)
Get a "next in chain" stylesheet. This method is intended for internal use.- Parameters:
href
- the relative URI of the next-in-chain stylesheetbaseURI
- the baseURI against which this relativeURI is to be resolved- Returns:
- the cached stylesheet if present in the cache, or null if not
-
putCachedStylesheet
public void putCachedStylesheet(java.lang.String href, java.lang.String baseURI, PreparedStylesheet pss)
Save a "next in chain" stylesheet in compiled form, so that it can be reused repeatedly. This method is intended for internal use.- Parameters:
href
- the relative URI of the stylesheetbaseURI
- the base URI against which the relative URI is resolvedpss
- the prepared stylesheet object to be cached
-
explain
public void explain(ExpressionPresenter presenter) throws XPathException
Produce an XML representation of the compiled and optimized stylesheet, as a human-readable entity- Parameters:
presenter
- defines the destination and format of the output- Throws:
XPathException
- if output fails
-
-