org.apache.xalan.xslt
Class XSLTEngineImpl

java.lang.Object
  |
  +--org.apache.xalan.xslt.XSLTEngineImpl

public class XSLTEngineImpl
extends java.lang.Object
implements XPathEnvSupport, XSLTProcessor

**For advanced use only** The Xalan workhorse -- Collaborates with the XML parser liaison, the DOM, and the XPath engine, to transform a source tree of nodes into a result tree according to instructions and templates specified by a stylesheet tree. We suggest you use one of the static XSLTProcessorFactory getProcessor() methods to instantiate the processor and return an interface that greatly simplifies the process of manipulating XSLTEngineImpl.

The methods process(...) are the primary public entry points. The best way to perform transformations is to use the XSLTProcessor.process(XSLTInputSource, XSLTInputSource, XSLTResultTarget) method, but you may use any of process methods defined in XSLTEngineImpl.

Please note that this class is not safe per instance over multiple threads. If you are in a multithreaded environment, you should keep a pool of these objects, or create a new one each time. In a multithreaded environment, the right way to do things is to create a StylesheetRoot via processStylesheet, and then reuse this object over multiple threads.

If you reuse the processor instance, you should call reset() between transformations.

See Also:
XSLTProcessorFactory, XSLTProcessor

Field Summary
static int m_recursionLimit
          **For advanced use only** Used for infinite loop check.
 
Constructor Summary
XSLTEngineImpl(java.lang.String parserLiaisonClassName)
          **For advanced use only** Construct an XSLT processor that uses the the given parser liaison.
XSLTEngineImpl(XMLParserLiaison parserLiason)
          **For advanced use only** Construct an XSL processor that uses the the given parser liaison.
 
Method Summary
 void addTraceListener(TraceListener tl)
          **For advanced use only** Add a trace listener for the purposes of debugging and diagnosis.
 void associateXLocatorToNode(org.w3c.dom.Node node, XLocator xlocator)
          **For advanced use only** Associate an XLocator provider to a node.
 void characters(char[] ch, int start, int length)
          **For advanced use only** Implement the characters event.
 void charactersRaw(char[] ch, int start, int length)
          **For advanced use only** Implement the characters event.
 void comment(char[] ch, int start, int length)
          **For advanced use only** Report an XML comment anywhere in the document.
 StylesheetRoot createStylesheetRoot(java.lang.String baseIdentifier)
          **For advanced use only** Bottleneck the creation of the stylesheet for derivation purposes.
 XBoolean createXBoolean(boolean b)
          **For advanced use only** Convenience function to create an XBoolean.
 XNodeSet createXNodeSet(org.w3c.dom.Node n)
          **For advanced use only** Convenience function to create an XNodeSet from a node.
 XNodeSet createXNodeSet(org.w3c.dom.NodeList nl)
          **For advanced use only** Convenience function to create an XNodeSet.
 XNull createXNull()
          **For advanced use only** Convenience function to create an XNull.
 XNumber createXNumber(double d)
          **For advanced use only** Convenience function to create an XNumber.
 XObject createXObject(java.lang.Object o)
          **For advanced use only** Convenience function to create an XObject.
 XString createXString(java.lang.String s)
          **For advanced use only** Convenience function to create an XString.
 boolean elementAvailable(java.lang.String namespace, java.lang.String extensionName)
          **For advanced use only** Execute the element-available() function.
 void endCDATA()
          **For advanced use only** Report the end of a CDATA section.
 void endDocument()
          **For advanced use only** Implement the endDocument event.
 void endDTD()
          **For advanced use only** Report the end of DTD declarations.
 void endElement(java.lang.String name)
          **For advanced use only** Implement the endElement event.
 void endEntity(java.lang.String name)
          **For advanced use only** Report the end of an entity.
 void error(int msg)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 void error(int msg, java.lang.Exception e)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 void error(int msg, java.lang.Object[] args)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 void error(int msg, java.lang.Object[] args, java.lang.Exception e)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 void error(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 void error(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 void error(java.lang.String msg)
          **For internal use only** Tell the user of an error, and probably throw an exception.
 java.lang.Object extFunction(java.lang.String namespace, java.lang.String extensionName, java.util.Vector argVec, java.lang.Object methodKey)
          **For advanced use only** Handle an extension function.
 java.lang.String findURIFromDoc(org.w3c.dom.Document doc)
          **For advanced use only** Given a DOM Document, tell what URI was used to parse it.
 boolean functionAvailable(java.lang.String namespace, java.lang.String extensionName)
          **For advanced use only** Execute the function-available() function.
 StylesheetSpec getAssociatedStylesheet(XSLTInputSource source, java.lang.String media, java.lang.String charset)
          **For advanced use only** Get the preferred InputSource specification that is associated with a given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria.
 java.util.Vector getAssociatedStylesheets(XSLTInputSource source, java.lang.String mediaRequest, java.lang.String charsetRequest)
          **For advanced use only** Get the InputSource specifications that are associated with a given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria.
 org.xml.sax.DocumentHandler getDocumentHandler()
          **For advanced use only** Get the current DocumentHandler.
 org.w3c.dom.Document getDOMFactory()
          **For advanced use only** Get a DOM document, primarily for creating result tree fragments.
 XPathSupport getExecContext()
          **For advanced use only** Get the execution context for XPath.
 org.xml.sax.DocumentHandler getFormatterListener()
          **For advanced use only** Get the current formatter listener.
 org.w3c.dom.NodeList getNodeSetByKey(org.w3c.dom.Node doc, java.lang.String name, java.lang.String ref, PrefixResolver nscontext)
          **For advanced use only** Given a valid element key, return the corresponding node list.
 java.lang.String getOutputFileName()
          **For internal use only** Get the filename of the output document, if it was set.
 ProblemListener getProblemListener()
          **For advanced use only** Get the problem listener property.
 java.util.Hashtable getSourceDocsTable()
          **For advanced use only** Get table of source tree documents.
 org.w3c.dom.Node getSourceNode()
          **For advanced use only** Returns the current input node that is being processed.
 org.w3c.dom.Node getSourceNode(java.lang.String selectPattern, PrefixResolver namespaceContext)
          **For advanced use only** Returns the current input node that is being processed.
 org.w3c.dom.Node getSourceTreeFromInput(XSLTInputSource inputSource)
          **For advanced use only** Given an input source, get the source tree.
 StylesheetRoot getStylesheet()
          **For advanced use only** Get the current stylesheet for this processor.
 java.lang.String getStyleSheetURIfromDoc(org.w3c.dom.Node sourceTree)
          Deprecated.  
 java.net.URL getURLFromString(java.lang.String urlString, java.lang.String base)
          **For advanced use only** Take a user string and try and parse XML, and also return the url.
 XObject getVariable(QName qname)
          **For advanced use only** Given a name, locate a variable in the current context, and return the Object.
 XLocator getXLocatorFromNode(org.w3c.dom.Node node)
          **For advanced use only** Get an XLocator provider keyed by node.
 XMLParserLiaison getXMLProcessorLiaison()
          **For advanced use only** Get the XML Parser Liaison that this processor uses.
 void ignorableWhitespace(char[] ch, int start, int length)
          **For advanced use only** Implement the ignorableWhitespace event.
 void message(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, java.lang.String msg)
          **For advanced use only** Warn the user of an problem.
 void message(java.lang.String msg)
          **For advanced use only** Warn the user of an problem.
 void outputResultTreeFragment(XObject obj, XPathSupport support)
          **For advanced use only** Given a result tree fragment, walk the tree and output it to the result stream.
 void outputToResultTree(Stylesheet stylesheetTree, java.lang.Object obj)
          **For advanced use only** Output an object to the result tree by doing the right conversions.
 org.w3c.dom.Document parseXML(java.net.URL url, org.xml.sax.DocumentHandler docHandler, org.w3c.dom.Document docToRegister)
          **For advanced use only** Read in the XML file, either producing a Document or calling SAX events, and register the document in a table.
 void process(XSLTInputSource inputSource, XSLTInputSource stylesheetSource, XSLTResultTarget outputTarget)
          **For advanced use only** Transform the source tree to the output in the given result tree target.
 void processingInstruction(java.lang.String target, java.lang.String data)
          **For advanced use only** Implement the processingInstruction event.
 StylesheetRoot processStylesheet(java.lang.String xsldocURLString)
          **For advanced use only** Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation.
 StylesheetRoot processStylesheet(XSLTInputSource stylesheetSource)
          **For advanced use only** Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation.
 void removeTraceListener(TraceListener tl)
          **For advanced use only** Remove a trace listener.
 void reset()
          **For advanced use only** Reset the state.
 void setDiagnosticsOutput(java.io.OutputStream out)
          **For advanced use only** If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
 void setDiagnosticsOutput(java.io.PrintWriter pw)
          **For advanced use only** If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
 void setDocumentHandler(org.xml.sax.DocumentHandler listener)
          **For advanced use only** Set the current DocumentHandler.
 void setDocumentLocator(org.xml.sax.Locator locator)
          **For advanced use only** Implement the setDocumentLocator event.
 void setDOMFactory(org.w3c.dom.Document doc)
          **For advanced use only** Set a DOM document factory, primarily for creating result tree fragments.
 void setExecContext(XMLParserLiaison liaison)
          **For advanced use only** Set the execution context for XPath.
 void setFormatterListener(org.xml.sax.DocumentHandler flistener)
          **For advanced use only** Set the current formatter listener.
 void setOutputFileName(java.lang.String filename)
          **For internal use only** Set the filename of the output document.
 void setOutputStream(java.io.OutputStream os)
          **For advanced use only** Set the output stream that will be used.
 void setProblemListener(ProblemListener l)
          **For advanced use only** Set the problem listener property.
 void setQuietConflictWarnings(boolean b)
          **For advanced use only** If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream.
 void setSourceDocument(java.lang.String uri, org.w3c.dom.Document doc)
          **For advanced use only** Set a source document.
 void setStylesheet(StylesheetRoot stylesheetRoot)
          **For advanced use only** Set the stylesheet for this processor.
 void setStylesheetParam(java.lang.String key, java.lang.String expression)
          **For advanced use only** Push a top-level stylesheet parameter.
 void setStylesheetParam(java.lang.String key, XObject value)
          **For advanced use only** Push a top-level stylesheet parameter.
 void setTraceSelect(boolean b)
          **For advanced use only** If this is set to true, simple traces of template calls are made.
 void setTraceTemplateChildren(boolean b)
          **For advanced use only** If this is set to true, debug diagnostics about template children as they are being constructed will be written to the m_diagnosticsPrintWriter stream.
 void setTraceTemplates(boolean b)
          **For advanced use only** If this is set to true, simple traces of template calls are made.
 boolean shouldStripSourceNode(org.w3c.dom.Node textNode)
          **For internal use only** Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node.
 void startCDATA()
          **For advanced use only** Report the start of a CDATA section.
 void startDocument()
          **For advanced use only** Implement the startDocument event.
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          **For advanced use only** Report the start of DTD declarations, if any.
 void startElement(java.lang.String name, org.xml.sax.AttributeList atts)
          **For advanced use only** Implement the startElement event.
 void startEntity(java.lang.String name)
          **For advanced use only** Report the beginning of an entity.
 void warn(int msg)
          **For internal use only** Warn the user of an problem.
 void warn(int msg, java.lang.Object[] args)
          **For internal use only** Warn the user of an problem.
 void warn(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg)
          **For internal use only** Warn the user of an problem.
 void warn(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args)
          **For internal use only** Warn the user of an problem.
 void writeChildren(org.xml.sax.DocumentHandler flistener, Stylesheet stylesheetTree, ElemTemplateElement templateParent, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNode, QName mode)
          **For internal use only** Write the children of a stylesheet element to the given listener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_recursionLimit

public static int m_recursionLimit
**For advanced use only** Used for infinite loop check. If the value is -1, do not check for infinite loops. Anyone who wants to enable that check should change the value of this variable to be the level of recursion that they want to check. Be careful setting this variable, if the number is too low, it may report an infinite loop situation, when there is none. Post version 1.0.0, we'll make this a runtime feature.
Constructor Detail

XSLTEngineImpl

public XSLTEngineImpl(java.lang.String parserLiaisonClassName)
               throws org.xml.sax.SAXException
**For advanced use only** Construct an XSLT processor that uses the the given parser liaison. As a general rule, you should use XSLTProcessorFactory to create an instance of this class and provide access to the instance via the XSLTProcessor interface.
See Also:
XSLTProcessorFactory, XSLTProcessor

XSLTEngineImpl

public XSLTEngineImpl(XMLParserLiaison parserLiason)
**For advanced use only** Construct an XSL processor that uses the the given parser liaison. As a general rule, you should use XSLTProcessorFactory to create an instance of this class and provide access to the instance via the XSLTProcessor interface.
Parameters:
XMLParserLiaison - A liaison to an XML parser.
See Also:
XMLParserLiaison, XSLTProcessorFactory, XSLTProcessor
Method Detail

reset

public void reset()
**For advanced use only** Reset the state. This needs to be called after a process() call is invoked, if the processor is to be used again.
Specified by:
reset in interface XSLTProcessor

process

public void process(XSLTInputSource inputSource,
                    XSLTInputSource stylesheetSource,
                    XSLTResultTarget outputTarget)
             throws org.xml.sax.SAXException
**For advanced use only** Transform the source tree to the output in the given result tree target. As a general rule, we recommend you use the XSLTProcessor#Process(XSLTInputSource, XSLTInputSource, XSLTResultTarget) method.
Specified by:
process in interface XSLTProcessor
Parameters:
inputSource - The input source.
stylesheetSource - The stylesheet source. May be null if source has a xml-stylesheet PI.
outputTarget - The output source tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

createStylesheetRoot

public StylesheetRoot createStylesheetRoot(java.lang.String baseIdentifier)
                                    throws java.net.MalformedURLException,
                                           java.io.FileNotFoundException,
                                           java.io.IOException,
                                           org.xml.sax.SAXException
**For advanced use only** Bottleneck the creation of the stylesheet for derivation purposes.

processStylesheet

public StylesheetRoot processStylesheet(XSLTInputSource stylesheetSource)
                                 throws org.xml.sax.SAXException
**For advanced use only** Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation. This calls reset() before processing if the stylesheet root has been set to non-null.
Specified by:
processStylesheet in interface XSLTProcessor
Parameters:
xmldocURLString - The URL to the input XML document.
Returns:
The compiled stylesheet object.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

processStylesheet

public StylesheetRoot processStylesheet(java.lang.String xsldocURLString)
                                 throws org.xml.sax.SAXException
**For advanced use only** Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation. This calls reset() before processing if the stylesheet root has been set to non-null.
Specified by:
processStylesheet in interface XSLTProcessor
Parameters:
xmldocURLString - The URL to the input XML document.
Returns:
The compiled stylesheet object.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

setStylesheet

public void setStylesheet(StylesheetRoot stylesheetRoot)
**For advanced use only** Set the stylesheet for this processor. If this is set, then the process calls that take only the input .xml will use this instead of looking for a stylesheet PI. Also, setting the stylesheet is needed if you are going to use the processor as a SAX DocumentHandler.
Specified by:
setStylesheet in interface XSLTProcessor

getStylesheet

public StylesheetRoot getStylesheet()
**For advanced use only** Get the current stylesheet for this processor.
Specified by:
getStylesheet in interface XSLTProcessor

getOutputFileName

public java.lang.String getOutputFileName()
**For internal use only** Get the filename of the output document, if it was set. This is for use by multiple output documents, to determine the base directory for the output document. It needs to be set by the caller.

setOutputFileName

public void setOutputFileName(java.lang.String filename)
**For internal use only** Set the filename of the output document. This is for use by multiple output documents, to determine the base directory for the output document. It needs to be set by the caller.

getURLFromString

public java.net.URL getURLFromString(java.lang.String urlString,
                                     java.lang.String base)
                              throws org.xml.sax.SAXException
**For advanced use only** Take a user string and try and parse XML, and also return the url.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getSourceTreeFromInput

public org.w3c.dom.Node getSourceTreeFromInput(XSLTInputSource inputSource)
                                        throws org.xml.sax.SAXException
**For advanced use only** Given an input source, get the source tree.
Specified by:
getSourceTreeFromInput in interface XSLTProcessor

parseXML

public org.w3c.dom.Document parseXML(java.net.URL url,
                                     org.xml.sax.DocumentHandler docHandler,
                                     org.w3c.dom.Document docToRegister)
                              throws org.xml.sax.SAXException,
                                     java.io.IOException
**For advanced use only** Read in the XML file, either producing a Document or calling SAX events, and register the document in a table. If the document has already been read in, it will not be reparsed.
Parameters:
url - The location of the XML.
docHandler - The SAX event handler.
docToRegister - If using a SAX event handler, the object to register in the source docs table.
Returns:
lcom.ms.xml.om.Document object, which represents the parsed XML.
Throws:
org.xml.sax.SAXException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getAssociatedStylesheet

public StylesheetSpec getAssociatedStylesheet(XSLTInputSource source,
                                              java.lang.String media,
                                              java.lang.String charset)
                                       throws org.xml.sax.SAXException
**For advanced use only** Get the preferred InputSource specification that is associated with a given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria. Does not yet handle the LINK REL="stylesheet" syntax.
Specified by:
getAssociatedStylesheet in interface XSLTProcessor
Parameters:
media - The media attribute to be matched. May be null, in which case the prefered stylesheet will be used (i.e. alternate = no).
title - The value of the title attribute to match. May be null.
charset - The value of the charset attribute to match. May be null.

getAssociatedStylesheets

public java.util.Vector getAssociatedStylesheets(XSLTInputSource source,
                                                 java.lang.String mediaRequest,
                                                 java.lang.String charsetRequest)
                                          throws org.xml.sax.SAXException
**For advanced use only** Get the InputSource specifications that are associated with a given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria. Does not yet handle the LINK REL="stylesheet" syntax.
Specified by:
getAssociatedStylesheets in interface XSLTProcessor
Parameters:
media - The media attribute to be matched. May be null, in which case the prefered stylesheet will be used (i.e. alternate = no).
title - The value of the title attribute to match. May be null.
charset - The value of the charset attribute to match. May be null.

findURIFromDoc

public java.lang.String findURIFromDoc(org.w3c.dom.Document doc)
**For advanced use only** Given a DOM Document, tell what URI was used to parse it.
Specified by:
findURIFromDoc in interface XPathEnvSupport

getSourceDocsTable

public java.util.Hashtable getSourceDocsTable()
**For advanced use only** Get table of source tree documents. Document objects are keyed by URL string.
Specified by:
getSourceDocsTable in interface XPathEnvSupport

setSourceDocument

public void setSourceDocument(java.lang.String uri,
                              org.w3c.dom.Document doc)
**For advanced use only** Set a source document. Every time a source document is requested through either xsl:uri or in a process call, the processor will first consult table of supplied documents before trying to load and parse the corresponding document from the Net.

outputToResultTree

public void outputToResultTree(Stylesheet stylesheetTree,
                               java.lang.Object obj)
                        throws org.xml.sax.SAXException,
                               java.net.MalformedURLException,
                               java.io.FileNotFoundException,
                               java.io.IOException
**For advanced use only** Output an object to the result tree by doing the right conversions. This is public for access by extensions.
Parameters:
obj - the Java object to output. If its of an X type then that conversion is done first and then sent out.

functionAvailable

public boolean functionAvailable(java.lang.String namespace,
                                 java.lang.String extensionName)
**For advanced use only** Execute the function-available() function.
Specified by:
functionAvailable in interface XPathEnvSupport

elementAvailable

public boolean elementAvailable(java.lang.String namespace,
                                java.lang.String extensionName)
**For advanced use only** Execute the element-available() function.
Specified by:
elementAvailable in interface XPathEnvSupport

extFunction

public java.lang.Object extFunction(java.lang.String namespace,
                                    java.lang.String extensionName,
                                    java.util.Vector argVec,
                                    java.lang.Object methodKey)
                             throws org.xml.sax.SAXException
**For advanced use only** Handle an extension function.
Specified by:
extFunction in interface XPathEnvSupport

addTraceListener

public void addTraceListener(TraceListener tl)
                      throws java.util.TooManyListenersException
**For advanced use only** Add a trace listener for the purposes of debugging and diagnosis.
Specified by:
addTraceListener in interface XSLTProcessor
Parameters:
tl - Trace listener to be added.

removeTraceListener

public void removeTraceListener(TraceListener tl)
**For advanced use only** Remove a trace listener.
Specified by:
removeTraceListener in interface XSLTProcessor
Parameters:
tl - Trace listener to be removed.

message

public void message(java.lang.String msg)
             throws org.xml.sax.SAXException
**For advanced use only** Warn the user of an problem. This is public for access by extensions.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

message

public void message(org.w3c.dom.Node styleNode,
                    org.w3c.dom.Node sourceNode,
                    java.lang.String msg)
             throws org.xml.sax.SAXException
**For advanced use only** Warn the user of an problem. This is public for access by extensions.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

warn

public void warn(int msg)
          throws org.xml.sax.SAXException
**For internal use only** Warn the user of an problem.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

warn

public void warn(int msg,
                 java.lang.Object[] args)
          throws org.xml.sax.SAXException
**For internal use only** Warn the user of an problem.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

warn

public void warn(org.w3c.dom.Node styleNode,
                 org.w3c.dom.Node sourceNode,
                 int msg)
          throws org.xml.sax.SAXException
**For internal use only** Warn the user of an problem.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

warn

public void warn(org.w3c.dom.Node styleNode,
                 org.w3c.dom.Node sourceNode,
                 int msg,
                 java.lang.Object[] args)
          throws org.xml.sax.SAXException
**For internal use only** Warn the user of an problem.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(java.lang.String msg)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(int msg)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(int msg,
                  java.lang.Object[] args)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(int msg,
                  java.lang.Exception e)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(int msg,
                  java.lang.Object[] args,
                  java.lang.Exception e)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(org.w3c.dom.Node styleNode,
                  org.w3c.dom.Node sourceNode,
                  int msg)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(org.w3c.dom.Node styleNode,
                  org.w3c.dom.Node sourceNode,
                  int msg,
                  java.lang.Object[] args)
           throws org.xml.sax.SAXException
**For internal use only** Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

setDiagnosticsOutput

public void setDiagnosticsOutput(java.io.OutputStream out)
**For advanced use only** If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. If the value is null, then diagnostics will be turned off.
Specified by:
setDiagnosticsOutput in interface XSLTProcessor

setDiagnosticsOutput

public void setDiagnosticsOutput(java.io.PrintWriter pw)
**For advanced use only** If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. If the value is null, then diagnostics will be turned off.
Specified by:
setDiagnosticsOutput in interface XSLTProcessor

setTraceTemplates

public void setTraceTemplates(boolean b)
**For advanced use only** If this is set to true, simple traces of template calls are made.
Specified by:
setTraceTemplates in interface XSLTProcessor

setTraceSelect

public void setTraceSelect(boolean b)
**For advanced use only** If this is set to true, simple traces of template calls are made.
Specified by:
setTraceSelect in interface XSLTProcessor

setTraceTemplateChildren

public void setTraceTemplateChildren(boolean b)
**For advanced use only** If this is set to true, debug diagnostics about template children as they are being constructed will be written to the m_diagnosticsPrintWriter stream. diagnoseTemplateChildren is false by default.
Specified by:
setTraceTemplateChildren in interface XSLTProcessor

setQuietConflictWarnings

public void setQuietConflictWarnings(boolean b)
**For advanced use only** If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream. True by default.
Specified by:
setQuietConflictWarnings in interface XSLTProcessor
Parameters:
b - true if conflict warnings should be suppressed.

writeChildren

public void writeChildren(org.xml.sax.DocumentHandler flistener,
                          Stylesheet stylesheetTree,
                          ElemTemplateElement templateParent,
                          org.w3c.dom.Node sourceTree,
                          org.w3c.dom.Node sourceNode,
                          QName mode)
                   throws org.xml.sax.SAXException,
                          java.net.MalformedURLException,
                          java.io.FileNotFoundException,
                          java.io.IOException
**For internal use only** Write the children of a stylesheet element to the given listener.
Parameters:
stylesheetTree - The stylesheet object that holds the fragment.
templateParent - The template element that holds the fragment.
sourceTree - The source tree document context.
sourceNode - The current source context node.
mode - The mode under which the template is operating.
Returns:
An object that represents the result tree fragment.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

outputResultTreeFragment

public void outputResultTreeFragment(XObject obj,
                                     XPathSupport support)
                              throws org.xml.sax.SAXException,
                                     java.net.MalformedURLException,
                                     java.io.FileNotFoundException,
                                     java.io.IOException
**For advanced use only** Given a result tree fragment, walk the tree and output it to the result stream.

shouldStripSourceNode

public boolean shouldStripSourceNode(org.w3c.dom.Node textNode)
                              throws org.xml.sax.SAXException
**For internal use only** Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node. Literal elements from template elements should not be tested with this function.
Specified by:
shouldStripSourceNode in interface XPathEnvSupport
Parameters:
textNode - A text node from the source tree.
Returns:
true if the text node should be stripped of extra whitespace.

getExecContext

public XPathSupport getExecContext()
**For advanced use only** Get the execution context for XPath.

setExecContext

public void setExecContext(XMLParserLiaison liaison)
**For advanced use only** Set the execution context for XPath.

getXMLProcessorLiaison

public XMLParserLiaison getXMLProcessorLiaison()
**For advanced use only** Get the XML Parser Liaison that this processor uses.
Specified by:
getXMLProcessorLiaison in interface XSLTProcessor

createXString

public XString createXString(java.lang.String s)
**For advanced use only** Convenience function to create an XString.
Specified by:
createXString in interface XSLTProcessor
Parameters:
s - A valid string.
Returns:
An XString object.

createXObject

public XObject createXObject(java.lang.Object o)
**For advanced use only** Convenience function to create an XObject.
Specified by:
createXObject in interface XSLTProcessor
Parameters:
o - Any java object.
Returns:
An XObject object.

createXNumber

public XNumber createXNumber(double d)
**For advanced use only** Convenience function to create an XNumber.
Specified by:
createXNumber in interface XSLTProcessor
Parameters:
d - Any double number.
Returns:
An XNumber object.

createXBoolean

public XBoolean createXBoolean(boolean b)
**For advanced use only** Convenience function to create an XBoolean.
Specified by:
createXBoolean in interface XSLTProcessor
Parameters:
b - boolean value.
Returns:
An XBoolean object.

createXNodeSet

public XNodeSet createXNodeSet(org.w3c.dom.NodeList nl)
**For advanced use only** Convenience function to create an XNodeSet.
Specified by:
createXNodeSet in interface XSLTProcessor
Parameters:
nl - A NodeList object.
Returns:
An XNodeSet object.

createXNodeSet

public XNodeSet createXNodeSet(org.w3c.dom.Node n)
**For advanced use only** Convenience function to create an XNodeSet from a node.
Specified by:
createXNodeSet in interface XSLTProcessor
Parameters:
n - A DOM node.
Returns:
An XNodeSet object.

createXNull

public XNull createXNull()
**For advanced use only** Convenience function to create an XNull.
Specified by:
createXNull in interface XSLTProcessor
Returns:
An XNull object.

getNodeSetByKey

public org.w3c.dom.NodeList getNodeSetByKey(org.w3c.dom.Node doc,
                                            java.lang.String name,
                                            java.lang.String ref,
                                            PrefixResolver nscontext)
                                     throws org.xml.sax.SAXException
**For advanced use only** Given a valid element key, return the corresponding node list.
Specified by:
getNodeSetByKey in interface XPathEnvSupport

getVariable

public XObject getVariable(QName qname)
                    throws org.xml.sax.SAXException
**For advanced use only** Given a name, locate a variable in the current context, and return the Object.
Specified by:
getVariable in interface XPathEnvSupport

getXLocatorFromNode

public XLocator getXLocatorFromNode(org.w3c.dom.Node node)
**For advanced use only** Get an XLocator provider keyed by node. This get's the association based on the root of the tree that the node is parented by.
Specified by:
getXLocatorFromNode in interface XPathEnvSupport

associateXLocatorToNode

public void associateXLocatorToNode(org.w3c.dom.Node node,
                                    XLocator xlocator)
**For advanced use only** Associate an XLocator provider to a node. This makes the association based on the root of the tree that the node is parented by.
Specified by:
associateXLocatorToNode in interface XPathEnvSupport

getStyleSheetURIfromDoc

public java.lang.String getStyleSheetURIfromDoc(org.w3c.dom.Node sourceTree)
Deprecated.  
**For advanced use only** Given a document, get the default stylesheet URI from the xsl:stylesheet PI. However, this will only get you the first URL, and there may be many.

setStylesheetParam

public void setStylesheetParam(java.lang.String key,
                               java.lang.String expression)
**For advanced use only** Push a top-level stylesheet parameter. This value can be evaluated via xsl:param-variable.
Specified by:
setStylesheetParam in interface XSLTProcessor
Parameters:
key - The name of the param.
expression - An expression that will be evaluated.

setStylesheetParam

public void setStylesheetParam(java.lang.String key,
                               XObject value)
**For advanced use only** Push a top-level stylesheet parameter. This value can be evaluated via xsl:param-variable.
Specified by:
setStylesheetParam in interface XSLTProcessor
Parameters:
key - The name of the param.
value - An XObject that will be used.

getSourceNode

public org.w3c.dom.Node getSourceNode()
**For advanced use only** Returns the current input node that is being processed.

getSourceNode

public org.w3c.dom.Node getSourceNode(java.lang.String selectPattern,
                                      PrefixResolver namespaceContext)
                               throws org.xml.sax.SAXException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException
**For advanced use only** Returns the current input node that is being processed.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getDocumentHandler

public org.xml.sax.DocumentHandler getDocumentHandler()
**For advanced use only** Get the current DocumentHandler. This is the same object as the FormatterListener.
Specified by:
getDocumentHandler in interface XSLTProcessor

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler listener)
**For advanced use only** Set the current DocumentHandler. The object set is the same object as the FormatterListener.
Specified by:
setDocumentHandler in interface XSLTProcessor

getFormatterListener

public org.xml.sax.DocumentHandler getFormatterListener()
**For advanced use only** Get the current formatter listener.
Specified by:
getFormatterListener in interface XSLTProcessor

setFormatterListener

public void setFormatterListener(org.xml.sax.DocumentHandler flistener)
**For advanced use only** Set the current formatter listener.
Specified by:
setFormatterListener in interface XSLTProcessor

setDOMFactory

public void setDOMFactory(org.w3c.dom.Document doc)
**For advanced use only** Set a DOM document factory, primarily for creating result tree fragments.
Specified by:
setDOMFactory in interface XPathEnvSupport

getDOMFactory

public org.w3c.dom.Document getDOMFactory()
**For advanced use only** Get a DOM document, primarily for creating result tree fragments.
Specified by:
getDOMFactory in interface XPathEnvSupport

setProblemListener

public void setProblemListener(ProblemListener l)
**For advanced use only** Set the problem listener property. The XSL class can have a single listener that can be informed of errors and warnings, and can normally control if an exception is thrown or not (or the problem listeners can throw their own RuntimeExceptions).
Specified by:
setProblemListener in interface XSLTProcessor
Parameters:
l - A ProblemListener interface.

getProblemListener

public ProblemListener getProblemListener()
**For advanced use only** Get the problem listener property. The XSL class can have a single listener that can be informed of errors and warnings, and can normally control if an exception is thrown or not (or the problem listeners can throw their own RuntimeExceptions).
Specified by:
getProblemListener in interface XSLTProcessor
Returns:
A ProblemListener interface.

setOutputStream

public void setOutputStream(java.io.OutputStream os)
**For advanced use only** Set the output stream that will be used. (This is only used, for the time being, when the processor is being used as a SAX Document handler!)
Specified by:
setOutputStream in interface XSLTProcessor

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
**For advanced use only** Implement the setDocumentLocator event.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
**For advanced use only** Implement the startDocument event.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
**For advanced use only** Implement the endDocument event.

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList atts)
                  throws org.xml.sax.SAXException
**For advanced use only** Implement the startElement event.

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
**For advanced use only** Implement the endElement event.

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
**For advanced use only** Report the start of a CDATA section.

The contents of the CDATA section will be reported through the regular characters event.

Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
endCDATA()

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
**For advanced use only** Report the end of a CDATA section.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
startCDATA()

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
**For advanced use only** Implement the characters event.

charactersRaw

public void charactersRaw(char[] ch,
                          int start,
                          int length)
                   throws org.xml.sax.SAXException
**For advanced use only** Implement the characters event.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
**For advanced use only** Implement the ignorableWhitespace event.

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
**For advanced use only** Implement the processingInstruction event.

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
**For advanced use only** Report an XML comment anywhere in the document.

This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).

Parameters:
ch - An array holding the characters in the comment.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
org.xml.sax.SAXException - The application may raise an exception.

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
**For advanced use only** Report the beginning of an entity.

The start and end of the document entity are not reported. The start and end of the external DTD subset are reported using the pseudo-name "[dtd]". All other events must be properly nested within start/end entity events.

Note that skipped entities will be reported through the skippedEntity event, which is part of the ContentHandler interface.

Parameters:
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
endEntity(java.lang.String), DeclHandler.internalEntityDecl(java.lang.String, java.lang.String), DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
**For advanced use only** Report the end of an entity.
Parameters:
name - The name of the entity that is ending.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
startEntity(java.lang.String)

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
              throws org.xml.sax.SAXException
**For advanced use only** Report the start of DTD declarations, if any.

Any declarations are assumed to be in the internal subset unless otherwise indicated by a startEntity event.

Parameters:
name - The document type name.
publicId - The declared public identifier for the external DTD subset, or null if none was declared.
systemId - The declared system identifier for the external DTD subset, or null if none was declared.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
endDTD(), startEntity(java.lang.String)

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
**For advanced use only** Report the end of DTD declarations.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
startDTD(java.lang.String, java.lang.String, java.lang.String)