Package net.sf.saxon.instruct
Class Executable
java.lang.Object
net.sf.saxon.instruct.Executable
- All Implemented Interfaces:
Serializable
A compiled stylesheet or a query in executable form.
Note that the original stylesheet tree is not retained.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an XQuery library module to the configuration.void
addRequiredParam
(int fingerprint) Add a required parametervoid
Check that all required parameters have been suppliedvoid
Fix up global variables and functions in all query modules.Get the index of named character mapsGet the table of collationsGet the index of global variablesGet the configurationGet the DecimalFormatManager which handles decimal-format definitionsGet the default collationGet the name of the default collationGet the default output propertiesGet the library containing all the in-scope functions in the static contextGet the global variable mapint
Get the host languageGet the KeyManager which handles key definitionsint
Determine the size of the stack frame needed for evaluating match patternsGet the location mapgetNamedCollation
(String name) Find a named collation.getNamedTemplate
(int fingerprint) Get the named template with a given name.Get the named template table.getOutputProperties
(int fingerprint) Get a named output formatgetQueryLibraryModules
(String namespace) Locate the known XQuery library modules for a given module namespace.Determine whether this executable can be compiled; and if it can't, return the reason whyGet the RuleManager which handles template rulesGet the rules determining which nodes are to be stripped from the treevoid
initialiseBindery
(Bindery bindery) Allocate space in bindery for all the variables neededCreate a Stripper which handles whitespace stripping definitionsvoid
putNamedTemplate
(int fingerprint, Template template) Register the named template with a given namevoid
registerGlobalVariable
(GlobalVariable variable) Register a global variablevoid
Set the index of named character mapsvoid
setCollationTable
(CollationMap table) Set the table of collationsvoid
setConfiguration
(Configuration config) Set the configurationvoid
Set the DecimalFormatManager which handles decimal-format definitionsvoid
Set the default collationvoid
setDefaultOutputProperties
(Properties properties) Set the default output properties (the properties for the unnamed output format)void
setFunctionLibrary
(FunctionLibrary functionLibrary) Set the library containing all the in-scope functions in the static contextvoid
setHostLanguage
(int language) Set the host languagevoid
Set the KeyManager which handles key definitionsvoid
Set the location mapvoid
setOutputProperties
(int fingerprint, Properties properties) An a named output formatvoid
setPatternSlotSpace
(int patternLocals) Set the space requirements for variables used in template match patternsvoid
setReasonUnableToCompile
(String reason) If this Executable can't be compiled, set a message explaining whyvoid
Set the RuleManager that handles template rulesvoid
setStripperRules
(Mode rules) Set the rules determining which nodes are to be stripped from the treevoid
setStripsInputTypeAnnotations
(boolean strips) Set whether source documents are to have their type annotations strippedvoid
setStripsWhitespace
(boolean strips) Indicate that the stylesheet does some whitespace strippingboolean
Determine whether source documents are to have their type annotations strippedboolean
Determine whether this stylesheet does any whitespace stripping
-
Constructor Details
-
Executable
public Executable()
-
-
Method Details
-
setConfiguration
Set the configuration -
getConfiguration
Get the configuration -
setHostLanguage
public void setHostLanguage(int language) Set the host language -
getHostLanguage
public int getHostLanguage()Get the host language- Returns:
- a value identifying the host language:
Configuration.XQUERY
orConfiguration.XSLT
orConfiguration.JAVA_APPLICATION
-
setRuleManager
Set the RuleManager that handles template rules- Parameters:
rm
- the RuleManager containing details of all the template rules
-
getRuleManager
Get the RuleManager which handles template rules- Returns:
- the RuleManager registered with setRuleManager
-
getNamedTemplateTable
Get the named template table. Provided for use by tools allowing selection of a transformation entry point from a supplied list.- Returns:
- a hash table containing entries that map the names of named templates (in the form of namePool fingerprints) to the Template objects representing the compiled xsl:template element in the stylesheet.
-
getNamedTemplate
Get the named template with a given name.- Parameters:
fingerprint
- The namepool fingerprint of the template name- Returns:
- The template (of highest import precedence) with this name if there is one; null if none is found.
-
putNamedTemplate
Register the named template with a given name -
getFunctionLibrary
Get the library containing all the in-scope functions in the static context- Returns:
- the function libary
-
setFunctionLibrary
Set the library containing all the in-scope functions in the static context- Parameters:
functionLibrary
- the function libary
-
setCharacterMapIndex
Set the index of named character maps- Parameters:
cmi
- a hash table that maps the names of character maps to the HashMap objects representing the character maps
-
getCharacterMapIndex
Get the index of named character maps- Returns:
- the hash table that maps the names of character maps to the HashMap objects representing the character maps
-
setStripperRules
Set the rules determining which nodes are to be stripped from the tree- Parameters:
rules
- a Mode object containing the whitespace stripping rules. A Mode is generally a collection of template rules, but it is reused here to represent a collection of stripping rules.
-
getStripperRules
Get the rules determining which nodes are to be stripped from the tree- Returns:
- a Mode object containing the whitespace stripping rules. A Mode is generally a collection of template rules, but it is reused here to represent a collection of stripping rules.
-
setStripsWhitespace
public void setStripsWhitespace(boolean strips) Indicate that the stylesheet does some whitespace stripping- Parameters:
strips
- true if the stylesheet performs whitespace stripping of one or more elements.
-
newStripper
Create a Stripper which handles whitespace stripping definitions- Returns:
- the constructed Stripper object
-
stripsWhitespace
public boolean stripsWhitespace()Determine whether this stylesheet does any whitespace stripping- Returns:
- true if the stylesheet performs whitespace stripping of one or more elements.
-
setStripsInputTypeAnnotations
public void setStripsInputTypeAnnotations(boolean strips) Set whether source documents are to have their type annotations stripped -
stripsInputTypeAnnotations
public boolean stripsInputTypeAnnotations()Determine whether source documents are to have their type annotations stripped -
setKeyManager
Set the KeyManager which handles key definitions- Parameters:
km
- the KeyManager containing the xsl:key definitions
-
getKeyManager
Get the KeyManager which handles key definitions- Returns:
- the KeyManager containing the xsl:key definitions
-
setDefaultOutputProperties
Set the default output properties (the properties for the unnamed output format)- Parameters:
properties
- the output properties to be used when the unnamed output format is selected
-
getDefaultOutputProperties
Get the default output properties- Returns:
- the properties for the unnamed output format
-
setOutputProperties
An a named output format- Parameters:
fingerprint
- the name of the output formatproperties
- the properties of the output format
-
getOutputProperties
Get a named output format- Parameters:
fingerprint
- the name of the output format- Returns:
- properties the properties of the output format. Return null if there are no output properties with the given name
-
setDecimalFormatManager
Set the DecimalFormatManager which handles decimal-format definitions- Parameters:
dfm
- the DecimalFormatManager containing the named xsl:decimal-format definitions
-
getDecimalFormatManager
Get the DecimalFormatManager which handles decimal-format definitions- Returns:
- the DecimalFormatManager containing the named xsl:decimal-format definitions
-
setDefaultCollationName
Set the default collation- Parameters:
name
- the name of the default collation
-
getDefaultCollationName
Get the name of the default collation- Returns:
- the name of the default collation; this is the code point collation URI if no other default has been set up.
-
getDefaultCollation
Get the default collation- Returns:
- a Comparator that implements the default collation
-
setCollationTable
Set the table of collations- Parameters:
table
- a hash table that maps collation names (URIs) to objects representing the collation information
-
getCollationTable
Get the table of collations- Returns:
- a hash table that maps collation names (URIs) to objects representing the collation information
-
getNamedCollation
Find a named collation.- Parameters:
name
- identifies the name of the collation required; null indicates that the default collation is required- Returns:
- the requested collation, or null if the collation is not found
-
addQueryLibraryModule
Add an XQuery library module to the configuration. The Executable maintains a table indicating for each module namespace, the set of modules that have been loaded from that namespace. If a module import is encountered that specifies no location hint, all the known modules for that namespace are imported. -
getQueryLibraryModules
Locate the known XQuery library modules for a given module namespace.- Parameters:
namespace
- the module namespace URI- Returns:
- a list of items each of which is the StaticQueryContext representing a module, or null if the module namespace is unknown
-
fixupQueryModules
Fix up global variables and functions in all query modules. This is done right at the end, because recursive imports are permitted- Throws:
XPathException
-
setPatternSlotSpace
public void setPatternSlotSpace(int patternLocals) Set the space requirements for variables used in template match patterns- Parameters:
patternLocals
- The largest number of local variables used in the match pattern of any template rule
-
getGlobalVariableMap
Get the global variable map- Returns:
- the SlotManager defining the allocation of slots to global variables
-
getCompiledGlobalVariables
Get the index of global variables- Returns:
- the index of global variables. This is a HashMap in which the key is the integer fingerprint of the variable name, and the value is the GlobalVariable object representing the compiled global variable
-
registerGlobalVariable
Register a global variable -
initialiseBindery
Allocate space in bindery for all the variables needed- Parameters:
bindery
- The bindery to be initialized
-
getLargestPatternStackFrame
public int getLargestPatternStackFrame()Determine the size of the stack frame needed for evaluating match patterns -
setLocationMap
Set the location map -
getLocationMap
Get the location map -
addRequiredParam
public void addRequiredParam(int fingerprint) Add a required parameter -
checkAllRequiredParamsArePresent
Check that all required parameters have been supplied- Throws:
XPathException
-
setReasonUnableToCompile
If this Executable can't be compiled, set a message explaining why -
getReasonUnableToCompile
Determine whether this executable can be compiled; and if it can't, return the reason why- Returns:
- null if the executable can be compiled, or a message otherwise
-