Package org.apache.xalan.templates
Class StylesheetRoot
java.lang.Object
org.apache.xml.utils.UnImplNode
org.apache.xalan.templates.ElemTemplateElement
org.apache.xalan.templates.Stylesheet
org.apache.xalan.templates.StylesheetComposed
org.apache.xalan.templates.StylesheetRoot
- All Implemented Interfaces:
Serializable
,SourceLocator
,Templates
,XSLTVisitable
,PrefixResolver
,ExpressionNode
,WhitespaceStrippingElementMatcher
,Document
,Element
,Node
,NodeList
This class represents the root object of the stylesheet tree.
- See Also:
-
Field Summary
Fields inherited from class org.apache.xalan.templates.Stylesheet
STYLESHEET_EXT
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
ConstructorsConstructorDescriptionStylesheetRoot
(ErrorListener errorListener) Uses an XSL stylesheet document.StylesheetRoot
(XSLTSchema schema, ErrorListener listener) Creates a StylesheetRoot and retains a pointer to the schema used to create this StylesheetRoot. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Get information about whether or not whitespace can be stripped.getAttributeSetComposed
(QName name) Get a list "xsl:attribute-set" properties that match the qname.Get the hashtable of available elements.Given a valid element decimal-format name, return the decimalFormatSymbols with that name.final ElemTemplate
Get the default template for a root node.final ElemTemplate
Get the default template for elements.final ElemTemplate
Get the default template for text.Only instantiate an ExtensionNamespacesManager if one is called for (i.e., if the stylesheet contains extension functions and/or elements).Get the vector of extension namespaces.getGlobalImport
(int i) Get a stylesheet from the global import list.int
Get the total number of imports in the global import list.int
Given a stylesheet, return the number of the stylesheet in the global import list.boolean
Get the composed "xsl:key" properties.Get the "xsl:namespace-alias" property.boolean
Get the combined "xsl:output" property with the properties combined from the included stylesheets.Get the static properties for xsl:output.boolean
final ElemTemplate
Get the default template for a root node.getTemplateComposed
(QName qname) Get an "xsl:template" property.getTemplateComposed
(XPathContext xctxt, int targetNode, QName mode, boolean quietConflictWarnings, DTM dtm) Get an "xsl:template" property by node match.getTemplateComposed
(XPathContext xctxt, int targetNode, QName mode, int maxImportLevel, int endImportLevel, boolean quietConflictWarnings, DTM dtm) Get an "xsl:template" property by node match.final TemplateList
Accessor method to retrieve theTemplateList
associated with this StylesheetRoot.getVariableOrParamComposed
(QName qname) Get an "xsl:variable" property.Get all global "xsl:variable" properties in scope for this stylesheet.getWhiteSpaceInfo
(XPathContext support, int targetElement, DTM dtm) Get information about whether or not an element should strip whitespace.boolean
Find out if an output method has been set by the user.boolean
isRoot()
Tell if this is the root of the stylesheet tree.boolean
Return the state of the secure processing feature.Create a new transformation context for this Templates object.void
Recompose the values of all "composed" properties, meaning properties that need to be combined or calculated from the combination of imported and included stylesheets.setExtensionHandlerClass
(String handlerClassName) This internal method allows the setting of the java class to handle the extension function (if other than the default one).void
setIncremental
(boolean b) void
setOptimizer
(boolean b) void
setSecureProcessing
(boolean flag) Set the state of the secure processing feature.void
setSource_location
(boolean b) final void
setTemplateListComposed
(TemplateList templateList) Mutator method to set theTemplateList
associated with this StylesheetRoot.boolean
Check to see if the caller should bother with check for whitespace nodes.boolean
shouldStripWhiteSpace
(XPathContext support, int targetElement) Get information about whether or not an element should strip whitespace.Methods inherited from class org.apache.xalan.templates.StylesheetComposed
getEndImportCountComposed, getImportComposed, getImportCountComposed, getIncludeComposed, getIncludeCountComposed, isAggregatedType, recompose, recomposeTemplates
Methods inherited from class org.apache.xalan.templates.Stylesheet
containsExcludeResultPrefix, containsExtensionElementURI, getAttributeSet, getAttributeSetCount, getCompatibleMode, getDecimalFormat, getDecimalFormat, getDecimalFormatCount, getExcludeResultPrefix, getExcludeResultPrefixCount, getExtensionElementPrefix, getExtensionElementPrefixCount, getHref, getId, getImport, getImportCount, getInclude, getIncludeCount, getKey, getKeyCount, getNamespaceAlias, getNamespaceAliasCount, getNodeName, getNodeType, getNonXslTopLevel, getOutput, getOutputCount, getParam, getPreserveSpace, getPreserveSpaceCount, getStripSpace, getStripSpaceCount, getStylesheet, getStylesheetComposed, getStylesheetParent, getStylesheetRoot, getTemplate, getTemplateCount, getVariable, getVariableOrParam, getVariableOrParam, getVariableOrParamCount, getVersion, getXmlnsXsl, getXSLToken, replaceTemplate, setAttributeSet, setDecimalFormat, setExcludeResultPrefixes, setExtensionElementPrefixes, setHref, setId, setImport, setInclude, setKey, setLocaterInfo, setNamespaceAlias, setNonXslTopLevel, setOutput, setParam, setPreserveSpaces, setStripSpaces, setStylesheetParent, setStylesheetRoot, setTemplate, setVariable, setVersion, setXmlnsXsl
Methods inherited from class org.apache.xalan.templates.ElemTemplateElement
appendChild, appendChild, callVisitors, canAcceptVariables, compareTo, compose, endCompose, error, error, execute, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getBaseIdentifier, getChildNodes, getColumnNumber, getDeclaredPrefixes, getDOMBackPointer, getEndColumnNumber, getEndLineNumber, getFirstChild, getFirstChildElem, getLastChild, getLastChildElem, getLength, getLineNumber, getLocalName, getNamespaceForPrefix, getNamespaceForPrefix, getNextSibling, getNextSiblingElem, getOwnerDocument, getOwnerXSLTemplate, getParentElem, getParentNode, getParentNodeElem, getPreviousSibling, getPreviousSiblingElem, getPublicId, getSystemId, getTagName, getUid, getXmlSpace, handlesNullPrefixes, hasChildNodes, hasTextLitOnly, hasVariableDecl, insertBefore, isCompiledTemplate, item, recompose, removeChild, replaceChild, replaceChild, resolvePrefixTables, runtimeInit, setDOMBackPointer, setEndLocaterInfo, setParentElem, setPrefixes, setPrefixes, setUid, setXmlSpace, shouldStripWhiteSpace
Methods inherited from class org.apache.xml.utils.UnImplNode
adoptNode, appendData, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, getActualEncoding, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getImplementation, getInputEncoding, getNamespaceURI, getNodeValue, getOwnerElement, getPrefix, getSchemaTypeInfo, getSpecified, getStrictErrorChecking, getTextContent, getUserData, getWholeText, getXmlEncoding, getXmlStandalone, getXmlVersion, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertData, isDefaultNamespace, isEqualNode, isId, isSameNode, isSupported, isWhitespaceInElementContent, lookupNamespaceURI, lookupPrefix, normalize, normalizeDocument, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, renameNode, replaceData, replaceWholeText, setActualEncoding, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setDocumentURI, setIdAttribute, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setInputEncoding, setNodeValue, setPrefix, setStrictErrorChecking, setTextContent, setUserData, setValue, setXmlEncoding, setXmlStandalone, setXmlVersion, splitText, substringData
-
Constructor Details
-
StylesheetRoot
Uses an XSL stylesheet document.- Throws:
TransformerConfigurationException
- if the baseIdentifier can not be resolved to a URL.
-
StylesheetRoot
public StylesheetRoot(XSLTSchema schema, ErrorListener listener) throws TransformerConfigurationException Creates a StylesheetRoot and retains a pointer to the schema used to create this StylesheetRoot. The schema may be needed later for an element-available() function call.- Parameters:
schema
- The schema used to create this stylesheet- Throws:
TransformerConfigurationException
- if the baseIdentifier can not be resolved to a URL.
-
-
Method Details
-
isRoot
public boolean isRoot()Tell if this is the root of the stylesheet tree.- Overrides:
isRoot
in classStylesheet
- Returns:
- True since this is the root of the stylesheet tree.
-
setSecureProcessing
public void setSecureProcessing(boolean flag) Set the state of the secure processing feature. -
isSecureProcessing
public boolean isSecureProcessing()Return the state of the secure processing feature. -
getAvailableElements
Get the hashtable of available elements.- Returns:
- table of available elements, keyed by qualified names, and with values of the same qualified names.
-
getExtensionNamespacesManager
Only instantiate an ExtensionNamespacesManager if one is called for (i.e., if the stylesheet contains extension functions and/or elements). -
getExtensions
Get the vector of extension namespaces. Used to provide the extensions table access to a list of extension namespaces encountered during composition of a stylesheet. -
newTransformer
Create a new transformation context for this Templates object.- Specified by:
newTransformer
in interfaceTemplates
- Returns:
- A Transformer instance, never null.
-
getDefaultOutputProps
-
getOutputProperties
Get the static properties for xsl:output. The object returned will be a clone of the internal values, and thus it can be mutated without mutating the Templates object, and then handed in to the process method.For XSLT, Attribute Value Templates attribute values will be returned unexpanded (since there is no context at this point).
- Specified by:
getOutputProperties
in interfaceTemplates
- Returns:
- A Properties object, not null.
-
recompose
Recompose the values of all "composed" properties, meaning properties that need to be combined or calculated from the combination of imported and included stylesheets. This method determines the proper import precedence of all imported stylesheets. It then iterates through all of the elements and properties in the proper order and triggers the individual recompose methods.- Throws:
TransformerException
-
getGlobalImport
Get a stylesheet from the global import list. TODO: JKESS PROPOSES SPECIAL-CASE FOR NO IMPORT LIST, TO MATCH COUNT.- Parameters:
i
- Index of stylesheet to get from global import list- Returns:
- The stylesheet at the given index
-
getGlobalImportCount
public int getGlobalImportCount()Get the total number of imports in the global import list.- Returns:
- The total number of imported stylesheets, including the root stylesheet, thus the number will always be 1 or greater. TODO: JKESS PROPOSES SPECIAL-CASE FOR NO IMPORT LIST, TO MATCH DESCRIPTION.
-
getImportNumber
Given a stylesheet, return the number of the stylesheet in the global import list.- Parameters:
sheet
- The stylesheet which will be located in the global import list.- Returns:
- The index into the global import list of the given stylesheet, or -1 if it is not found (which should never happen).
-
getOutputComposed
Get the combined "xsl:output" property with the properties combined from the included stylesheets. If a xsl:output is not declared in this stylesheet or an included stylesheet, look in the imports. Please note that this returns a reference to the OutputProperties object, not a cloned object, like getOutputProperties does.- Returns:
- non-null reference to composed output properties object.
- See Also:
-
isOutputMethodSet
public boolean isOutputMethodSet()Find out if an output method has been set by the user.- Returns:
- Value indicating whether an output method has been set by the user
-
getAttributeSetComposed
Get a list "xsl:attribute-set" properties that match the qname.- Parameters:
name
- Qualified name of attribute set properties to get- Returns:
- A vector of attribute sets matching the given name
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getDecimalFormatComposed
Given a valid element decimal-format name, return the decimalFormatSymbols with that name.It is an error to declare either the default decimal-format or a decimal-format with a given name more than once (even with different import precedence), unless it is declared every time with the same value for all attributes (taking into account any default values).
Which means, as far as I can tell, the decimal-format properties are not additive.
- Parameters:
name
- Qualified name of the decimal format to find- Returns:
- DecimalFormatSymbols object matching the given name or null if name is not found.
-
getKeysComposed
Get the composed "xsl:key" properties.- Returns:
- A vector of the composed "xsl:key" properties.
- See Also:
-
getNamespaceAliasComposed
Get the "xsl:namespace-alias" property. Return the NamespaceAlias for a given namespace uri.- Parameters:
uri
- non-null reference to namespace that is to be aliased.- Returns:
- NamespaceAlias that matches uri, or null if no match.
- See Also:
-
getTemplateListComposed
Accessor method to retrieve theTemplateList
associated with this StylesheetRoot.- Returns:
- The composed
TemplateList
.
-
setTemplateListComposed
Mutator method to set theTemplateList
associated with this StylesheetRoot. This method should only be used by the compiler. Normally, the template list is built during the recompose process and should not be altered by the user.- Parameters:
templateList
- The newTemplateList
for this StylesheetRoot.
-
getTemplateComposed
public ElemTemplate getTemplateComposed(XPathContext xctxt, int targetNode, QName mode, boolean quietConflictWarnings, DTM dtm) throws TransformerException Get an "xsl:template" property by node match. This looks in the imports as well as this stylesheet.- Parameters:
xctxt
- non-null reference to XPath runtime execution context.targetNode
- non-null reference of node that the template must match.mode
- qualified name of the node, or null.quietConflictWarnings
- true if conflict warnings should not be reported.- Returns:
- reference to ElemTemplate that is the best match for targetNode, or null if no match could be made.
- Throws:
TransformerException
- See Also:
-
getTemplateComposed
public ElemTemplate getTemplateComposed(XPathContext xctxt, int targetNode, QName mode, int maxImportLevel, int endImportLevel, boolean quietConflictWarnings, DTM dtm) throws TransformerException Get an "xsl:template" property by node match. This looks in the imports as well as this stylesheet.- Parameters:
xctxt
- non-null reference to XPath runtime execution context.targetNode
- non-null reference of node that the template must match.mode
- qualified name of the node, or null.maxImportLevel
- The maximum importCountComposed that we should consider or -1 if we should consider all import levels. This is used by apply-imports to access templates that have been overridden.endImportLevel
- The count of composed importsquietConflictWarnings
- true if conflict warnings should not be reported.- Returns:
- reference to ElemTemplate that is the best match for targetNode, or null if no match could be made.
- Throws:
TransformerException
- See Also:
-
getTemplateComposed
Get an "xsl:template" property. This looks in the imports as well as this stylesheet.- Parameters:
qname
- non-null reference to qualified name of template.- Returns:
- reference to named template, or null if not found.
- See Also:
-
getVariableOrParamComposed
Get an "xsl:variable" property.- Parameters:
qname
- Qualified name of variable or param- Returns:
- The ElemVariable with the given qualified name
- See Also:
-
getVariablesAndParamsComposed
Get all global "xsl:variable" properties in scope for this stylesheet.- Returns:
- Vector of all variables and params in scope
- See Also:
-
shouldCheckWhitespace
public boolean shouldCheckWhitespace()Check to see if the caller should bother with check for whitespace nodes.- Returns:
- Whether the caller should bother with check for whitespace nodes.
-
getWhiteSpaceInfo
public WhiteSpaceInfo getWhiteSpaceInfo(XPathContext support, int targetElement, DTM dtm) throws TransformerException Get information about whether or not an element should strip whitespace.- Parameters:
support
- The XPath runtime state.targetElement
- Element to check- Returns:
- WhiteSpaceInfo for the given element
- Throws:
TransformerException
- See Also:
-
shouldStripWhiteSpace
public boolean shouldStripWhiteSpace(XPathContext support, int targetElement) throws TransformerException Get information about whether or not an element should strip whitespace.- Parameters:
support
- The XPath runtime state.targetElement
- Element to check- Returns:
- true if the whitespace should be stripped.
- Throws:
TransformerException
- See Also:
-
canStripWhiteSpace
public boolean canStripWhiteSpace()Get information about whether or not whitespace can be stripped.- Specified by:
canStripWhiteSpace
in interfaceWhitespaceStrippingElementMatcher
- Overrides:
canStripWhiteSpace
in classElemTemplateElement
- Returns:
- true if the whitespace can be stripped.
- See Also:
-
getDefaultTextRule
Get the default template for text.- Returns:
- the default template for text.
-
getDefaultRule
Get the default template for elements.- Returns:
- the default template for elements.
-
getDefaultRootRule
Get the default template for a root node.- Returns:
- The default template for a root node.
-
getStartRule
Get the default template for a root node.- Returns:
- The default template for a root node.
-
setExtensionHandlerClass
This internal method allows the setting of the java class to handle the extension function (if other than the default one). -
getExtensionHandlerClass
-
getOptimizer
public boolean getOptimizer()- Returns:
- Optimization flag
-
setOptimizer
public void setOptimizer(boolean b) - Parameters:
b
- Optimization flag
-
getIncremental
public boolean getIncremental()- Returns:
- Incremental flag
-
getSource_location
public boolean getSource_location()- Returns:
- source location flag
-
setIncremental
public void setIncremental(boolean b) - Parameters:
b
- Incremental flag
-
setSource_location
public void setSource_location(boolean b) - Parameters:
b
- Source location flag
-