Package org.apache.xalan.templates
Class Stylesheet
java.lang.Object
org.apache.xml.utils.UnImplNode
org.apache.xalan.templates.ElemTemplateElement
org.apache.xalan.templates.Stylesheet
- All Implemented Interfaces:
Serializable
,SourceLocator
,XSLTVisitable
,PrefixResolver
,ExpressionNode
,WhitespaceStrippingElementMatcher
,Document
,Element
,Node
,NodeList
- Direct Known Subclasses:
StylesheetComposed
Represents a stylesheet element.
All properties in this class have a fixed form of bean-style property accessors for all properties that represent XSL attributes or elements. These properties have setter method names accessed generically by the processor, and so these names must be fixed according to the system defined in the getSetterMethodName function.
<!ENTITY % top-level " (xsl:import*, (xsl:include | xsl:strip-space | xsl:preserve-space | xsl:output | xsl:key | xsl:decimal-format | xsl:attribute-set | xsl:variable | xsl:param | xsl:template | xsl:namespace-alias %non-xsl-top-level;)*) "> <!ENTITY % top-level-atts ' extension-element-prefixes CDATA #IMPLIED exclude-result-prefixes CDATA #IMPLIED id ID #IMPLIED version NMTOKEN #REQUIRED xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform" %space-att; '> <!ELEMENT xsl:stylesheet %top-level;> <!ATTLIST xsl:stylesheet %top-level-atts;> <!ELEMENT xsl:transform %top-level;> <!ATTLIST xsl:transform %top-level-atts;>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Extension to be used when serializing to disk.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsExcludeResultPrefix
(String prefix, String uri) Get whether or not the passed prefix is contained flagged by the "exclude-result-prefixes" property.boolean
Find out if this contains a given "extension-element-prefix" property.getAttributeSet
(int i) Get an "xsl:attribute-set" property.int
Get the number of "xsl:attribute-set" properties.boolean
Get whether or not the stylesheet is in "Forward Compatibility Mode"getDecimalFormat
(int i) Get an "xsl:decimal-format" property.getDecimalFormat
(QName name) Get an "xsl:decimal-format" property.int
Get the number of xsl:decimal-format declarations.getExcludeResultPrefix
(int i) Get an "exclude-result-prefix" property.int
Get the number of "exclude-result-prefixes" Strings.getExtensionElementPrefix
(int i) Get and "extension-element-prefix" property.int
Get the number of "extension-element-prefixes" Strings.getHref()
Get the base identifier with which this stylesheet is associated.getId()
Get the "id" property.getImport
(int i) Get a stylesheet from the "import" list.int
Get the number of imported stylesheets.getInclude
(int i) Get the stylesheet at the given in index in "include" listint
Get the number of included stylesheets.getKey
(int i) Get an "xsl:key" property.int
Get the number of "xsl:key" properties.getNamespaceAlias
(int i) Get an "xsl:namespace-alias" property.int
Get the number of "xsl:namespace-alias" properties.Return the node name.short
Get the type of the node.getNonXslTopLevel
(QName name) Get a non-xslt element.getOutput
(int i) Get an "xsl:output" property.int
Get the number of "xsl:output" properties.Get an "xsl:param" property.getPreserveSpace
(int i) Get a "xsl:preserve-space" property.int
Get the number of "xsl:preserve-space" properties.getStripSpace
(int i) Get an "xsl:strip-space" property.int
Get the number of "xsl:strip-space" properties.Get the owning stylesheet.Get the owning aggregated stylesheet, or this stylesheet if it is aggregated.Get the parent of the stylesheet.Get the root of the stylesheet, where all the tables common to all stylesheets are kept.getTemplate
(int i) Get an "xsl:template" property.int
Get the number of "xsl:template" properties.getVariable
(QName qname) Get an "xsl:variable" property.getVariableOrParam
(int i) Get an "xsl:variable" property.getVariableOrParam
(QName qname) Get an "xsl:variable" or "xsl:param" property.int
Get the number of "xsl:variable" properties.Get the "version" property.Get the "xmlns:xsl" property.int
Get an integer representation of the element type.boolean
Tell if this can be cast to a StylesheetComposed, meaning, you can ask questions from getXXXComposed functions.boolean
isRoot()
Tell if this is the root of the stylesheet tree.void
replaceTemplate
(ElemTemplate v, int i) Replace an "xsl:template" property.void
setAttributeSet
(ElemAttributeSet attrSet) Set the "xsl:attribute-set" property.void
Process the xsl:decimal-format element.void
Set the "exclude-result-prefixes" property.void
Set the "extension-element-prefixes" property.void
Set the base identifier with which this stylesheet is associated.void
Set the "id" property.void
Add a stylesheet to the "import" list.void
Add a stylesheet to the "include" list.void
Set the "xsl:key" property.void
setLocaterInfo
(SourceLocator locator) Set the location information for this element.void
Set the "xsl:namespace-alias" property.void
setNonXslTopLevel
(QName name, Object obj) Set found a non-xslt element.void
Set the "xsl:output" property.void
Set an "xsl:param" property.void
Set the "xsl:preserve-space" property.void
Set the "xsl:strip-space" properties.void
Set the parent of the stylesheet.void
Set the root of the stylesheet, where all the tables common to all stylesheets are kept.void
Set an "xsl:template" property.void
Set the "xsl:variable" property.void
setVersion
(String v) Set the "version" property.void
Set the "xmlns:xsl" property.Methods inherited from class org.apache.xalan.templates.ElemTemplateElement
appendChild, appendChild, callVisitors, canAcceptVariables, canStripWhiteSpace, 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
-
Field Details
-
STYLESHEET_EXT
Extension to be used when serializing to disk.- See Also:
-
-
Constructor Details
-
Stylesheet
Constructor for a Stylesheet.- Parameters:
parent
- The including or importing stylesheet.
-
-
Method Details
-
getStylesheet
Get the owning stylesheet. This looks up the inheritance chain until it calls getStylesheet on a Stylesheet object, which will return itself.- Overrides:
getStylesheet
in classElemTemplateElement
- Returns:
- The owning stylesheet, itself.
-
isAggregatedType
public boolean isAggregatedType()Tell if this can be cast to a StylesheetComposed, meaning, you can ask questions from getXXXComposed functions.- Returns:
- False if this is not a StylesheetComposed
-
isRoot
public boolean isRoot()Tell if this is the root of the stylesheet tree.- Returns:
- False is this is not the root of the stylesheet tree.
-
setXmlnsXsl
Set the "xmlns:xsl" property.- Parameters:
v
- The value to be set for the "xmlns:xsl" property.- See Also:
-
getXmlnsXsl
Get the "xmlns:xsl" property.- Returns:
- The value of the "xmlns:xsl" property.
- See Also:
-
setExtensionElementPrefixes
Set the "extension-element-prefixes" property.- Parameters:
v
- The value to be set for the "extension-element-prefixes" property: a vector of extension element URIs.- See Also:
-
getExtensionElementPrefix
Get and "extension-element-prefix" property.- Parameters:
i
- Index of extension element URI in list- Returns:
- The extension element URI at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getExtensionElementPrefixCount
public int getExtensionElementPrefixCount()Get the number of "extension-element-prefixes" Strings.- Returns:
- Number of URIs in the list
- See Also:
-
containsExtensionElementURI
Find out if this contains a given "extension-element-prefix" property.- Parameters:
uri
- URI of extension element to look for- Returns:
- True if the given URI was found in the list
- See Also:
-
setExcludeResultPrefixes
Set the "exclude-result-prefixes" property. The designation of a namespace as an excluded namespace is effective within the subtree of the stylesheet rooted at the element bearing the exclude-result-prefixes or xsl:exclude-result-prefixes attribute; a subtree rooted at an xsl:stylesheet element does not include any stylesheets imported or included by children of that xsl:stylesheet element.- Parameters:
v
- A StringVector of prefixes to exclude- See Also:
-
getExcludeResultPrefix
Get an "exclude-result-prefix" property. The designation of a namespace as an excluded namespace is effective within the subtree of the stylesheet rooted at the element bearing the exclude-result-prefixes or xsl:exclude-result-prefixes attribute; a subtree rooted at an xsl:stylesheet element does not include any stylesheets imported or included by children of that xsl:stylesheet element.- Parameters:
i
- Index of prefix to get in list- Returns:
- Prefix to be excluded at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getExcludeResultPrefixCount
public int getExcludeResultPrefixCount()Get the number of "exclude-result-prefixes" Strings.- Returns:
- The number of prefix strings to be excluded.
- See Also:
-
containsExcludeResultPrefix
Get whether or not the passed prefix is contained flagged by the "exclude-result-prefixes" property.- Overrides:
containsExcludeResultPrefix
in classElemTemplateElement
- Parameters:
prefix
- non-null reference to prefix that might be excluded.uri
- reference to namespace that prefix maps to- Returns:
- true if the prefix should normally be excluded.>
- See Also:
-
setId
Set the "id" property.- Parameters:
v
- Value for the "id" property.- See Also:
-
getId
Get the "id" property.- Returns:
- The value of the "id" property.
- See Also:
-
setVersion
Set the "version" property.- Parameters:
v
- Value for the "version" property.- See Also:
-
getCompatibleMode
public boolean getCompatibleMode()Get whether or not the stylesheet is in "Forward Compatibility Mode"- Returns:
- true if in forward compatible mode, false otherwise
-
getVersion
Get the "version" property.- Returns:
- The value of the "version" property.
- See Also:
-
setImport
Add a stylesheet to the "import" list.- Parameters:
v
- Stylesheet to add to the import list- See Also:
-
getImport
Get a stylesheet from the "import" list.- Parameters:
i
- Index of the stylesheet to get- Returns:
- The stylesheet at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getImportCount
public int getImportCount()Get the number of imported stylesheets.- Returns:
- the number of imported stylesheets.
- See Also:
-
setInclude
Add a stylesheet to the "include" list.- Parameters:
v
- Stylesheet to add to the "include" list- See Also:
-
getInclude
Get the stylesheet at the given in index in "include" list- Parameters:
i
- Index of stylesheet to get- Returns:
- Stylesheet at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getIncludeCount
public int getIncludeCount()Get the number of included stylesheets.- Returns:
- the number of included stylesheets.
- See Also:
-
setDecimalFormat
Process the xsl:decimal-format element.- Parameters:
edf
- Decimal-format element to push into stack
-
getDecimalFormat
Get an "xsl:decimal-format" property.- Parameters:
name
- The qualified name of the decimal format property.- Returns:
- null if not found, otherwise a DecimalFormatProperties object, from which you can get a DecimalFormatSymbols object.
- See Also:
-
getDecimalFormat
Get an "xsl:decimal-format" property.- Parameters:
i
- Index of decimal-format property in stack- Returns:
- The decimal-format property at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getDecimalFormatCount
public int getDecimalFormatCount()Get the number of xsl:decimal-format declarations.- Returns:
- the number of xsl:decimal-format declarations.
- See Also:
-
setStripSpaces
Set the "xsl:strip-space" properties.- Parameters:
wsi
- WhiteSpaceInfo element to add to list- See Also:
-
getStripSpace
Get an "xsl:strip-space" property.- Parameters:
i
- Index of WhiteSpaceInfo to get- Returns:
- WhiteSpaceInfo at given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getStripSpaceCount
public int getStripSpaceCount()Get the number of "xsl:strip-space" properties.- Returns:
- the number of "xsl:strip-space" properties.
- See Also:
-
setPreserveSpaces
Set the "xsl:preserve-space" property.- Parameters:
wsi
- WhiteSpaceInfo element to add to list- See Also:
-
getPreserveSpace
Get a "xsl:preserve-space" property.- Parameters:
i
- Index of WhiteSpaceInfo to get- Returns:
- WhiteSpaceInfo at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getPreserveSpaceCount
public int getPreserveSpaceCount()Get the number of "xsl:preserve-space" properties.- Returns:
- the number of "xsl:preserve-space" properties.
- See Also:
-
setOutput
Set the "xsl:output" property.- Parameters:
v
- non-null reference to the OutputProperties object to be added to the collection.- See Also:
-
getOutput
Get an "xsl:output" property.- Parameters:
i
- Index of OutputFormatExtended to get- Returns:
- non-null reference to an OutputProperties object.
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getOutputCount
public int getOutputCount()Get the number of "xsl:output" properties.- Returns:
- The number of OutputProperties objects contained in this stylesheet.
- See Also:
-
setKey
Set the "xsl:key" property.- Parameters:
v
- KeyDeclaration element to add to the list of key declarations- See Also:
-
getKey
Get an "xsl:key" property.- Parameters:
i
- Index of KeyDeclaration element to get- Returns:
- KeyDeclaration element at given index in list
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getKeyCount
public int getKeyCount()Get the number of "xsl:key" properties.- Returns:
- the number of "xsl:key" properties.
- See Also:
-
setAttributeSet
Set the "xsl:attribute-set" property.- Parameters:
attrSet
- ElemAttributeSet to add to the list of attribute sets- See Also:
-
getAttributeSet
Get an "xsl:attribute-set" property.- Parameters:
i
- Index of ElemAttributeSet to get in list- Returns:
- ElemAttributeSet at the given index
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getAttributeSetCount
public int getAttributeSetCount()Get the number of "xsl:attribute-set" properties.- Returns:
- the number of "xsl:attribute-set" properties.
- See Also:
-
setVariable
Set the "xsl:variable" property.- Parameters:
v
- ElemVariable object to add to list of top level variables- See Also:
-
getVariableOrParam
Get an "xsl:variable" or "xsl:param" property.- Parameters:
qname
- non-null reference to the qualified name of the variable.- Returns:
- The ElemVariable with the given name in the list or null
- See Also:
-
getVariable
Get an "xsl:variable" property.- Parameters:
qname
- Qualified name of the xsl:variable to get- Returns:
- reference to the variable named by qname, or null if not found.
- See Also:
-
getVariableOrParam
Get an "xsl:variable" property.- Parameters:
i
- Index of variable to get in the list- Returns:
- ElemVariable at the given index in the list
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getVariableOrParamCount
public int getVariableOrParamCount()Get the number of "xsl:variable" properties.- Returns:
- the number of "xsl:variable" properties.
- See Also:
-
setParam
Set an "xsl:param" property.- Parameters:
v
- A non-null ElemParam reference.- See Also:
-
getParam
Get an "xsl:param" property.- Parameters:
qname
- non-null reference to qualified name of the parameter.- Returns:
- ElemParam with the given name in the list or null
- See Also:
-
setTemplate
Set an "xsl:template" property.- Parameters:
v
- ElemTemplate to add to list of templates- See Also:
-
getTemplate
Get an "xsl:template" property.- Parameters:
i
- Index of ElemTemplate in the list to get- Returns:
- ElemTemplate at the given index in the list
- Throws:
TransformerException
- See Also:
-
getTemplateCount
public int getTemplateCount()Get the number of "xsl:template" properties.- Returns:
- the number of "xsl:template" properties.
- See Also:
-
setNamespaceAlias
Set the "xsl:namespace-alias" property.- Parameters:
na
- NamespaceAlias elemeent to add to the list- See Also:
-
getNamespaceAlias
Get an "xsl:namespace-alias" property.- Parameters:
i
- Index of NamespaceAlias element to get from the list- Returns:
- NamespaceAlias element at the given index in the list
- Throws:
ArrayIndexOutOfBoundsException
- See Also:
-
getNamespaceAliasCount
public int getNamespaceAliasCount()Get the number of "xsl:namespace-alias" properties.- Returns:
- the number of "xsl:namespace-alias" properties.
- See Also:
-
setNonXslTopLevel
Set found a non-xslt element.- Parameters:
name
- Qualified name of the elementobj
- The element object- See Also:
-
getNonXslTopLevel
Get a non-xslt element.- Parameters:
name
- Qualified name of the element to get- Returns:
- The object associate with the given name
- See Also:
-
getHref
Get the base identifier with which this stylesheet is associated.- Returns:
- the base identifier with which this stylesheet is associated.
-
setHref
Set the base identifier with which this stylesheet is associated.- Parameters:
baseIdent
- the base identifier with which this stylesheet is associated.
-
setLocaterInfo
Set the location information for this element.- Overrides:
setLocaterInfo
in classElemTemplateElement
- Parameters:
locator
- SourceLocator object with location information
-
getStylesheetRoot
Get the root of the stylesheet, where all the tables common to all stylesheets are kept.- Overrides:
getStylesheetRoot
in classElemTemplateElement
- Returns:
- the root of the stylesheet
-
setStylesheetRoot
Set the root of the stylesheet, where all the tables common to all stylesheets are kept.- Parameters:
v
- the root of the stylesheet
-
getStylesheetParent
Get the parent of the stylesheet. This will be null if this is the root stylesheet.- Returns:
- the parent of the stylesheet.
-
setStylesheetParent
Set the parent of the stylesheet. This should be null if this is the root stylesheet.- Parameters:
v
- the parent of the stylesheet.
-
getStylesheetComposed
Get the owning aggregated stylesheet, or this stylesheet if it is aggregated.- Overrides:
getStylesheetComposed
in classElemTemplateElement
- Returns:
- the owning aggregated stylesheet or itself
-
getNodeType
public short getNodeType()Get the type of the node. We'll pretend we're a Document.- Specified by:
getNodeType
in interfaceNode
- Overrides:
getNodeType
in classElemTemplateElement
- Returns:
- the type of the node: document node.
-
getXSLToken
public int getXSLToken()Get an integer representation of the element type.- Overrides:
getXSLToken
in classElemTemplateElement
- Returns:
- An integer representation of the element, defined in the Constants class.
- See Also:
-
getNodeName
Return the node name.- Specified by:
getNodeName
in interfaceNode
- Overrides:
getNodeName
in classElemTemplateElement
- Returns:
- The node name
-
replaceTemplate
Replace an "xsl:template" property. This is a hook for CompilingStylesheetHandler, to allow us to access a template, compile it, instantiate it, and replace the original with the compiled instance. ADDED 9/5/2000 to support compilation experiment- Parameters:
v
- Compiled template to replace withi
- Index of template to be replaced- Throws:
TransformerException
-