public class PrincipalStylesheetModule extends StylesheetModule implements GlobalVariableManager
Modifier and Type | Class and Description |
---|---|
static class |
PrincipalStylesheetModule.Action
A class that simply encapsulates a callback action of any kind
|
topLevel
Constructor and Description |
---|
PrincipalStylesheetModule(XSLPackage sourceElement)
Create a PrincipalStylesheetModule
|
Modifier and Type | Method and Description |
---|---|
void |
addCompletionAction(PrincipalStylesheetModule.Action action)
Register a callback action to be performed during the completion phase
|
void |
addFixupAction(PrincipalStylesheetModule.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 |
adjustExposedVisibility()
Adjust visibility of components by applying xsl:expose rules
|
int |
allocateUniqueParameterNumber(StructuredQName qName)
Allocate a unique number to a local parameter name.
|
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.
|
protected void |
compile(Compilation compilation)
Compile the source XSLT 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() |
void |
declareXQueryFunction(XQueryFunction function)
Declare an imported XQuery function
|
void |
findKeyablePatterns(Compilation compilation)
Find possibly keyable patterns, accumulating them in the PatternOptimization
and then emitting the necessary key definitions
|
protected void |
fixup() |
Properties |
gatherOutputProperties(StructuredQName formatQName)
Create an output properties object representing the xsl:output elements in the stylesheet.
|
IAccumulatorRegistry |
getAccumulatorManager()
Get the class that manages accumulator functions
|
List<ComponentDeclaration> |
getAttributeSetDeclarations(StructuredQName name)
Return all the attribute set declarations in the package having a particular QName
|
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
|
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 Set<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(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
|
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(String uri)
Determine if a namespace is included in the result-prefix of a namespace-alias
|
boolean |
isAttributeSetDeclaredStreamable(StructuredQName name)
Ask whether a particular attribute set exists and is declared streamable
|
boolean |
isDeclaredModes()
Ask whether it is required that modes be explicitly declared
|
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(IAccumulatorRegistry 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 void removeGlobalVariable(ComponentDeclaration decl)
decl
- the global variable to be removedpublic PrincipalStylesheetModule getPrincipalStylesheetModule()
getPrincipalStylesheetModule
in class StylesheetModule
public StylesheetPackage getStylesheetPackage()
public KeyManager getKeyManager()
public DecimalFormatManager getDecimalFormatManager()
public RuleManager getRuleManager()
public boolean isDeclaredModes()
public void addFixupAction(PrincipalStylesheetModule.Action action)
action
- the callback actionpublic void addCompletionAction(PrincipalStylesheetModule.Action action)
action
- the callback actionpublic void setNeedsDynamicOutputProperties(boolean b)
b
- true if this stylesheet needs dynamic output propertiespublic 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 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 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 List<ComponentDeclaration> getAttributeSetDeclarations(StructuredQName name)
name
- the name of the required declarationspublic boolean isAttributeSetDeclaredStreamable(StructuredQName name)
name
- the name of the required attribute setprotected void checkStreamability(AttributeSet aSet) throws XPathException
aSet
- the attribute set to be checkedXPathException
- if the streamability rules are not satisifedprotected 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 void indexMode(ComponentDeclaration decl) throws XPathException
decl
- the declaration of the Mode objectXPathException
- if an error occurspublic boolean checkAcceptableModeForPackage(XSLTemplate template, Mode mode) throws XPathException
template
- the template rulemode
- the modeXPathException
- if the mode is declared in a used package and the template
is not declared within the relevant xsl:mode declarationpublic IAccumulatorRegistry getAccumulatorManager()
public void setAccumulatorManager(IAccumulatorRegistry 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
protected boolean isImportedSchema(String targetNamespace)
targetNamespace
- The target namespace of the required schema.
Supply an empty string for the default namespaceprotected void addImportedSchema(String targetNamespace)
public ComponentDeclaration getCharacterMap(StructuredQName name)
name
- The character map name being soughtpublic void adjustExposedVisibility() throws XPathException
XPathException
protected 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 boolean isRootPackage()
protected void fixup() throws XPathException
XPathException
protected void complete() throws XPathException
XPathException
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 findKeyablePatterns(Compilation compilation) throws XPathException
compilation
- XPathException
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.