public class PrincipalStylesheetModule extends StylesheetModule
topLevel
Constructor and Description |
---|
PrincipalStylesheetModule(XSLStylesheet sourceElement,
int precedence) |
Modifier and Type | Method and Description |
---|---|
protected void |
addImportedSchema(String targetNamespace) |
protected void |
addNamespaceAlias(Declaration node) |
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 |
compileError(String message,
String errorCode)
Compile time error, specifying an error code
|
protected void |
compileError(XPathException error)
Report an error with diagnostic information
|
void |
compileStylesheet()
Compile the stylesheet to create an executable.
|
FunctionLibraryList |
createFunctionLibrary(CompilerInfo info)
Create the function library
|
void |
declareXQueryFunction(XQueryFunction function)
Declare an imported XQuery function
|
StringCollator |
findCollation(String name,
String baseURI)
Find a named collation.
|
Properties |
gatherOutputProperties(StructuredQName formatQName)
Create an output properties object representing the xsl:output elements in the stylesheet.
|
protected boolean |
getAttributeSets(StructuredQName name,
List<Declaration> list)
Get the list of attribute-set declarations associated with a given QName.
|
Declaration |
getCharacterMap(StructuredQName name)
Get a character map, identified by the fingerprint of its name.
|
CollationMap |
getCollationMap()
Get the collation map
|
protected XSLFunction |
getFunction(StructuredQName name,
int arity)
Get the function with a given name and arity
|
protected Declaration |
getFunctionDeclaration(StructuredQName name,
int arity) |
FunctionLibrary |
getFunctionLibrary()
Get the function library.
|
SourceBinding |
getGlobalVariable(StructuredQName qName)
Get the global variable or parameter with a given name (taking
precedence rules into account)
|
protected HashSet<String> |
getImportedSchemaTable() |
XSLTemplate |
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.
|
PreparedStylesheet |
getPreparedStylesheet() |
PrincipalStylesheetModule |
getPrincipalStylesheetModule() |
XSLStylesheet |
getStylesheetDocument(DocumentURI key)
Get a module from the cache
|
String |
getVersion()
Get the value of the version attribute on the xsl:stylesheet element of the
principal stylesheet module
|
protected boolean |
hasNamespaceAliases() |
protected void |
indexFunction(Declaration decl)
Add a stylesheet function to the index
|
protected void |
indexNamedTemplate(Declaration decl)
Add a named template to the index
|
protected void |
indexVariableDeclaration(Declaration 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
|
protected boolean |
isImportedSchema(String targetNamespace)
Get an imported schema with a given namespace
|
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
|
protected void |
putFunction(Declaration decl) |
void |
putStylesheetDocument(DocumentURI key,
XSLStylesheet module)
Add a module to the cache
|
void |
setCollation(String name,
StringCollator collation)
Register a named collation (actually a StringCollator)
|
void |
setNeedsDynamicOutputProperties(boolean b)
Say that this stylesheet needs dynamic output properties
|
void |
setPreparedStylesheet(PreparedStylesheet preparedStylesheet) |
void |
setVersion(String version)
Set the value of the version attribute on the xsl:stylesheet element of the
principal stylesheet module
|
boolean |
stripsWhitespace()
Determine whether this stylesheet does any whitespace stripping
|
getImporter, getInputTypeAnnotations, getMinImportPrecedence, getPrecedence, getSourceElement, setImporter, setInputTypeAnnotations, setMinImportPrecedence, setWasIncluded, spliceIncludes
public PrincipalStylesheetModule(XSLStylesheet sourceElement, int precedence)
public void setPreparedStylesheet(PreparedStylesheet preparedStylesheet)
public PreparedStylesheet getPreparedStylesheet()
public PrincipalStylesheetModule getPrincipalStylesheetModule()
getPrincipalStylesheetModule
in class StylesheetModule
public FunctionLibraryList createFunctionLibrary(CompilerInfo info)
public FunctionLibrary getFunctionLibrary()
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 XSLStylesheet 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 stylesheetpublic void processAllAttributes() throws XPathException
XPathException
- if static errors are found in the stylesheetprotected void indexFunction(Declaration decl) throws XPathException
decl
- The declaration wrapping an XSLFunction objectXPathException
- if errors are foundprotected Declaration getFunctionDeclaration(StructuredQName name, int arity)
protected XSLFunction getFunction(StructuredQName name, int arity)
name
- the name of the functionarity
- the arity of the function, or -1 if any arity will doprotected void putFunction(Declaration decl)
protected void indexVariableDeclaration(Declaration decl) throws XPathException
decl
- The Declaration referencing the XSLVariable or XSLParam elementXPathException
- if an error occurspublic SourceBinding getGlobalVariable(StructuredQName qName)
qName
- name of the global variable or parameterpublic int allocateUniqueParameterNumber(StructuredQName qName)
qName
- the local parameter nameprotected void indexNamedTemplate(Declaration decl) throws XPathException
decl
- the declaration of the Template objectXPathException
- if an error occurspublic XSLTemplate getNamedTemplate(StructuredQName name)
name
- the name of the required templateprotected void addNamespaceAlias(Declaration 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 CollationMap getCollationMap()
public void setCollation(String name, StringCollator collation)
name
- the name of the collationcollation
- the StringCollator that implements this collationpublic StringCollator findCollation(String name, String baseURI)
name
- identifies the name of the collation requiredbaseURI
- the base URI to be used for resolving the collation name if it is relativepublic 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 stylesheetpublic void compileStylesheet() throws XPathException
XPathException
- if compilation fails for any reasonprotected 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<Declaration> 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 setVersion(String version)
version
- the value of the version attributepublic String getVersion()
public void setNeedsDynamicOutputProperties(boolean b)
b
- true if this stylesheet needs dynamic output propertiespublic Declaration 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 ErrorListenerCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.