public class PrincipalStylesheetModule extends StylesheetModule implements GlobalVariableManager
This version of the StylesheetPackage class represents a trivial package that is constructed by the system to wrap an ordinary (non-package) stylesheet, as available in XSLT 2.0. A subclass is used for "real" packages, currently available only in Saxon-EE.
topLevel
Constructor and Description |
---|
PrincipalStylesheetModule(XSLPackage sourceElement)
Create a PrincipalStylesheetModule
|
Modifier and Type | Method and Description |
---|---|
void |
addFixupAction(Action action)
Register a callback action to be performed during the fixup phase
|
void |
addGlobalVariable(GlobalVariable variable)
Add a global variable to the collection
|
void |
addGlobalVariable(GlobalVariable variable,
Visibility visibility) |
protected void |
addImportedSchema(java.lang.String targetNamespace) |
protected void |
addNamespaceAlias(ComponentDeclaration node) |
void |
adjustExposedVisibility()
Adjust visibility of components by applying xsl:expose rules
|
boolean |
checkAcceptableModeForPackage(XSLTemplate template,
Mode mode)
Check that it is legitimate to add a given template rule to a given mode
|
protected void |
checkStreamability(AttributeSet aSet)
Check the streamability of an attribute set declared within this stylesheet module.
|
void |
combineAttributeSets(Compilation compilation)
Combine all like-named xsl:attribute-set declarations in this package into a single Component, whose body
is an AttributeSet object.
|
protected void |
compile(Compilation compilation)
Compile the source XSLT stylesheet package
|
protected void |
compileError(java.lang.String message,
java.lang.String errorCode)
Compile time error, specifying an error code
|
protected void |
compileError(XPathException error)
Report an error with diagnostic information
|
protected void |
complete() |
void |
declareXQueryFunction(XQueryFunction function)
Declare an imported XQuery function
|
protected void |
fixup() |
java.util.Properties |
gatherOutputProperties(StructuredQName formatQName)
Create an output properties object representing the xsl:output elements in the stylesheet.
|
AccumulatorRegistry |
getAccumulatorManager()
Get the class that manages accumulator functions
|
java.util.List<ComponentDeclaration> |
getAttributeSetDeclarations(StructuredQName name)
Return all the attribute set declarations in the package having a particular QName
|
protected void |
getAttributeSets(StructuredQName name,
java.util.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
|
GlobalVariable |
getEquivalentVariable(Expression select)
Get an existing global variable whose initializer is a given expression,
if there is one.
|
SourceBinding |
getGlobalVariableBinding(StructuredQName qName)
Get the global variable or parameter with a given name (taking
precedence rules into account).
|
protected java.util.Set<java.lang.String> |
getImportedSchemaTable() |
KeyManager |
getKeyManager()
Get the key manager used to manage xsl:key declarations in this package
|
NamedTemplate |
getNamedTemplate(StructuredQName name)
Get the named template with a given name
|
protected NamespaceBinding |
getNamespaceAlias(java.lang.String uri)
Get the declared namespace alias for a given namespace URI code if there is one.
|
PrincipalStylesheetModule |
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() |
XSLModuleRoot |
getStylesheetDocument(DocumentURI key)
Get a module from the cache of stylesheet modules
|
StylesheetPackage |
getStylesheetPackage()
Get the stylesheet package
|
TypeAliasManager |
getTypeAliasManager()
Get the type alias manager (type aliases are a Saxon extension)
|
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
|
void |
indexMode(ComponentDeclaration decl)
Handle an explicitly-declared mode
|
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(java.lang.String uri)
Determine if a namespace is included in the result-prefix of a namespace-alias
|
boolean |
isDeclaredModes()
Ask whether it is required that modes be explicitly declared
|
protected boolean |
isImportedSchema(java.lang.String targetNamespace)
Get an imported schema with a given namespace
|
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 |
setAccumulatorManager(AccumulatorRegistry accumulatorManager)
Set the class that manages accumulator functions
|
void |
setNeedsDynamicOutputProperties(boolean b)
Say that this stylesheet package needs dynamic output properties
|
protected void |
spliceUsePackages(XSLPackage xslpackage,
Compilation compilation)
Incorporate declarations from used packages
|
getAssociatedStylesheet, getConfiguration, getImporter, getInputTypeAnnotations, getMinImportPrecedence, getPrecedence, getRootElement, getStylesheetElement, loadStylesheet, loadStylesheetModule, setImporter, setInputTypeAnnotations, setMinImportPrecedence, setWasIncluded, spliceIncludes
public PrincipalStylesheetModule(XSLPackage sourceElement) throws XPathException
sourceElement
- the xsl:package element at the root of the package manifestXPathException
public Component getComponent(SymbolicName name)
name
- the symbolic name of the required componentpublic PrincipalStylesheetModule getPrincipalStylesheetModule()
getPrincipalStylesheetModule
in class StylesheetModule
public StylesheetPackage getStylesheetPackage()
public KeyManager getKeyManager()
public DecimalFormatManager getDecimalFormatManager()
public RuleManager getRuleManager()
public boolean isDeclaredModes()
public void addFixupAction(Action action)
action
- the callback actionpublic void setNeedsDynamicOutputProperties(boolean b)
b
- true if this stylesheet needs dynamic output propertiespublic CharacterMapIndex getCharacterMapIndex()
public TypeAliasManager getTypeAliasManager()
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)
decl
- The declaration wrapping an XSLFunction objectprotected 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 parameterprotected void indexNamedTemplate(ComponentDeclaration decl) throws XPathException
decl
- the declaration of the Template objectXPathException
- if an error occurspublic NamedTemplate 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 java.util.List<ComponentDeclaration> getAttributeSetDeclarations(StructuredQName name)
name
- the name of the required declarationspublic void combineAttributeSets(Compilation compilation) throws XPathException
XPathException
- if a failure occursprotected void checkStreamability(AttributeSet aSet) throws XPathException
aSet
- the attribute set to be checkedXPathException
- if the streamability rules are not satisifedprotected void getAttributeSets(StructuredQName name, java.util.List<ComponentDeclaration> list)
name
- the name of the required attribute setlist
- a list to hold the list of XSLAttributeSet elements in the stylesheet tree.public void indexMode(ComponentDeclaration decl)
decl
- the declaration of the Mode objectpublic boolean checkAcceptableModeForPackage(XSLTemplate template, Mode mode)
template
- the template rulemode
- the modepublic AccumulatorRegistry getAccumulatorManager()
public void setAccumulatorManager(AccumulatorRegistry accumulatorManager)
accumulatorManager
- the manager of accumulator functionsprotected void addNamespaceAlias(ComponentDeclaration node)
protected NamespaceBinding getNamespaceAlias(java.lang.String uri)
uri
- The uri used in the stylesheet.protected boolean isAliasResultNamespace(java.lang.String uri)
uri
- the namespace URIprotected boolean hasNamespaceAliases()
public java.util.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
protected boolean isImportedSchema(java.lang.String targetNamespace)
targetNamespace
- The target namespace of the required schema.
Supply an empty string for the default namespaceprotected void addImportedSchema(java.lang.String targetNamespace)
protected java.util.Set<java.lang.String> getImportedSchemaTable()
public ComponentDeclaration getCharacterMap(StructuredQName name)
name
- The character map name being soughtpublic void adjustExposedVisibility() throws XPathException
XPathException
protected void compileError(java.lang.String message, java.lang.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)
error
- contains information about the errorprotected void fixup() throws XPathException
XPathException
protected void complete() throws XPathException
XPathException
public SlotManager getSlotManager()
public GlobalVariable getEquivalentVariable(Expression select)
GlobalVariableManager
getEquivalentVariable
in interface GlobalVariableManager
public void addGlobalVariable(GlobalVariable variable)
GlobalVariableManager
addGlobalVariable
in interface GlobalVariableManager
variable
- the variable to be addedpublic void addGlobalVariable(GlobalVariable variable, Visibility visibility)
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.