## org.apache.xalan.xslt
Class Stylesheet

    java.lang.Object
      |
      +--org.apache.xalan.xslt.UnImplNode
            |
            +--org.apache.xalan.xslt.Stylesheet

Direct Known Subclasses:
  StylesheetRoot

public class Stylesheet
extends UnImplNode
implements java.io.Serializable, org.w3c.dom.Document, PrefixResolver

Represents the base stylesheet or an "import" stylesheet; "include" stylesheets are combined with the including stylesheet. At the moment these stylesheets can not be reused within the stylesheet tree or between trees. This needs to be fixed in the future.

See Also:
  Serialized Form

Field Summary
`StringToStringTable` `m_prefix_aliases`
`Stylesheet` `m_stylesheetParent` The parent of the stylesheet.
`StylesheetRoot` `m_stylesheetRoot` The root of the stylesheet, where all the tables common to all stylesheets are kept.
`static java.lang.String` `STYLESHEET_EXT` Extension to be used when serializing to disk.

Constructor Summary
`Stylesheet(StylesheetRoot root, XSLTEngineImpl processor, java.lang.String baseIdentifier)` Constructor for a Stylesheet needs a Document.

Method Summary
`void` `addExtensionNamespace(java.lang.String uri, ExtensionNSHandler nsh)` Add an extension namespace handler.
`org.w3c.dom.Attr` `createAttribute(java.lang.String name)` Unimplemented.
`org.w3c.dom.Attr` `createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)` Unimplemented.
`org.w3c.dom.CDATASection` `createCDATASection(java.lang.String data)` Unimplemented.
`org.w3c.dom.Comment` `createComment(java.lang.String data)` Unimplemented.
`org.w3c.dom.DocumentFragment` `createDocumentFragment()` Unimplemented.
`org.w3c.dom.Element` `createElement(java.lang.String tagName)` Unimplemented.
`org.w3c.dom.Element` `createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)` Unimplemented.
`org.w3c.dom.EntityReference` `createEntityReference(java.lang.String name)` Unimplemented.
`org.w3c.dom.ProcessingInstruction` `createProcessingInstruction(java.lang.String target, java.lang.String data)` Unimplemented.
`org.w3c.dom.Text` `createTextNode(java.lang.String data)` Unimplemented.
`XObject` `evalXPathStr(XPathSupport execContext, java.lang.String str, org.w3c.dom.Node context, PrefixResolver nsNode)` Evaluate an xpath string and return the result.
`ElemTemplate` `findTemplate(XSLTEngineImpl transformContext, org.w3c.dom.Node sourceTree, org.w3c.dom.Node targetNode, QName mode, boolean useImports)` Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft.
`java.util.Vector` `getAttributeSets()` Set table of attribute sets, keyed by set name.
`java.lang.String` `getBaseIdentifier()` Get the base identifier with which this stylesheet is associated.
`java.util.Stack` `getDecimalFormatDeclarations()` Get table of tables of element decimal-format.
`java.text.DecimalFormatSymbols` `getDecimalFormatElem(java.lang.String name)` Given a valid element decimal-format name, return the decimalFormatSymbols with that name.
`boolean` `getDefaultSpace()` Get if this stylesheet has the default space handling turned off or on according to the xml:space attribute.
`org.w3c.dom.DocumentType` `getDoctype()` Unimplemented.
`org.w3c.dom.Element` `getDocumentElement()` Unimplemented.
`org.w3c.dom.Element` `getElementById(java.lang.String elementId)` Unimplemented.
`org.w3c.dom.NodeList` `getElementsByTagName(java.lang.String tagname)` Unimplemented.
`org.w3c.dom.NodeList` `getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)` Unimplemented.
`StringToStringTable` `getExcludeResultPrefixes()` Set lookup table of exclude-result-prefixes.
`org.w3c.dom.DOMImplementation` `getImplementation()` Unimplemented.
`java.util.Vector` `getImports()` Get vector of the -imported- XSL Stylesheets.
`java.util.Vector` `getKeyDeclarations()` Get table of KeyDeclaration objects, which are set by the xsl:key element.
`java.lang.String` `getNamespaceForPrefix(java.lang.String prefix)` Get the namespace from a prefix.
`java.lang.String` `getNamespaceForPrefix(java.lang.String prefix, org.w3c.dom.Node context)` Given a namespace, get the corrisponding prefix.
`boolean` `getNeedToBuildKeysTable()` Get if an xsl:key directive is found.
`org.w3c.dom.NodeList` `getNodeSetByKey(XSLTEngineImpl tcontext, org.w3c.dom.Node doc, java.lang.String name, java.lang.String ref, PrefixResolver nscontext)` Given a valid element key, return the corresponding node list.
`short` `getNodeType()` Get the type of the node.
`Stylesheet` `getStylesheetParent()` Get the parent of the stylesheet.
`StylesheetRoot` `getStylesheetRoot()` Get the root of the stylesheet, where all the tables common to all stylesheets are kept.
`TemplateList` `getTemplateList()` Get the list of templates.
`java.util.Vector` `getTopLevelVariables()` Get table for defined constants, keyed on the names.
`java.util.Vector` `getWhitespacePreservingElements()` Get lookup table of all space preserving elements.
`java.util.Vector` `getWhitespaceStrippingElements()` Set lookup table of all space stripping elements.
`XPathFactory` `getXPathFactory()` Get the factory for making xpaths.
`XPathProcessor` `getXPathProcessor()` Get the XPath processor object.
`org.w3c.dom.Node` `importNode(org.w3c.dom.Node importedNode, boolean deep)` Unimplemented.
`java.lang.String` `lookForAlias(java.lang.String uri)` Return the alias namespace uri for a given namespace uri if one is found.
`ExtensionNSHandler` `lookupExtensionNSHandler(java.lang.String uri)` Return the handler for a given extension namespace.
`void` `setAttributeSets(java.util.Vector v)` Get table of attribute sets, keyed by set name.
`void` `setBaseIdentifier(java.lang.String baseIdent)` Get the base identifier with which this stylesheet is associated.
`void` `setDecimalFormatDeclarations(java.util.Stack v)` Set table of tables of element decimal-format.
`void` `setDefaultSpace(boolean v)` Set if this stylesheet has the default space handling turned off or on according to the xml:space attribute.
`void` `setExcludeResultPrefixes(StringToStringTable v)` Get lookup table of exclude-result-prefixes.
`void` `setImports(java.util.Vector v)` Set vector of the -imported- XSL Stylesheets.
`void` `setKeyDeclarations(java.util.Vector v)` Set table of KeyDeclaration objects, which are set by the xsl:key element.
`void` `setNeedToBuildKeysTable(boolean v)` Set if an xsl:key directive is found.
`void` `setStylesheetParent(Stylesheet v)` Set the parent of the stylesheet.
`void` `setStylesheetRoot(StylesheetRoot v)` Set the root of the stylesheet, where all the tables common to all stylesheets are kept.
`void` `setTemplateList(TemplateList v)` Set the list of templates.
`void` `setTopLevelVariables(java.util.Vector v)` Set table for defined constants, keyed on the names.
`void` `setWhitespacePreservingElements(java.util.Vector v)` Set lookup table of all space preserving elements.
`void` `setWhitespaceStrippingElements(java.util.Vector v)` Set lookup table of all space stripping elements.
`void` `setXPathFactory(XPathFactory factory)` Set the factory for making XPaths.
`void` `setXPathProcessor(XPathProcessor processor)` Set the XPath processor object.

Methods inherited from class org.apache.xalan.xslt.UnImplNode

`appendChild, cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getChildNodes, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTagName, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, item, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setNodeValue, setPrefix, supports`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_stylesheetRoot

    public StylesheetRoot m_stylesheetRoot

  The root of the stylesheet, where all the tables common to all stylesheets are kept.

### m_stylesheetParent

    public Stylesheet m_stylesheetParent

  The parent of the stylesheet. This will be null if this is the root stylesheet.

### m_prefix_aliases

    public StringToStringTable m_prefix_aliases

### STYLESHEET_EXT

    public static final java.lang.String STYLESHEET_EXT

  Extension to be used when serializing to disk.

Constructor Detail

### Stylesheet

    public Stylesheet(StylesheetRoot root,
                      XSLTEngineImpl processor,
                      java.lang.String baseIdentifier)
               throws XSLProcessorException,
                      java.net.MalformedURLException,
                      java.io.FileNotFoundException,
                      java.io.IOException,
                      org.xml.sax.SAXException

  Constructor for a Stylesheet needs a Document.
  Throws:
    XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

Method Detail

### getImports

    public java.util.Vector getImports()

  Get vector of the -imported- XSL Stylesheets.

### setImports

    public void setImports(java.util.Vector v)

  Set vector of the -imported- XSL Stylesheets.

### getAttributeSets

    public java.util.Vector getAttributeSets()

  Set table of attribute sets, keyed by set name.

### setAttributeSets

    public void setAttributeSets(java.util.Vector v)

  Get table of attribute sets, keyed by set name.

### getBaseIdentifier

    public java.lang.String getBaseIdentifier()

  Get the base identifier with which this stylesheet is associated.
  Specified by:
    getBaseIdentifier in interface PrefixResolver

### setBaseIdentifier

    public void setBaseIdentifier(java.lang.String baseIdent)

  Get the base identifier with which this stylesheet is associated.

### getStylesheetRoot

    public StylesheetRoot getStylesheetRoot()

  Get the root of the stylesheet, where all the tables common to all stylesheets are kept.

### setStylesheetRoot

    public void setStylesheetRoot(StylesheetRoot v)

  Set the root of the stylesheet, where all the tables common to all stylesheets are kept.

### getStylesheetParent

    public Stylesheet getStylesheetParent()

  Get the parent of the stylesheet. This will be null if this is the root stylesheet.

### setStylesheetParent

    public void setStylesheetParent(Stylesheet v)

  Set the parent of the stylesheet. This should be null if this is the root stylesheet.

### getTemplateList

    public TemplateList getTemplateList()

  Get the list of templates.

### setTemplateList

    public void setTemplateList(TemplateList v)

  Set the list of templates.

### getDefaultSpace

    public boolean getDefaultSpace()

  Get if this stylesheet has the default space handling turned off or on according to the xml:space attribute.

### setDefaultSpace

    public void setDefaultSpace(boolean v)

  Set if this stylesheet has the default space handling turned off or on according to the xml:space attribute.

### getWhitespacePreservingElements

    public java.util.Vector getWhitespacePreservingElements()

  Get lookup table of all space preserving elements.

### setWhitespacePreservingElements

    public void setWhitespacePreservingElements(java.util.Vector v)

  Set lookup table of all space preserving elements.

### getWhitespaceStrippingElements

    public java.util.Vector getWhitespaceStrippingElements()

  Set lookup table of all space stripping elements.

### setWhitespaceStrippingElements

    public void setWhitespaceStrippingElements(java.util.Vector v)

  Set lookup table of all space stripping elements.

### getExcludeResultPrefixes

    public StringToStringTable getExcludeResultPrefixes()

  Set lookup table of exclude-result-prefixes.

### setExcludeResultPrefixes

    public void setExcludeResultPrefixes(StringToStringTable v)

  Get lookup table of exclude-result-prefixes.

### getTopLevelVariables

    public java.util.Vector getTopLevelVariables()

  Get table for defined constants, keyed on the names.

### setTopLevelVariables

    public void setTopLevelVariables(java.util.Vector v)

  Set table for defined constants, keyed on the names.

### getKeyDeclarations

    public java.util.Vector getKeyDeclarations()

  Get table of KeyDeclaration objects, which are set by the xsl:key element.

### setKeyDeclarations

    public void setKeyDeclarations(java.util.Vector v)

  Set table of KeyDeclaration objects, which are set by the xsl:key element.

### getNeedToBuildKeysTable

    public boolean getNeedToBuildKeysTable()

  Get if an xsl:key directive is found. Mainly for use by the XMLParserLiaison classes for optimized processing of ids.

### setNeedToBuildKeysTable

    public void setNeedToBuildKeysTable(boolean v)

  Set if an xsl:key directive is found. Mainly for use by the XMLParserLiaison classes for optimized processing of ids.

### getDecimalFormatDeclarations

    public java.util.Stack getDecimalFormatDeclarations()

  Get table of tables of element decimal-format.
  See Also:
    `ElemDecimalFormat.`

### setDecimalFormatDeclarations

    public void setDecimalFormatDeclarations(java.util.Stack v)

  Set table of tables of element decimal-format.
  See Also:
    `ElemDecimalFormat.`

### lookForAlias

    public java.lang.String lookForAlias(java.lang.String uri)

  Return the alias namespace uri for a given namespace uri if one is found.
  Parameters:
    `uri` - the URI of the namespace.

### getNamespaceForPrefix

    public java.lang.String getNamespaceForPrefix(java.lang.String prefix,
                                                  org.w3c.dom.Node context)

  Given a namespace, get the corrisponding prefix.
  Specified by:
    getNamespaceForPrefix in interface PrefixResolver

### getNamespaceForPrefix

    public java.lang.String getNamespaceForPrefix(java.lang.String prefix)

  Get the namespace from a prefix.
  Specified by:
    getNamespaceForPrefix in interface PrefixResolver

### findTemplate

    public ElemTemplate findTemplate(XSLTEngineImpl transformContext,
                                     org.w3c.dom.Node sourceTree,
                                     org.w3c.dom.Node targetNode,
                                     QName mode,
                                     boolean useImports)
                              throws org.xml.sax.SAXException

  Given a target element, find the template that best matches in the given XSL document, according to the rules specified in the xsl draft.
  Parameters:
    `stylesheetTree` - Where the XSL rules are to be found.
    `sourceTree` - Where the targetElem is to be found.
    `targetElem` - The element that needs a rule.
    `mode` - A string indicating the display mode.
    `useImports` - means that this is an xsl:apply-imports commend.
    `foundStylesheet` - If non-null, the Stylesheet that the found template belongs to will be returned in the foundStylesheet[0].
  Returns:
    Rule that best matches targetElem.
  Throws:
    XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

### getNodeSetByKey

    public org.w3c.dom.NodeList getNodeSetByKey(XSLTEngineImpl tcontext,
                                                org.w3c.dom.Node doc,
                                                java.lang.String name,
                                                java.lang.String ref,
                                                PrefixResolver nscontext)
                                         throws org.xml.sax.SAXException

  Given a valid element key, return the corresponding node list.

### getDecimalFormatElem

    public java.text.DecimalFormatSymbols getDecimalFormatElem(java.lang.String name)

  Given a valid element decimal-format name, return the decimalFormatSymbols with that name.

### addExtensionNamespace

    public void addExtensionNamespace(java.lang.String uri,
                                      ExtensionNSHandler nsh)

  Add an extension namespace handler. This provides methods for calling an element extension as well as for function stuff (which is passed on to XPath).
  Parameters:
    `uri` - the URI of the extension namespace.
    `nsh` - handler

### lookupExtensionNSHandler

    public ExtensionNSHandler lookupExtensionNSHandler(java.lang.String uri)

  Return the handler for a given extension namespace.
  Parameters:
    `uri` - the URI of the extension namespace.

### evalXPathStr

    public XObject evalXPathStr(XPathSupport execContext,
                                java.lang.String str,
                                org.w3c.dom.Node context,
                                PrefixResolver nsNode)
                         throws org.xml.sax.SAXException

  Evaluate an xpath string and return the result.

### getNodeType

    public short getNodeType()

  Get the type of the node. We'll pretend we're a Document.
  Overrides:
    getNodeType in class UnImplNode

### getDoctype

    public org.w3c.dom.DocumentType getDoctype()

  Unimplemented.
  Specified by:
    getDoctype in interface org.w3c.dom.Document

### getImplementation

    public org.w3c.dom.DOMImplementation getImplementation()

  Unimplemented.
  Specified by:
    getImplementation in interface org.w3c.dom.Document

### getDocumentElement

    public org.w3c.dom.Element getDocumentElement()

  Unimplemented.
  Specified by:
    getDocumentElement in interface org.w3c.dom.Document

### createElement

    public org.w3c.dom.Element createElement(java.lang.String tagName)
                                      throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createElement in interface org.w3c.dom.Document

### createDocumentFragment

    public org.w3c.dom.DocumentFragment createDocumentFragment()

  Unimplemented.
  Specified by:
    createDocumentFragment in interface org.w3c.dom.Document

### createTextNode

    public org.w3c.dom.Text createTextNode(java.lang.String data)

  Unimplemented.
  Specified by:
    createTextNode in interface org.w3c.dom.Document

### createComment

    public org.w3c.dom.Comment createComment(java.lang.String data)

  Unimplemented.
  Specified by:
    createComment in interface org.w3c.dom.Document

### createCDATASection

    public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                                throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createCDATASection in interface org.w3c.dom.Document

### createProcessingInstruction

    public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                         java.lang.String data)
                                                                  throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createProcessingInstruction in interface org.w3c.dom.Document

### createAttribute

    public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                     throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createAttribute in interface org.w3c.dom.Document

### createEntityReference

    public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                      throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createEntityReference in interface org.w3c.dom.Document

### getElementsByTagName

    public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)

  Unimplemented.
  Specified by:
    getElementsByTagName in interface org.w3c.dom.Document
  Overrides:
    getElementsByTagName in class UnImplNode

### importNode

    public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
                                       boolean deep)
                                throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    importNode in interface org.w3c.dom.Document

### createElementNS

    public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                               java.lang.String qualifiedName)
                                        throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createElementNS in interface org.w3c.dom.Document

### createAttributeNS

    public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                              java.lang.String qualifiedName)
                                       throws org.w3c.dom.DOMException

  Unimplemented.
  Specified by:
    createAttributeNS in interface org.w3c.dom.Document

### getElementsByTagNameNS

    public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                       java.lang.String localName)

  Unimplemented.
  Specified by:
    getElementsByTagNameNS in interface org.w3c.dom.Document
  Overrides:
    getElementsByTagNameNS in class UnImplNode

### getElementById

    public org.w3c.dom.Element getElementById(java.lang.String elementId)

  Unimplemented.
  Specified by:
    getElementById in interface org.w3c.dom.Document

### setXPathFactory

    public void setXPathFactory(XPathFactory factory)

  Set the factory for making XPaths.

### getXPathFactory

    public XPathFactory getXPathFactory()

  Get the factory for making xpaths.

### setXPathProcessor

    public void setXPathProcessor(XPathProcessor processor)

  Set the XPath processor object.
  Parameters:
    `processor` - A XPathProcessor interface.

### getXPathProcessor

    public XPathProcessor getXPathProcessor()

  Get the XPath processor object.
  Returns:
    The XPathProcessor interface being used.

Copyright © 2000 Apache XML Project. All Rights Reserved.