|
|||||||||
| Home >> All >> org >> apache >> xalan >> [ templates overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.xalan.templates
Class StylesheetRoot

java.lang.Objectorg.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:
- org.w3c.dom.Document, org.w3c.dom.Element, org.apache.xpath.ExpressionNode, org.w3c.dom.Node, org.w3c.dom.NodeList, org.apache.xml.utils.PrefixResolver, java.io.Serializable, javax.xml.transform.SourceLocator, javax.xml.transform.Templates, org.apache.xpath.WhitespaceStrippingElementMatcher, XSLTVisitable
- public class StylesheetRoot
- extends StylesheetComposed
- implements java.io.Serializable, javax.xml.transform.Templates
- extends StylesheetComposed
This class represents the root object of the stylesheet tree.
| Nested Class Summary | |
(package private) class |
StylesheetRoot.ComposeState
Class to track state global state during the compose() operation. |
| Field Summary | |
private java.util.Hashtable |
m_attrSets
Composed set of all included and imported attribute set properties. |
private java.util.Hashtable |
m_availElems
The schema used when creating this StylesheetRoot |
private StylesheetRoot.ComposeState |
m_composeState
|
private java.util.Hashtable |
m_decimalFormatSymbols
Table of DecimalFormatSymbols, keyed by QName. |
private ElemTemplate |
m_defaultRootRule
The default template to use for the root if we don't find anything else. |
private ElemTemplate |
m_defaultRule
The default template to use if we don't find anything else. |
private ElemTemplate |
m_defaultTextRule
The default template to use for text nodes if we don't find anything else. |
private org.apache.xalan.extensions.ExtensionNamespacesManager |
m_extNsMgr
|
private StylesheetComposed[] |
m_globalImportList
The combined list of imports. |
private java.util.Vector |
m_keyDecls
A list of all key declarations visible from this stylesheet and all lesser stylesheets. |
private java.util.Hashtable |
m_namespaceAliasComposed
Composed set of all namespace aliases. |
private boolean |
m_outputMethodSet
Flag indicating whether an output method has been set by the user. |
private OutputProperties |
m_outputProperties
This will be set up with the default values, and then the values will be set as stylesheets are encountered. |
(package private) org.apache.xpath.XPath |
m_selectDefault
Used for default selection. |
private ElemTemplate |
m_startRule
The start rule to kick off the transformation. |
private TemplateList |
m_templateList
The "xsl:template" properties. |
private java.util.Vector |
m_variables
Composed set of all variables and params. |
private TemplateList |
m_whiteSpaceInfoList
A list of properties that specify how to do space stripping. |
| Fields inherited from class org.apache.xalan.templates.StylesheetComposed |
|
| Fields inherited from class org.apache.xalan.templates.Stylesheet |
m_DecimalFormatDeclarations, STYLESHEET_EXT |
| Fields inherited from class org.apache.xalan.templates.ElemTemplateElement |
m_docOrderNumber, m_firstChild, m_hasVariableDecl, m_nextSibling, m_parentNode, m_prefixTable |
| Constructor Summary | |
StylesheetRoot(javax.xml.transform.ErrorListener errorListener)
Uses an XSL stylesheet document. |
|
StylesheetRoot(org.apache.xalan.processor.XSLTSchema schema,
javax.xml.transform.ErrorListener listener)
Creates a StylesheetRoot and retains a pointer to the schema used to create this StylesheetRoot. |
|
| Method Summary | |
protected void |
addImports(Stylesheet stylesheet,
boolean addToList,
java.util.Vector importList)
Add the imports in the given sheet to the working importList vector. |
boolean |
canStripWhiteSpace()
Get information about whether or not whitespace can be stripped. |
private void |
clearComposeState()
Clear the compose state. |
(package private) void |
composeTemplates(ElemTemplateElement templ)
Call the compose function for each ElemTemplateElement. |
java.util.Vector |
getAttributeSetComposed(org.apache.xml.utils.QName name)
Get a list "xsl:attribute-set" properties that match the qname. |
java.util.Hashtable |
getAvailableElements()
Get the hashtable of available elements. |
(package private) StylesheetRoot.ComposeState |
getComposeState()
Return class to track state global state during the compose() operation. |
java.text.DecimalFormatSymbols |
getDecimalFormatComposed(org.apache.xml.utils.QName name)
Given a valid element decimal-format name, return the decimalFormatSymbols with that name. |
java.util.Properties |
getDefaultOutputProps()
|
ElemTemplate |
getDefaultRootRule()
Get the default template for a root node. |
ElemTemplate |
getDefaultRule()
Get the default template for elements. |
ElemTemplate |
getDefaultTextRule()
Get the default template for text. |
org.apache.xalan.extensions.ExtensionNamespacesManager |
getExtensionNamespacesManager()
Only instantiate an ExtensionNamespacesManager if one is called for (i.e., if the stylesheet contains extension functions and/or elements). |
java.util.Vector |
getExtensions()
Get the vector of extension namespaces. |
StylesheetComposed |
getGlobalImport(int i)
Get a stylesheet from the global import list. |
int |
getGlobalImportCount()
Get the total number of imports in the global import list. |
int |
getImportNumber(StylesheetComposed sheet)
Given a stylesheet, return the number of the stylesheet in the global import list. |
java.util.Vector |
getKeysComposed()
Get the composed "xsl:key" properties. |
NamespaceAlias |
getNamespaceAliasComposed(java.lang.String uri)
Get the "xsl:namespace-alias" property. |
OutputProperties |
getOutputComposed()
Get the combined "xsl:output" property with the properties combined from the included stylesheets. |
java.util.Properties |
getOutputProperties()
Get the static properties for xsl:output. |
ElemTemplate |
getStartRule()
Get the default template for a root node. |
ElemTemplate |
getTemplateComposed(org.apache.xml.utils.QName qname)
Get an "xsl:template" property. |
ElemTemplate |
getTemplateComposed(org.apache.xpath.XPathContext xctxt,
int targetNode,
org.apache.xml.utils.QName mode,
boolean quietConflictWarnings,
org.apache.xml.dtm.DTM dtm)
Get an "xsl:template" property by node match. |
ElemTemplate |
getTemplateComposed(org.apache.xpath.XPathContext xctxt,
int targetNode,
org.apache.xml.utils.QName mode,
int maxImportLevel,
int endImportLevel,
boolean quietConflictWarnings,
org.apache.xml.dtm.DTM dtm)
Get an "xsl:template" property by node match. |
TemplateList |
getTemplateListComposed()
Accessor method to retrieve the TemplateList associated with
this StylesheetRoot. |
ElemVariable |
getVariableOrParamComposed(org.apache.xml.utils.QName qname)
Get an "xsl:variable" property. |
java.util.Vector |
getVariablesAndParamsComposed()
Get all global "xsl:variable" properties in scope for this stylesheet. |
WhiteSpaceInfo |
getWhiteSpaceInfo(org.apache.xpath.XPathContext support,
int targetElement,
org.apache.xml.dtm.DTM dtm)
Get information about whether or not an element should strip whitespace. |
(package private) void |
initComposeState()
Initialize a new ComposeState. |
private void |
initDefaultRule(javax.xml.transform.ErrorListener errorListener)
Create the default rule if needed. |
boolean |
isOutputMethodSet()
Find out if an output method has been set by the user. |
boolean |
isRoot()
Tell if this is the root of the stylesheet tree. |
javax.xml.transform.Transformer |
newTransformer()
Create a new transformation context for this Templates object. |
private void |
QuickSort2(java.util.Vector v,
int lo0,
int hi0)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. |
void |
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. |
(package private) void |
recomposeAttributeSets(ElemAttributeSet attrSet)
Recompose the attribute-set declarations. |
(package private) void |
recomposeDecimalFormats(DecimalFormatProperties dfp)
Recompose the decimal-format declarations. |
(package private) void |
recomposeKeys(KeyDeclaration keyDecl)
Recompose the key declarations. |
(package private) void |
recomposeNamespaceAliases(NamespaceAlias nsAlias)
Recompose the namespace-alias declarations. |
(package private) void |
recomposeOutput(OutputProperties oprops)
Recompose the output format object from the included elements. |
(package private) void |
recomposeTemplates(ElemTemplate template)
Recompose the template declarations. |
(package private) void |
recomposeVariables(ElemVariable elemVar)
Recompose the top level variable and parameter declarations. |
(package private) void |
recomposeWhiteSpaceInfo(WhiteSpaceInfo wsi)
Recompose the strip-space and preserve-space declarations. |
void |
setTemplateListComposed(TemplateList templateList)
Mutator method to set the TemplateList associated with this
StylesheetRoot. |
boolean |
shouldCheckWhitespace()
Check to see if the caller should bother with check for whitespace nodes. |
boolean |
shouldStripWhiteSpace(org.apache.xpath.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, recomposeImports, recomposeIncludes, recomposeTemplates |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Node |
compareDocumentPosition, getBaseURI, getFeature, getTextContent, getUserData, isDefaultNamespace, isEqualNode, isSameNode, lookupNamespaceURI, lookupPrefix, setTextContent, setUserData |
| Methods inherited from interface org.w3c.dom.Element |
getSchemaTypeInfo, setIdAttribute, setIdAttributeNode, setIdAttributeNS |
| Methods inherited from interface org.w3c.dom.Document |
getDocumentURI, getDomConfig, getInputEncoding, getXmlEncoding, getXmlStandalone, getXmlVersion, normalizeDocument, renameNode, setDocumentURI, setXmlStandalone, setXmlVersion |
| Field Detail |
m_availElems
private java.util.Hashtable m_availElems
- The schema used when creating this StylesheetRoot
m_extNsMgr
private org.apache.xalan.extensions.ExtensionNamespacesManager m_extNsMgr
m_globalImportList
private StylesheetComposed[] m_globalImportList
- The combined list of imports. The stylesheet with the highest
import precedence will be at element 0. The one with the lowest
import precedence will be at element length - 1.
m_outputProperties
private OutputProperties m_outputProperties
- This will be set up with the default values, and then the values
will be set as stylesheets are encountered.
m_outputMethodSet
private boolean m_outputMethodSet
- Flag indicating whether an output method has been set by the user.
m_attrSets
private java.util.Hashtable m_attrSets
- Composed set of all included and imported attribute set properties.
Each entry is a vector of ElemAttributeSet objects.
m_decimalFormatSymbols
private java.util.Hashtable m_decimalFormatSymbols
- Table of DecimalFormatSymbols, keyed by QName.
m_keyDecls
private java.util.Vector m_keyDecls
- A list of all key declarations visible from this stylesheet and all
lesser stylesheets.
m_namespaceAliasComposed
private java.util.Hashtable m_namespaceAliasComposed
- Composed set of all namespace aliases.
m_templateList
private TemplateList m_templateList
- The "xsl:template" properties.
m_variables
private java.util.Vector m_variables
- Composed set of all variables and params.
m_whiteSpaceInfoList
private TemplateList m_whiteSpaceInfoList
- A list of properties that specify how to do space
stripping. This uses the same exact mechanism as Templates.
m_defaultTextRule
private ElemTemplate m_defaultTextRule
- The default template to use for text nodes if we don't find
anything else. This is initialized in initDefaultRule().
m_defaultRule
private ElemTemplate m_defaultRule
- The default template to use if we don't find anything
else. This is initialized in initDefaultRule().
m_defaultRootRule
private ElemTemplate m_defaultRootRule
- The default template to use for the root if we don't find
anything else. This is initialized in initDefaultRule().
We kind of need this because the defaultRule isn't good
enough because it doesn't supply a document context.
For now, I default the root document element to "HTML".
Don't know if this is really a good idea or not.
I suspect it is not.
m_startRule
private ElemTemplate m_startRule
- The start rule to kick off the transformation.
m_selectDefault
org.apache.xpath.XPath m_selectDefault
- Used for default selection.
m_composeState
private StylesheetRoot.ComposeState m_composeState
| Constructor Detail |
StylesheetRoot
public StylesheetRoot(javax.xml.transform.ErrorListener errorListener) throws javax.xml.transform.TransformerConfigurationException
- Uses an XSL stylesheet document.
StylesheetRoot
public StylesheetRoot(org.apache.xalan.processor.XSLTSchema schema, javax.xml.transform.ErrorListener listener) throws javax.xml.transform.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.
| Method Detail |
isRoot
public boolean isRoot()
- Tell if this is the root of the stylesheet tree.
- Overrides:
isRootin classStylesheet
getAvailableElements
public java.util.Hashtable getAvailableElements()
- Get the hashtable of available elements.
getExtensionNamespacesManager
public org.apache.xalan.extensions.ExtensionNamespacesManager getExtensionNamespacesManager()
- Only instantiate an ExtensionNamespacesManager if one is called for
(i.e., if the stylesheet contains extension functions and/or elements).
getExtensions
public java.util.Vector 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
public javax.xml.transform.Transformer newTransformer()
- Create a new transformation context for this Templates object.
- Specified by:
newTransformerin interfacejavax.xml.transform.Templates
getDefaultOutputProps
public java.util.Properties getDefaultOutputProps()
getOutputProperties
public java.util.Properties 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:
getOutputPropertiesin interfacejavax.xml.transform.Templates
recompose
public void recompose()
throws javax.xml.transform.TransformerException
- 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.
composeTemplates
void composeTemplates(ElemTemplateElement templ) throws javax.xml.transform.TransformerException
- Call the compose function for each ElemTemplateElement.
addImports
protected void addImports(Stylesheet stylesheet, boolean addToList, java.util.Vector importList)
- Add the imports in the given sheet to the working importList vector.
The will be added from highest import precedence to
least import precedence. This is a post-order traversal of the
import tree as described in the
XSLT Recommendation.
For example, suppose
stylesheet A imports stylesheets B and C in that order;
stylesheet B imports stylesheet D;
stylesheet C imports stylesheet E.
Then the order of import precedence (highest first) is A, C, E, B, D.
getGlobalImport
public StylesheetComposed getGlobalImport(int i)
- Get a stylesheet from the global import list.
TODO: JKESS PROPOSES SPECIAL-CASE FOR NO IMPORT LIST, TO MATCH COUNT.
getGlobalImportCount
public int getGlobalImportCount()
- Get the total number of imports in the global import list.
getImportNumber
public int getImportNumber(StylesheetComposed sheet)
- Given a stylesheet, return the number of the stylesheet
in the global import list.
recomposeOutput
void recomposeOutput(OutputProperties oprops) throws javax.xml.transform.TransformerException
- Recompose the output format object from the included elements.
getOutputComposed
public OutputProperties 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.
isOutputMethodSet
public boolean isOutputMethodSet()
- Find out if an output method has been set by the user.
recomposeAttributeSets
void recomposeAttributeSets(ElemAttributeSet attrSet)
- Recompose the attribute-set declarations.
getAttributeSetComposed
public java.util.Vector getAttributeSetComposed(org.apache.xml.utils.QName name) throws java.lang.ArrayIndexOutOfBoundsException
- Get a list "xsl:attribute-set" properties that match the qname.
recomposeDecimalFormats
void recomposeDecimalFormats(DecimalFormatProperties dfp)
- Recompose the decimal-format declarations.
getDecimalFormatComposed
public java.text.DecimalFormatSymbols getDecimalFormatComposed(org.apache.xml.utils.QName name)
- 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.
recomposeKeys
void recomposeKeys(KeyDeclaration keyDecl)
- Recompose the key declarations.
getKeysComposed
public java.util.Vector getKeysComposed()
- Get the composed "xsl:key" properties.
recomposeNamespaceAliases
void recomposeNamespaceAliases(NamespaceAlias nsAlias)
- Recompose the namespace-alias declarations.
getNamespaceAliasComposed
public NamespaceAlias getNamespaceAliasComposed(java.lang.String uri)
- Get the "xsl:namespace-alias" property.
Return the NamespaceAlias for a given namespace uri.
recomposeTemplates
void recomposeTemplates(ElemTemplate template)
- Recompose the template declarations.
getTemplateListComposed
public final TemplateList getTemplateListComposed()
- Accessor method to retrieve the
TemplateListassociated with this StylesheetRoot.
setTemplateListComposed
public final void setTemplateListComposed(TemplateList templateList)
- Mutator method to set the
TemplateListassociated 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.
getTemplateComposed
public ElemTemplate getTemplateComposed(org.apache.xpath.XPathContext xctxt, int targetNode, org.apache.xml.utils.QName mode, boolean quietConflictWarnings, org.apache.xml.dtm.DTM dtm) throws javax.xml.transform.TransformerException
- Get an "xsl:template" property by node match. This looks in the imports as
well as this stylesheet.
getTemplateComposed
public ElemTemplate getTemplateComposed(org.apache.xpath.XPathContext xctxt, int targetNode, org.apache.xml.utils.QName mode, int maxImportLevel, int endImportLevel, boolean quietConflictWarnings, org.apache.xml.dtm.DTM dtm) throws javax.xml.transform.TransformerException
- Get an "xsl:template" property by node match. This looks in the imports as
well as this stylesheet.
getTemplateComposed
public ElemTemplate getTemplateComposed(org.apache.xml.utils.QName qname)
- Get an "xsl:template" property. This looks in the imports as
well as this stylesheet.
recomposeVariables
void recomposeVariables(ElemVariable elemVar)
- Recompose the top level variable and parameter declarations.
getVariableOrParamComposed
public ElemVariable getVariableOrParamComposed(org.apache.xml.utils.QName qname)
- Get an "xsl:variable" property.
getVariablesAndParamsComposed
public java.util.Vector getVariablesAndParamsComposed()
- Get all global "xsl:variable" properties in scope for this stylesheet.
recomposeWhiteSpaceInfo
void recomposeWhiteSpaceInfo(WhiteSpaceInfo wsi)
- Recompose the strip-space and preserve-space declarations.
shouldCheckWhitespace
public boolean shouldCheckWhitespace()
- Check to see if the caller should bother with check for
whitespace nodes.
getWhiteSpaceInfo
public WhiteSpaceInfo getWhiteSpaceInfo(org.apache.xpath.XPathContext support, int targetElement, org.apache.xml.dtm.DTM dtm) throws javax.xml.transform.TransformerException
- Get information about whether or not an element should strip whitespace.
shouldStripWhiteSpace
public boolean shouldStripWhiteSpace(org.apache.xpath.XPathContext support, int targetElement) throws javax.xml.transform.TransformerException
- Get information about whether or not an element should strip whitespace.
canStripWhiteSpace
public boolean canStripWhiteSpace()
- Get information about whether or not whitespace can be stripped.
- Specified by:
canStripWhiteSpacein interfaceorg.apache.xpath.WhitespaceStrippingElementMatcher- Overrides:
canStripWhiteSpacein classElemTemplateElement
getDefaultTextRule
public final ElemTemplate getDefaultTextRule()
- Get the default template for text.
getDefaultRule
public final ElemTemplate getDefaultRule()
- Get the default template for elements.
getDefaultRootRule
public final ElemTemplate getDefaultRootRule()
- Get the default template for a root node.
getStartRule
public final ElemTemplate getStartRule()
- Get the default template for a root node.
initDefaultRule
private void initDefaultRule(javax.xml.transform.ErrorListener errorListener) throws javax.xml.transform.TransformerException
- Create the default rule if needed.
QuickSort2
private void QuickSort2(java.util.Vector v, int lo0, int hi0)
- This is a generic version of C.A.R Hoare's Quick Sort
algorithm. This will handle arrays that are already
sorted, and arrays with duplicate keys. It was lifted from
the NodeSorter class but should probably be eliminated and replaced
with a call to Collections.sort when we migrate to Java2.
If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right. The first time you call this function it will be with the parameters 0, a.length - 1.
initComposeState
void initComposeState()
- Initialize a new ComposeState.
getComposeState
StylesheetRoot.ComposeState getComposeState()
- Return class to track state global state during the compose() operation.
clearComposeState
private void clearComposeState()
- Clear the compose state.
|
|||||||||
| Home >> All >> org >> apache >> xalan >> [ templates overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC