public class Compilation
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
TIMING |
Constructor and Description |
---|
Compilation(Configuration config,
CompilerInfo info)
Create a compilation object ready to perform an XSLT compilation
|
Modifier and Type | Method and Description |
---|---|
void |
clearParameters()
Clear the values of all stylesheet parameters that have been set using the
setParameter(net.sf.saxon.om.StructuredQName, net.sf.saxon.om.Sequence)
method; and decouple the parameters held by this Compilation from those defined
in the originating CompilerInfo |
PrincipalStylesheetModule |
compilePackage(javax.xml.transform.Source source)
Compile a stylesheet package
|
static PreparedStylesheet |
compileSingletonPackage(Configuration config,
CompilerInfo compilerInfo,
javax.xml.transform.Source source)
Static factory method: Compile an XSLT stylesheet consisting of a single package
|
void |
declareStaticVariable(StructuredQName name,
GroundedValue value,
NestedIntegerValue precedence,
boolean isParam)
Declare a static variable.
|
CompilerInfo |
getCompilerInfo()
Get the compilation options used by this compilation
|
Configuration |
getConfiguration()
Get the Saxon Configuration used by this Compilation
|
int |
getErrorCount()
Get the number of errors reported so far
|
java.util.Stack<DocumentURI> |
getImportStack()
Get the stack of include/imports, used to detect circularities
|
PackageData |
getPackageData()
Get information about the package that was compiled in the course of this Compilation
|
GlobalParameterSet |
getParameters()
Get the values of all stylesheet parameters that have been set using the
setParameter(net.sf.saxon.om.StructuredQName, net.sf.saxon.om.Sequence)
method. |
PrincipalStylesheetModule |
getPrincipalStylesheetModule()
Get the (most recent) stylesheet package compiled using this Compilation
|
QNameParser |
getQNameParser()
Get the QNameParser for parsing QNames in this compilation
Note that the namespaceResolver will be unitialized
|
GroundedValue |
getStaticVariable(StructuredQName name)
Get the value of a static variable
|
NestedIntegerValue |
getStaticVariablePrecedence(StructuredQName name)
Get the precedence of a static variable
|
StyleNodeFactory |
getStyleNodeFactory(boolean topLevel)
Get the StyleNodeFactory used to build the stylesheet tree
|
java.util.Map<DocumentURI,TreeInfo> |
getStylesheetModules()
Get the map of stylesheet modules.
|
boolean |
isCreatesSecondaryResultDocuments()
Ask whether the package has encountered an xsl:result-document instruction
|
boolean |
isLibraryPackage()
Ask whether the package being compiled is a library package
|
boolean |
isPreScan()
Ask whether this is the compile-time phase of a just-in-time compilation, during which template
rules are not fully processed
|
boolean |
isSchemaAware()
Ask whether this compilation is schema-aware.
|
void |
registerPackageDependency(UsePack use)
Method called internally while compiling a package to register that an xsl:use-package declaration has been encountered.
|
void |
reportError(XPathException err)
Report a compile time error.
|
void |
reportWarning(XPathException err)
Report a compile time warning.
|
void |
satisfyPackageDependencies(XSLPackage thisPackage)
After the first phase of processing, we have gathered information about the xsl:use-package elements in the stylesheet.
|
void |
setCreatesSecondaryResultDocuments(boolean createsSecondaryResultDocuments)
Say whether the compilation has encountered an xsl:result-document instruction
|
void |
setExpectedNameAndVersion(VersionedPackageName vpn) |
void |
setLibraryPackage(boolean libraryPackage)
Say whether the package being compiled is a library package
|
void |
setMinimalPackageData() |
void |
setPackageData(PackageData pack) |
void |
setParameter(StructuredQName name,
Sequence seq)
Set the value of a stylesheet parameter.
|
void |
setPreScan(boolean preScan)
Say whether this is the compile-time phase of a just-in-time compilation, during which template
rules are not fully processed
|
void |
setSchemaAware(boolean schemaAware)
Say that this compilation is schema-aware.
|
void |
setUsingPackages(java.util.List<VersionedPackageName> users)
Supply the name/version of the package that invoked this compilation by virtue of an xsl:use-package
declaration, together with the users of that package, recursively.
|
public static final boolean TIMING
public Compilation(Configuration config, CompilerInfo info)
config
- the Saxon Configurationinfo
- compilation optionspublic static PreparedStylesheet compileSingletonPackage(Configuration config, CompilerInfo compilerInfo, javax.xml.transform.Source source) throws XPathException
config
- the Saxon ConfigurationcompilerInfo
- the compilation optionssource
- the source of the root stylesheet module in the package to be compiled. This may
contain an xsl:package element at its root, or it may be a conventional xsl:stylesheet or xsl:transform,
or a "simplified stylesheet" rooted at a literal result elementXPathException
- if any errors occur. The errors will have been reported to the ErrorListener
contained in the CompilerInfo.public void setUsingPackages(java.util.List<VersionedPackageName> users)
users
- the packages that directly or indirectly use this package.public void setPackageData(PackageData pack)
public void setMinimalPackageData()
public void setExpectedNameAndVersion(VersionedPackageName vpn)
public void registerPackageDependency(UsePack use)
use
- details of the package dependency (name and version of the dependee package)public void satisfyPackageDependencies(XSLPackage thisPackage) throws XPathException
XPathException
public PrincipalStylesheetModule compilePackage(javax.xml.transform.Source source) throws XPathException
source
- the XML document containing the top-level stylesheet module in the package,
which may be an xsl:package element, an xsl:stylesheet or xsl:transform element, or a
"simplified stylesheet" rooted at a literal result elementXPathException
- if any error occurs while compiling the packagepublic Configuration getConfiguration()
public CompilerInfo getCompilerInfo()
public PackageData getPackageData()
public boolean isSchemaAware()
xsl:import-schema
declaration or a
validation
attributepublic void setSchemaAware(boolean schemaAware)
xsl:import-schema
declaration is encountered.schemaAware
- true if the compilation is schema-aware.public StyleNodeFactory getStyleNodeFactory(boolean topLevel)
topLevel
- true if the factory is for the top-level (package) module of a packagepublic PrincipalStylesheetModule getPrincipalStylesheetModule()
public void reportError(XPathException err)
err
- the exception containing details of the errorpublic int getErrorCount()
public void reportWarning(XPathException err)
err
- an exception holding details of the warning condition to be
reportedpublic void declareStaticVariable(StructuredQName name, GroundedValue value, NestedIntegerValue precedence, boolean isParam) throws XPathException
name
- the name of the variablevalue
- the value of the variableprecedence
- the import precedence in the form of a "decimal" value (e.g. 2.14.6)isParam
- true if this is an xsl:param rather than an xsl:variableXPathException
- if, for example, the value of the variable is incompatible with other
variables having the same namepublic GroundedValue getStaticVariable(StructuredQName name)
name
- the name of the required variablepublic NestedIntegerValue getStaticVariablePrecedence(StructuredQName name)
name
- the name of the required variablepublic java.util.Map<DocumentURI,TreeInfo> getStylesheetModules()
public java.util.Stack<DocumentURI> getImportStack()
public QNameParser getQNameParser()
public boolean isPreScan()
public void setPreScan(boolean preScan)
preScan
- true if just-in-time compilation is in force and this is the static processing phase
in which code is not fully processed. Set to false if just-in-time compilation is not in force,
or if this is the run-time phase during which full static analysis and code generation takes place.public boolean isCreatesSecondaryResultDocuments()
public void setCreatesSecondaryResultDocuments(boolean createsSecondaryResultDocuments)
createsSecondaryResultDocuments
- true if the package contains an xsl:result-document instructionpublic boolean isLibraryPackage()
public void setLibraryPackage(boolean libraryPackage)
libraryPackage
- if this is a library packagepublic void setParameter(StructuredQName name, Sequence seq)
name
- the name of the stylesheet parameterseq
- the value of the stylesheet parameterpublic GlobalParameterSet getParameters()
setParameter(net.sf.saxon.om.StructuredQName, net.sf.saxon.om.Sequence)
method.public void clearParameters()
setParameter(net.sf.saxon.om.StructuredQName, net.sf.saxon.om.Sequence)
method; and decouple the parameters held by this Compilation from those defined
in the originating CompilerInfoCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.