## org.apache.xalan.xslt
Class StylesheetRoot

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

public class StylesheetRoot
extends Stylesheet
implements java.io.Serializable

Binary representation of a stylesheet -- use the `XSLTProcessor` ProcessStylesheet method to create a StylesheetRoot and improve performance for a stylesheet performing multiple transformations. Also required for XSLTProcessor to function as SAX DocumentHandler.

See Also:
  Serialized Form

Field Summary
`ElemTemplate` `m_defaultRootRule` **For advanced use only** The default template to use for the root if we don't find anything else.
`ElemTemplate` `m_defaultRule` **For advanced use only** The default template to use if we don't find anything else.
`ElemTemplate` `m_defaultTextRule` **For advanced use only** The default template to use for text nodes if we don't find anything else.
`boolean` `m_useXercesSerializers` If this is set to true, the Xerces serializers will be used, otherwise (false is the default) the Xalan serializers will be used.

Fields inherited from class org.apache.xalan.xslt.Stylesheet
`m_prefix_aliases, m_stylesheetParent, m_stylesheetRoot, STYLESHEET_EXT`

Constructor Summary
`StylesheetRoot(XSLTEngineImpl processor, java.lang.String baseIdentifier)` Uses an XSL stylesheet document.

Method Summary
`void` `addTraceListener(TraceListener tl)` Add a trace listener for the purposes of debugging and diagnosis.
`QName[]` `getCDataSectionElems()` Get list of qnames that specifies elements that should be formatted as CDATA.
`boolean` `getOmitOutputXMLDecl()` Get the XML Declaration that was specified in the stylesheet.
`java.lang.String` `getOutputDoctypePublic()` Get the doctype-public-id string that was specified in the stylesheet.
`java.lang.String` `getOutputDoctypeSystem()` Get the doctype-system-id string that was specified in the stylesheet.
`java.lang.String` `getOutputEncoding()` Get the encoding string that was specified in the stylesheet.
`org.apache.xml.serialize.OutputFormat` `getOutputFormat()` Get a new OutputFormat object according to the xsl:output attributes.
`boolean` `getOutputIndent()` Get the media-type string that was specified in the stylesheet.
`java.lang.String` `getOutputMediaType()` Get the media-type string that was specified in the stylesheet.
`java.lang.String` `getOutputMethod()` Return the output method that was specified in the stylesheet.
`boolean` `getOutputStandalone()` Get the standalone string that was specified in the stylesheet.
`java.lang.String` `getOutputVersion()` Get the version string that was specified in the stylesheet.
`org.xml.sax.DocumentHandler` `getSAXSerializer(java.io.OutputStream ostream)` Creates a compatible SAX serializer for the specified output stream and output format.
`boolean` `isOutputMethodSet()` Return the output method that was specified in the stylesheet.
`org.xml.sax.DocumentHandler` `makeSAXSerializer(java.io.OutputStream ostream, org.apache.xml.serialize.OutputFormat format)` Creates a compatible SAX serializer for the specified output stream and output format.
`org.xml.sax.DocumentHandler` `makeSAXSerializer(java.io.Writer writer, org.apache.xml.serialize.OutputFormat format)` Creates a compatible SAX serializer for the specified writer and output format.
`void` `process(XSLTInputSource xmlSource, XSLTResultTarget outputTarget)` Transform the XML source tree and place the output in the result tree target.
`void` `process(XSLTProcessor iprocessor, org.w3c.dom.Node sourceTree, XSLTResultTarget outputTarget)` Transform the XML source tree (a DOM Node) and place the output in the result tree target.
`void` `process(XSLTProcessor iprocessor, XSLTInputSource xmlSource, XSLTResultTarget outputTarget)` Transform the XML source tree and place the output in the result tree target.
`void` `removeTraceListener(TraceListener tl)` Remove a trace listener.
`void` `setOutputMethod(java.lang.String om)` Set the output method.

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

`addExtensionNamespace, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, evalXPathStr, findTemplate, getAttributeSets, getBaseIdentifier, getDecimalFormatDeclarations, getDecimalFormatElem, getDefaultSpace, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getExcludeResultPrefixes, getImplementation, getImports, getKeyDeclarations, getNamespaceForPrefix, getNamespaceForPrefix, getNeedToBuildKeysTable, getNodeSetByKey, getNodeType, getStylesheetParent, getStylesheetRoot, getTemplateList, getTopLevelVariables, getWhitespacePreservingElements, getWhitespaceStrippingElements, getXPathFactory, getXPathProcessor, importNode, lookForAlias, lookupExtensionNSHandler, setAttributeSets, setBaseIdentifier, setDecimalFormatDeclarations, setDefaultSpace, setExcludeResultPrefixes, setImports, setKeyDeclarations, setNeedToBuildKeysTable, setStylesheetParent, setStylesheetRoot, setTemplateList, setTopLevelVariables, setWhitespacePreservingElements, setWhitespaceStrippingElements, setXPathFactory, setXPathProcessor`

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_useXercesSerializers

    public boolean m_useXercesSerializers

  If this is set to true, the Xerces serializers will be used, otherwise (false is the default) the Xalan serializers will be used. This is meant as a stop-gap until the Xerces serializers come up to speed.

### m_defaultTextRule

    public ElemTemplate m_defaultTextRule

  **For advanced use only** The default template to use for text nodes if we don't find anything else. This is initialized in initDefaultRule().

### m_defaultRule

    public ElemTemplate m_defaultRule

  **For advanced use only** The default template to use if we don't find anything else. This is initialized in initDefaultRule().

### m_defaultRootRule

    public ElemTemplate m_defaultRootRule

  **For advanced use only** 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.

Constructor Detail

### StylesheetRoot

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

  Uses an XSL stylesheet document.
  Parameters:
    `processor` - The XSLTProcessor implementation.
    `baseIdentifier` - The file name or URL for the XSL stylesheet.
  Throws:
    XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

Method Detail

### addTraceListener

    public void addTraceListener(TraceListener tl)
                          throws java.util.TooManyListenersException

  Add a trace listener for the purposes of debugging and diagnosis.

### removeTraceListener

    public void removeTraceListener(TraceListener tl)

  Remove a trace listener.

### getOutputFormat

    public org.apache.xml.serialize.OutputFormat getOutputFormat()

  Get a new OutputFormat object according to the xsl:output attributes.

### process

    public void process(XSLTInputSource xmlSource,
                        XSLTResultTarget outputTarget)
                 throws org.xml.sax.SAXException,
                        java.net.MalformedURLException,
                        java.io.FileNotFoundException,
                        java.io.IOException

  Transform the XML source tree and place the output in the result tree target. This method uses a new XSLTProcessor instance to track the running state.
  Parameters:
    `xmlSource` - The XML input source tree.
    `outputTarget` - The output result tree.
  Throws:
    XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.
  See Also:
    `XSLTProcessor.process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)`

### process

    public void process(XSLTProcessor iprocessor,
                        XSLTInputSource xmlSource,
                        XSLTResultTarget outputTarget)
                 throws org.xml.sax.SAXException,
                        java.net.MalformedURLException,
                        java.io.FileNotFoundException,
                        java.io.IOException

  Transform the XML source tree and place the output in the result tree target. Use this version of the StylesheetRoot process() method if you have used an XSLTProcessor object to set a stylesheet parameter. That object is now the iprocessor parameter.
  Parameters:
    `iprocessor` - The XSLTProcessor that will track the running state.
    `xmlSource` - The XML input source tree.
    `outputTarget` - The output result tree.
  Throws:
    XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.
  See Also:
    `XSLTProcessor.process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)`

### process

    public void process(XSLTProcessor iprocessor,
                        org.w3c.dom.Node sourceTree,
                        XSLTResultTarget outputTarget)
                 throws org.xml.sax.SAXException,
                        java.net.MalformedURLException,
                        java.io.FileNotFoundException,
                        java.io.IOException

  Transform the XML source tree (a DOM Node) and place the output in the result tree target. This is a convenience method. You can also use a DOM Node to instantiate an XSLTInputSource object, and call `process(XSLTProcessor, XSLTInputSource, XSLTResultTarget)` or `XSLTProcessor.process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)`.
  Parameters:
    `iprocessor` - The processor that will track the running state.
    `sourceTree` - The input source tree in the form of a DOM Node.
    `outputTarget` - The output result tree.
  Throws:
    XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

### makeSAXSerializer

    public org.xml.sax.DocumentHandler makeSAXSerializer(java.io.Writer writer,
                                                         org.apache.xml.serialize.OutputFormat format)
                                                  throws java.io.IOException

  Creates a compatible SAX serializer for the specified writer and output format. If the output format is missing, the default is an XML format with UTF8 encoding.
  Parameters:
    `writer` - The writer
    `format` - The output format
  Returns:
    A compatible SAX serializer

### getSAXSerializer

    public org.xml.sax.DocumentHandler getSAXSerializer(java.io.OutputStream ostream)
                                                 throws java.io.UnsupportedEncodingException,
                                                        java.io.IOException

  Creates a compatible SAX serializer for the specified output stream and output format. If the output format is missing, the default is an XML format with UTF8 encoding.
  Parameters:
    `ostream` - The output stream.
  Returns:
    A compatible SAX serializer

### makeSAXSerializer

    public org.xml.sax.DocumentHandler makeSAXSerializer(java.io.OutputStream ostream,
                                                         org.apache.xml.serialize.OutputFormat format)
                                                  throws java.io.UnsupportedEncodingException,
                                                         java.io.IOException

  Creates a compatible SAX serializer for the specified output stream and output format. If the output format is missing, the default is an XML format with UTF8 encoding.
  Parameters:
    `ostream` - The output stream.
    `format` - The output format
  Returns:
    A compatible SAX serializer

### getOutputMethod

    public java.lang.String getOutputMethod()

  Return the output method that was specified in the stylesheet. The returned value is one of Formatter.OUTPUT_METH_XML, Formatter.OUTPUT_METH_HTML, or Formatter.OUTPUT_METH_TEXT.

### isOutputMethodSet

    public boolean isOutputMethodSet()

  Return the output method that was specified in the stylesheet. The returned value is one of Formatter.OUTPUT_METH_XML, Formatter.OUTPUT_METH_HTML, or Formatter.OUTPUT_METH_TEXT.

### setOutputMethod

    public void setOutputMethod(java.lang.String om)

  Set the output method.

### getOutputVersion

    public java.lang.String getOutputVersion()

  Get the version string that was specified in the stylesheet.

### getOutputIndent

    public boolean getOutputIndent()

  Get the media-type string that was specified in the stylesheet.

### getOutputEncoding

    public java.lang.String getOutputEncoding()

  Get the encoding string that was specified in the stylesheet.

### getOutputMediaType

    public java.lang.String getOutputMediaType()

  Get the media-type string that was specified in the stylesheet.

### getOutputDoctypeSystem

    public java.lang.String getOutputDoctypeSystem()

  Get the doctype-system-id string that was specified in the stylesheet.

### getOutputDoctypePublic

    public java.lang.String getOutputDoctypePublic()

  Get the doctype-public-id string that was specified in the stylesheet.

### getOmitOutputXMLDecl

    public boolean getOmitOutputXMLDecl()

  Get the XML Declaration that was specified in the stylesheet.

### getOutputStandalone

    public boolean getOutputStandalone()

  Get the standalone string that was specified in the stylesheet.

### getCDataSectionElems

    public QName[] getCDataSectionElems()

  Get list of qnames that specifies elements that should be formatted as CDATA.

Copyright © 2000 Apache XML Project. All Rights Reserved.