public class StylesheetPackage extends StylesheetModule implements GlobalVariableManager
Modifier and Type | Class and Description |
---|---|
static class |
StylesheetPackage.Action
A class that simply encapsulates a callback action of any kind
|
Modifier and Type | Field and Description |
---|---|
protected HashSet<String> |
schemaIndex |
topLevel
Constructor and Description |
---|
StylesheetPackage(XSLPackage sourceElement)
Create a StylesheetPackage
|
Modifier and Type | Method and Description |
---|---|
void |
addCompletionAction(StylesheetPackage.Action action)
Register a callback action to be performed during the completion phase
|
void |
addFixupAction(StylesheetPackage.Action action)
Register a callback action to be performed during the fixup phase
|
void |
addGlobalVariable(GlobalVariable variable)
Add a global variable to the collection
|
protected void |
addImportedSchema(String targetNamespace) |
protected void |
addNamespaceAlias(ComponentDeclaration node) |
void |
addUsedPackage(StylesheetPackage pack)
Register a package that is referenced from this one in an xsl:use-package declaration
|
void |
allocatePatternSlots(int n)
Ensure there is enough space for local variables or parameters when evaluating the match pattern of
template rules
|
int |
allocateUniqueParameterNumber(StructuredQName qName)
Allocate a unique number to a local parameter name.
|
protected void |
compile(Compilation compilation)
Compile the stylesheet package
|
protected void |
compileError(String message,
String errorCode)
Compile time error, specifying an error code
|
protected void |
compileError(XPathException error)
Report an error with diagnostic information
|
protected void |
complete() |
FunctionLibraryList |
createFunctionLibrary(Compilation compilation)
Create the function library containing stylesheet functions declared in this package
|
void |
declareXQueryFunction(XQueryFunction function)
Declare an imported XQuery function
|
void |
explain(ExpressionPresenter presenter) |
protected void |
fixup() |
Properties |
gatherOutputProperties(StructuredQName formatQName)
Create an output properties object representing the xsl:output elements in the stylesheet.
|
IAccumulatorManager |
getAccumulatorManager()
Get the class that manages accumulator functions
|
protected boolean |
getAttributeSets(StructuredQName name,
List<ComponentDeclaration> list)
Get the list of attribute-set declarations associated with a given QName.
|
ComponentDeclaration |
getCharacterMap(StructuredQName name)
Get a character map, identified by the fingerprint of its name.
|
CharacterMapIndex |
getCharacterMapIndex()
Get an index of character maps declared using xsl:character-map entries in this package
|
Component |
getComponent(SymbolicName name)
Search the package for a component with a given name
|
DecimalFormatManager |
getDecimalFormatManager()
Get the decimal format manager used to manage xsl:decimal-format declarations in this package
|
protected UserFunction |
getFunction(SymbolicName name)
Get the function with a given name and arity
|
FunctionLibrary |
getFunctionLibrary()
Get the function library.
|
GlobalVariable |
getGlobalVariable(StructuredQName name)
Get the global variable with a specific name
|
SourceBinding |
getGlobalVariableBinding(StructuredQName qName)
Get the global variable or parameter with a given name (taking
precedence rules into account).
|
Collection<StructuredQName> |
getGlobalVariableNames()
Get the names of all global variables in the collection
|
protected HashSet<String> |
getImportedSchemaTable() |
KeyManager |
getKeyManager()
Get the key manager used to manage xsl:key declarations in this package
|
Template |
getNamedTemplate(StructuredQName name)
Get the named template with a given name
|
protected NamespaceBinding |
getNamespaceAlias(String uri)
Get the declared namespace alias for a given namespace URI code if there is one.
|
String |
getPackageName()
Get the name identifier of the xsl:package as an absolute URI
|
NestedIntegerValue |
getPackageVersion()
Get the package-version identifier appearing on the xsl:package element
|
StylesheetPackage |
getPrincipalStylesheetModule()
Get the outermost stylesheet module in a package
|
RuleManager |
getRuleManager()
Get the rule manager used to manage modes declared explicitly or implicitly in this package
|
SlotManager |
getSlotManager() |
SpaceStrippingRule |
getStripperRules()
Get the rules determining which nodes are to be stripped from the tree
|
XSLModuleRoot |
getStylesheetDocument(DocumentURI key)
Get a module from the cache of stylesheet modules
|
FunctionLibraryList |
getStylesheetFunctionLibrary() |
Iterable<StylesheetPackage> |
getUsedPackages()
Get the packages referenced from this package in an xsl:use-package declaration
|
DecimalValue |
getVersion()
Get the version of the XSLT language specification to which the package manifest conforms
|
protected boolean |
hasNamespaceAliases() |
protected void |
importSchemata()
Process import-schema declarations
|
protected void |
indexAttributeSet(ComponentDeclaration decl)
Add an attribute set to the index
|
protected void |
indexFunction(ComponentDeclaration decl)
Add a stylesheet function to the index
|
protected void |
indexNamedTemplate(ComponentDeclaration decl)
Add a named template to the index
|
protected void |
indexVariableDeclaration(ComponentDeclaration decl)
Index a global xsl:variable or xsl:param element
|
protected boolean |
isAliasResultNamespace(String uri)
Determine if a namespace is included in the result-prefix of a namespace-alias
|
boolean |
isCreatesSecondaryResultDocuments() |
protected boolean |
isImportedSchema(String targetNamespace)
Get an imported schema with a given namespace
|
boolean |
isRootPackage() |
void |
optimizeTopLevel() |
void |
preprocess()
Preprocess does all the processing possible before the source document is available.
|
void |
processAllAttributes()
Process the attributes of every node in the stylesheet
|
void |
putStylesheetDocument(DocumentURI key,
XSLStylesheet module)
Add a module to the cache of stylesheet modules
|
void |
removeGlobalVariable(ComponentDeclaration decl)
Remove a global variable if it is found to be redundant, i.e.
|
void |
setAccumulatorManager(IAccumulatorManager accumulatorManager)
Set the class that manages accumulator functions
|
void |
setCreatesSecondaryResultDocuments(boolean flag) |
void |
setNeedsDynamicOutputProperties(boolean b)
Say that this stylesheet needs dynamic output properties
|
void |
setPackageName(String packageName)
Set the name of the package
|
void |
setPackageVersion(NestedIntegerValue version)
Set the package-version identifier appearing on the xsl:package element
|
void |
setStripperRules(SpaceStrippingRule rules)
Set the rules determining which nodes are to be stripped from the tree
|
void |
setVersion(DecimalValue version)
Set the version of the XSLT language specification to which the package manifest conforms
|
protected void |
spliceUsePackages(XSLPackage xslpackage,
Compilation compilation)
Incorporate declarations from used packages
|
boolean |
stripsWhitespace()
Determine whether this stylesheet does any whitespace stripping
|
void |
updatePreparedStylesheet(PreparedStylesheet pss)
Copy information from this package to the PreparedStylesheet.
|
getAssociatedStylesheet, getConfiguration, getImporter, getInputTypeAnnotations, getMinImportPrecedence, getPrecedence, getRootElement, getStylesheetElement, loadStylesheetModule, setImporter, setInputTypeAnnotations, setMinImportPrecedence, setWasIncluded, spliceIncludes
public StylesheetPackage(XSLPackage sourceElement)
sourceElement
- the xsl:package element at the root of the package manifestpublic Component getComponent(SymbolicName name)
name
- the symbolic name of the required componentpublic void removeGlobalVariable(ComponentDeclaration decl)
decl
- the global variable to be removedpublic StylesheetPackage getPrincipalStylesheetModule()
getPrincipalStylesheetModule
in class StylesheetModule
public KeyManager getKeyManager()
public DecimalFormatManager getDecimalFormatManager()
public RuleManager getRuleManager()
public void addFixupAction(StylesheetPackage.Action action)
action
- the callback actionpublic void addCompletionAction(StylesheetPackage.Action action)
action
- the callback actionpublic FunctionLibraryList createFunctionLibrary(Compilation compilation)
compilation
- the controlling Compilationpublic FunctionLibrary getFunctionLibrary()
public FunctionLibraryList getStylesheetFunctionLibrary()
public CharacterMapIndex getCharacterMapIndex()
public void declareXQueryFunction(XQueryFunction function) throws XPathException
function
- the imported functionXPathException
- if an error occurspublic void putStylesheetDocument(DocumentURI key, XSLStylesheet module)
key
- the key to be used (based on the absolute URI)module
- the stylesheet document tree corresponding to this absolute URIpublic XSLModuleRoot getStylesheetDocument(DocumentURI key)
key
- the key to be used (based on the absolute URI)public void preprocess() throws XPathException
XPathException
- if errors are found in the stylesheetprotected void spliceUsePackages(XSLPackage xslpackage, Compilation compilation) throws XPathException
xslpackage
- the used packagecompilation
- this compilationXPathException
- if any error is detected in the used packageprotected void importSchemata() throws XPathException
XPathException
- if errors are detectedpublic void processAllAttributes() throws XPathException
XPathException
- if static errors are found in the stylesheetprotected void indexFunction(ComponentDeclaration decl) throws XPathException
decl
- The declaration wrapping an XSLFunction objectXPathException
- if errors are foundprotected UserFunction getFunction(SymbolicName name)
name
- the symbolic name of the function (QName plus arity)protected void indexVariableDeclaration(ComponentDeclaration decl) throws XPathException
decl
- The Declaration referencing the XSLVariable or XSLParam elementXPathException
- if an error occurspublic SourceBinding getGlobalVariableBinding(StructuredQName qName)
qName
- name of the global variable or parameterpublic int allocateUniqueParameterNumber(StructuredQName qName)
qName
- the local parameter nameprotected void indexNamedTemplate(ComponentDeclaration decl) throws XPathException
decl
- the declaration of the Template objectXPathException
- if an error occurspublic Template getNamedTemplate(StructuredQName name)
name
- the name of the required templateprotected void indexAttributeSet(ComponentDeclaration decl) throws XPathException
decl
- the declaration of the attribute set objectXPathException
- if an error occurspublic IAccumulatorManager getAccumulatorManager()
public void setAccumulatorManager(IAccumulatorManager accumulatorManager)
accumulatorManager
- the manager of accumulator functionsprotected void addNamespaceAlias(ComponentDeclaration node)
protected NamespaceBinding getNamespaceAlias(String uri)
uri
- The uri used in the stylesheet.protected boolean isAliasResultNamespace(String uri)
uri
- the namespace URIprotected boolean hasNamespaceAliases()
public Properties gatherOutputProperties(StructuredQName formatQName) throws XPathException
formatQName
- The name of the output format required. If set to null, gathers
information for the unnamed output formatXPathException
- if a named output format does not exist in
the stylesheetprotected void compile(Compilation compilation) throws XPathException
compilation
- the compilation episodeXPathException
- if compilation fails for any reasonpublic void optimizeTopLevel() throws XPathException
XPathException
public void updatePreparedStylesheet(PreparedStylesheet pss) throws XPathException
pss
- the PreparedStylesheet to be updatedXPathException
- if the PreparedStylesheet cannot be updatedprotected boolean isImportedSchema(String targetNamespace)
targetNamespace
- The target namespace of the required schema.
Supply an empty string for the default namespaceprotected void addImportedSchema(String targetNamespace)
protected boolean getAttributeSets(StructuredQName name, List<ComponentDeclaration> list) throws XPathException
name
- the name of the required attribute setlist
- a list to hold the list of XSLAttributeSet elements in the stylesheet tree.XPathException
- if an error occurspublic boolean stripsWhitespace()
public void setStripperRules(SpaceStrippingRule rules)
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.public SpaceStrippingRule getStripperRules()
public void setNeedsDynamicOutputProperties(boolean b)
b
- true if this stylesheet needs dynamic output propertiespublic ComponentDeclaration getCharacterMap(StructuredQName name)
name
- The character map name being soughtpublic void allocatePatternSlots(int n)
n
- the number of slots to be allocatedprotected void compileError(String message, String errorCode) throws XPathException
message
- the error messageerrorCode
- the error code. May be null if not known or not definedXPathException
- unconditionallyprotected void compileError(XPathException error) throws XPathException
error
- contains information about the errorXPathException
- unconditionally, after reporting the error to the ErrorListenerpublic void addUsedPackage(StylesheetPackage pack) throws XPathException
pack
- the used packageXPathException
- if duplicate components are foundpublic Iterable<StylesheetPackage> getUsedPackages()
public void setVersion(DecimalValue version)
version
- the version as a DecimalValue typepublic void setPackageName(String packageName)
packageName
- the name of the package. This is supposed to be an absolute URI, but Saxon accepts any string.public DecimalValue getVersion()
public NestedIntegerValue getPackageVersion()
public void setPackageVersion(NestedIntegerValue version)
version
- - the version identifier as a DeweyDecimalValuepublic String getPackageName()
public boolean isRootPackage()
protected void fixup() throws XPathException
XPathException
protected void complete() throws XPathException
XPathException
public void explain(ExpressionPresenter presenter)
public SlotManager getSlotManager()
public Collection<StructuredQName> getGlobalVariableNames()
GlobalVariableManager
getGlobalVariableNames
in interface GlobalVariableManager
public GlobalVariable getGlobalVariable(StructuredQName name)
GlobalVariableManager
getGlobalVariable
in interface GlobalVariableManager
name
- the name of the required global variablepublic void addGlobalVariable(GlobalVariable variable)
GlobalVariableManager
addGlobalVariable
in interface GlobalVariableManager
variable
- the variable to be addedpublic void setCreatesSecondaryResultDocuments(boolean flag)
public boolean isCreatesSecondaryResultDocuments()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.