Package net.sf.saxon.expr.instruct
Class Executable
java.lang.Object
net.sf.saxon.expr.instruct.Executable
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
PreparedStylesheet
A compiled stylesheet or a query in executable form.
Note that the original stylesheet tree is not retained.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExecutable(Configuration config) Create a new Executable (a collection of stylesheet modules and/or query modules) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddQueryLibraryModule(QueryModule module) Add an XQuery library module to the configuration.voidAdd a name to the list of query module location hints that have been processed during the construction of this executablevoidaddRequiredParam(StructuredQName qName) Add a required parameter.voidCheck that all required parameters have been supplied.booleanAsk whether this executable represents a stylesheet that uses xsl:result-document to create secondary output documentsvoidexplainGlobalVariables(ExpressionPresenter presenter) Explain (that is, output an expression tree) the global variablesvoidfixupQueryModules(QueryModule main, boolean checkForCycles) 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 default output propertiesGet the library containing all the in-scope functions in the static contextGet the global variable with a given nameGet the global variable mapintGet the host languageGet the the name of the variable that will implicitly contain the value of the initial context item.Get the KeyManager which handles key definitionsintDetermine the size of the stack frame needed for evaluating match patternsGet the location mapgetNamedCollation(String name) Find a named collation.Get a named output formatGet an iterator over all the query library modules (does not include the main module)getQueryLibraryModules(String namespace) Locate the known XQuery library modules for a given module namespace.getQueryModuleWithSystemId(String systemId, QueryModule topModule) Get the query library module with a given systemIDGet the rules determining which nodes are to be stripped from the treevoidinitializeBindery(Bindery bindery) Allocate space in bindery for all the variables neededbooleanAsk whether XPath 3.0 functionality is enabledbooleanAsk whether a query module location hint has already been processedbooleanAsk whether this executable is schema-aware, that is, whether the query or transformation imports a schema.voidregisterGlobalVariable(GlobalVariable variable) Register a global variablevoidSet the index of named character mapsvoidsetCollationMap(CollationMap table) Set the table of collationsvoidsetConfiguration(Configuration config) Set the configurationvoidsetCreatesSecondaryResult(boolean flag) Set whether this executable represents a stylesheet that uses xsl:result-document to create secondary output documentsvoidsetDefaultOutputProperties(Properties properties) Set the default output properties (the properties for the unnamed output format)voidsetFunctionLibrary(FunctionLibraryList functionLibrary) Set the library containing all the in-scope functions in the static contextvoidsetHostLanguage(int language, boolean allowXPath30) Set the host languagevoidSet the name of the variable that will implicitly contain the value of the initial context item.voidSet the KeyManager which handles key definitionsvoidSet the location mapvoidsetOutputProperties(StructuredQName qName, Properties properties) Add a named output formatvoidsetPatternSlotSpace(int patternLocals) Set the space requirements for variables used in template match patternsvoidsetSchemaAware(boolean aware) Set whether this executable is schema-aware.voidSet the rules determining which nodes are to be stripped from the treevoidsetStripsInputTypeAnnotations(boolean strips) Set whether source documents are to have their type annotations strippedvoidsetStripsWhitespace(boolean strips) Indicate that the stylesheet does some whitespace strippingbooleanAsk whether source documents are to have their type annotations strippedbooleanDetermine whether this stylesheet does any whitespace stripping
-
Constructor Details
-
Executable
Create a new Executable (a collection of stylesheet modules and/or query modules)- Parameters:
config- the Saxon Configuration
-
-
Method Details
-
setConfiguration
Set the configuration- Parameters:
config- the Configuration
-
getConfiguration
Get the configuration- Returns:
- the Configuration
-
setHostLanguage
public void setHostLanguage(int language, boolean allowXPath30) Set the host language- Parameters:
language- the host language, as a constant such asConfiguration.XSLTorConfiguration.XQUERYallowXPath30- true if functionality defined in XPath 3.0 (for example, new casting options) is enabled
-
getHostLanguage
public int getHostLanguage()Get the host language- Returns:
- a value identifying the host language:
Configuration.XQUERYorConfiguration.XSLTorConfiguration.JAVA_APPLICATION
-
isAllowXPath30
public boolean isAllowXPath30()Ask whether XPath 3.0 functionality is enabled- Returns:
- true of XPath 3.0 (and/or XSLT 3.0, XQuery 3.0) functionality can be used
-
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 IntHashMap 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 SpaceStrippingRule object containing the whitespace 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.
-
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- Parameters:
strips- true if type annotations are to be stripped
-
stripsInputTypeAnnotations
public boolean stripsInputTypeAnnotations()Ask whether source documents are to have their type annotations stripped- Returns:
- true if type annotations are stripped from source documents
-
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
Add a named output format- Parameters:
qName- the structured QName of the output formatproperties- the properties of the output format
-
getOutputProperties
Get a named output format- Parameters:
qName- 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
-
setCollationMap
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.- Parameters:
module- the library module to be added to this executable
-
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
-
getQueryModuleWithSystemId
Get the query library module with a given systemID- Parameters:
systemId- the SystemId of the required moduletopModule- the top-level query module (usually a main module, except when importing library modules into XSLT)- Returns:
- the module with that system id if found, otherwise null
-
getQueryLibraryModules
Get an iterator over all the query library modules (does not include the main module)- Returns:
- an iterator whose returned items are instances of
QueryModule
-
addQueryLocationHintProcessed
Add a name to the list of query module location hints that have been processed during the construction of this executable- Parameters:
uri- the name to be added (the location URI as it appears in the "import module" declaration, expanded to an absolute URI by resolving against the base URI, but before passing to the Module Resolver)
-
isQueryLocationHintProcessed
Ask whether a query module location hint has already been processed- Parameters:
uri- the query location hint (the location URI as it appears in the "import module" declaration, expanded to an absolute URI by resolving against the base URI, but before passing to the Module Resolver)- Returns:
- true if the location hint has already been processed
-
fixupQueryModules
Fix up global variables and functions in all query modules. This is done right at the end, because recursive imports are permitted- Parameters:
main- the main query modulecheckForCycles- if a check for cyclicity among modules is to be performed. This is a check for cycles at the level of a module (error XQST0093)- Throws:
XPathException- if an error occurs
-
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
-
getGlobalVariable
Get the global variable with a given name- Parameters:
name- the name of the required variable- Returns:
- the GlobalVariable with this name, or null if not found
-
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
StructuredQNameof the variable name, and the value is the GlobalVariable object representing the compiled global variable. If there are no global variables, the method may return null.
-
explainGlobalVariables
Explain (that is, output an expression tree) the global variables- Parameters:
presenter- the destination for the explanation of the global variables
-
registerGlobalVariable
Register a global variable- Parameters:
variable- the global variable to be registered
-
initializeBindery
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- Returns:
- the size of the largest stack frame needed for evaluating the match patterns that appear in XSLT template rules
-
setLocationMap
Set the location map- Parameters:
map- the location map, which is used to identify the module URI and line number of locations of errors
-
getLocationMap
Get the location map- Returns:
- the location map, which is used to identify the locations of errors
-
addRequiredParam
Add a required parameter. Used in XSLT only.- Parameters:
qName- the name of the required parameter
-
checkAllRequiredParamsArePresent
Check that all required parameters have been supplied. Used in XSLT only.- Parameters:
params- the set of parameters that have been supplied- Throws:
XPathException- if there is a required parameter for which no value has been supplied
-
setCreatesSecondaryResult
public void setCreatesSecondaryResult(boolean flag) Set whether this executable represents a stylesheet that uses xsl:result-document to create secondary output documents- Parameters:
flag- true if the executable uses xsl:result-document
-
createsSecondaryResult
public boolean createsSecondaryResult()Ask whether this executable represents a stylesheet that uses xsl:result-document to create secondary output documents- Returns:
- true if the executable uses xsl:result-document
-
setInitialContextItemVariableName
Set the name of the variable that will implicitly contain the value of the initial context item. The properties of this variable, such as its required type and initial value, automatically apply to the initial context item- Parameters:
name- the name of the global variable that mirrors the initial context item; or null if there is no such variable
-
getInitialContextItemVariableName
Get the the name of the variable that will implicitly contain the value of the initial context item. The properties of this variable, such as its required type and initial value, automatically apply to the initial context item- Returns:
- the name of the global variable that mirrors the initial context item
-
setSchemaAware
public void setSchemaAware(boolean aware) Set whether this executable is schema-aware. The initial value is false; it is set to true at compile time if the query or transformation imports a schema. If the value is false, then all documents used at run-time must be untyped- Parameters:
aware- true if the executable is schema-aware- Throws:
IllegalArgumentException- if schema-aware processing is requested in a Configuration that is not schema-aware
-
isSchemaAware
public boolean isSchemaAware()Ask whether this executable is schema-aware, that is, whether the query or transformation imports a schema.- Returns:
- true if the executable is schema-aware, false if not.
-