BEA Systems, Inc.

WebLogic Server 6.0sp2 API Reference

weblogic.apache.xalan.xslt
Class XSLTEngineImpl

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

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

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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Author:
Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
XSLTProcessorFactory, XSLTProcessor

Field Summary
protected  org.w3c.dom.Node m_currentNode
          The current input element that is being processed.
protected  java.lang.String m_pendingElementName
          The pending element.
protected  boolean m_pendingStartDoc
          Flag to tell if a StartDocument event is pending.
static int m_recursionLimit
          Used for infinite loop check.
protected  java.util.Stack m_resultNameSpaces
          A stack to keep track of the result tree namespaces.
 
Constructor Summary
protected XSLTEngineImpl()
          Construct an XSLT processor that uses the default DTM (Document Table Model) liaison and XML parser.
  XSLTEngineImpl(java.lang.String parserLiaisonClassName)
          Construct an XSLT processor that uses the the given parser liaison.
  XSLTEngineImpl(XMLParserLiaison parserLiason)
          Construct an XSL processor that uses the the given parser liaison.
 
Method Summary
 void addTraceListener(TraceListener tl)
          Add a trace listener for the purposes of debugging and diagnosis.
 void associateXLocatorToNode(org.w3c.dom.Node node, XLocator xlocator)
          Associate an XLocator provider to a node.
 void characters(char[] ch, int start, int length)
          Implement the characters event.
 void charactersRaw(char[] ch, int start, int length)
          Implement the characters event.
protected  void cloneToResultTree(Stylesheet stylesheetTree, org.w3c.dom.Node node, boolean shouldCloneWithChildren, boolean overrideStrip, boolean shouldCloneAttributes)
          Clone an element with or without children.
 void comment(char[] ch, int start, int length)
          Report an XML comment anywhere in the document.
protected  void copyAttributesToAttList(org.w3c.dom.Element contextNode, Stylesheet stylesheetTree, MutableAttrListImpl attList)
          Copy the attributes from the XSL element to the created output element, executing attribute templates and processing the xsl:use attribute as need be.
protected  void copyAttributeToTarget(org.w3c.dom.Attr attr, org.w3c.dom.Node contextNode, Stylesheet stylesheetTree, MutableAttrListImpl attrList, org.w3c.dom.Element namespaceContext)
          Copy an attribute to the created output element, executing attribute templates as need be, and processing the xsl:use attribute.
 XMLParserLiaison createLiaison()
          Get a Liaison class, as specified by parserLiaisonClassName property Patch from Costin Manolache
 StylesheetRoot createStylesheetRoot(java.lang.String baseIdentifier)
          Bottleneck the creation of the stylesheet for derivation purposes.
 XBoolean createXBoolean(boolean b)
          Convenience function to create an XBoolean.
 XMLParserLiaison createXercesLiaison()
          Create a Xerces Liaison - used for special handling of DTM Patch from Costin Manolache
 XNodeSet createXNodeSet(org.w3c.dom.Node n)
          Convenience function to create an XNodeSet from a node.
 XNodeSet createXNodeSet(org.w3c.dom.NodeList nl)
          Convenience function to create an XNodeSet.
 XNull createXNull()
          Convenience function to create an XNull.
 XNumber createXNumber(double d)
          Convenience function to create an XNumber.
 XObject createXObject(java.lang.Object o)
          Convenience function to create an XObject.
 XString createXString(java.lang.String s)
          Convenience function to create an XString.
 void deassociateXLocatorToNode(org.w3c.dom.Node node)
          Deassociate an XLocator provider to a node.
protected  void diag(java.lang.String s)
          Bottleneck output of diagnostics.
protected  void diagnoseTemplateChildren(org.w3c.dom.Node templateChild, org.w3c.dom.Node sourceNode)
          Print some diagnostics about the current template child.
protected  void displayDuration(java.lang.String info, java.lang.Object key)
          Display the duration since pushTime was called.
 boolean elementAvailable(java.lang.String namespace, java.lang.String extensionName)
          Execute the element-available() function.
 void endCDATA()
          Report the end of a CDATA section.
 void endDocument()
          Implement the endDocument event.
 void endDTD()
          Report the end of DTD declarations.
 void endElement(java.lang.String name)
          Implement the endElement event.
 void endEntity(java.lang.String name)
          Report the end of an entity.
 void error(int msg)
           Tell the user of an error, and probably throw an exception.
 void error(int msg, java.lang.Exception e)
           Tell the user of an error, and probably throw an exception.
 void error(int msg, java.lang.Object[] args)
           Tell the user of an error, and probably throw an exception.
 void error(int msg, java.lang.Object[] args, java.lang.Exception e)
           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)
           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)
           Tell the user of an error, and probably throw an exception.
 void error(java.lang.String msg)
           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)
          Handle an extension function.
protected  org.w3c.dom.Element findElementByAttribute(org.w3c.dom.Node elem, java.lang.String targetElementName, java.lang.String targetAttributeName, java.lang.String targetAttributeValue)
          Given a tag name, an attribute name, and an attribute value, do a very crude recursive search and locate the first match.
 java.lang.String findURIFromDoc(org.w3c.dom.Document doc)
          Given a DOM Document, tell what URI was used to parse it.
protected  void flushPending()
          Flush the pending element.
 boolean functionAvailable(java.lang.String namespace, java.lang.String extensionName)
          Execute the function-available() function.
 StylesheetSpec getAssociatedStylesheet(XSLTInputSource source, java.lang.String media, java.lang.String charset)
          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)
          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()
          Get the current DocumentHandler.
 org.w3c.dom.Document getDOMFactory()
          Get a DOM document, primarily for creating result tree fragments.
 XPathSupport getExecContext()
          Get the execution context for XPath.
 org.xml.sax.DocumentHandler getFormatterListener()
          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)
          Given a valid element key, return the corresponding node list.
 java.lang.String getOutputFileName()
           Get the filename of the output document, if it was set.
 ProblemListener getProblemListener()
          Get the problem listener property.
 java.util.Hashtable getSourceDocsTable()
          Get table of source tree documents.
 org.w3c.dom.Node getSourceNode()
          Returns the current input node that is being processed.
 org.w3c.dom.Node getSourceNode(java.lang.String selectPattern, PrefixResolver namespaceContext)
          Returns the current input node that is being processed.
 org.w3c.dom.Node getSourceTreeFromInput(XSLTInputSource inputSource)
          Given an input source, get the source tree.
 StylesheetRoot getStylesheet()
          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)
          Take a user string and try and parse XML, and also return the url.
 XObject getVariable(QName qname)
          Given a name, locate a variable in the current context, and return the Object.
 XLocator getXLocatorFromNode(org.w3c.dom.Node node)
          Get an XLocator provider keyed by node.
 XMLParserLiaison getXMLProcessorLiaison()
          Get the XML Parser Liaison that this processor uses.
 void ignorableWhitespace(char[] ch, int start, int length)
          Implement the ignorableWhitespace event.
 void message(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, java.lang.String msg)
          Warn the user of an problem.
 void message(java.lang.String msg)
          Warn the user of an problem.
 void outputResultTreeFragment(XObject obj, XPathSupport support)
          Given a result tree fragment, walk the tree and output it to the result stream.
 void outputToResultTree(Stylesheet stylesheetTree, java.lang.Object obj)
          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)
          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)
          Transform the source tree to the output in the given result tree target.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Implement the processingInstruction event.
 StylesheetRoot processStylesheet(java.lang.String xsldocURLString)
          Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation.
 StylesheetRoot processStylesheet(XSLTInputSource stylesheetSource)
          Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation.
 void removeTraceListener(TraceListener tl)
          Remove a trace listener.
 void reset()
          Reset the state.
protected  void resetCurrentState(org.w3c.dom.Node xmlNode)
          Reset the current element state
 void setDiagnosticsOutput(java.io.OutputStream out)
          If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
 void setDiagnosticsOutput(java.io.PrintWriter pw)
          If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
 void setDocumentHandler(org.xml.sax.DocumentHandler listener)
          Set the current DocumentHandler.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Implement the setDocumentLocator event.
 void setDOMFactory(org.w3c.dom.Document doc)
          Set a DOM document factory, primarily for creating result tree fragments.
 void setExecContext(XMLParserLiaison liaison)
          Set the execution context for XPath.
 void setFormatterListener(org.xml.sax.DocumentHandler flistener)
          Set the current formatter listener.
 void setOutputFileName(java.lang.String filename)
           Set the filename of the output document.
 void setOutputStream(java.io.OutputStream os)
          Set the output stream that will be used.
 void setProblemListener(ProblemListener l)
          Set the problem listener property.
 void setQuietConflictWarnings(boolean b)
          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)
          Set a source document.
 void setStylesheet(StylesheetRoot stylesheetRoot)
          Set the stylesheet for this processor.
 void setStylesheetParam(java.lang.String key, java.lang.String expression)
          Push a top-level stylesheet parameter.
 void setStylesheetParam(java.lang.String key, XObject value)
          Push a top-level stylesheet parameter.
 void setTraceSelect(boolean b)
          If this is set to true, simple traces of template calls are made.
 void setTraceTemplateChildren(boolean b)
          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)
          If this is set to true, simple traces of template calls are made.
 boolean shouldStripSourceNode(org.w3c.dom.Node textNode)
           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()
          Report the start of a CDATA section.
 void startDocument()
          Implement the startDocument event.
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Report the start of DTD declarations, if any.
 void startElement(java.lang.String name, org.xml.sax.AttributeList atts)
          Implement the startElement event.
 void startEntity(java.lang.String name)
          Report the beginning of an entity.
protected  void traceSelect(org.w3c.dom.Element template, org.w3c.dom.NodeList nl)
          Print a trace of a selection being made.
protected  void traceTemplate(org.w3c.dom.Node templateNode)
          Print a trace of a template that is being called, either by a match, name, or as part of for-each.
 void warn(int msg)
           Warn the user of an problem.
 void warn(int msg, java.lang.Object[] args)
           Warn the user of an problem.
 void warn(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg)
           Warn the user of an problem.
 void warn(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args)
           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)
           Write the children of a stylesheet element to the given listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_pendingElementName

protected java.lang.String m_pendingElementName
The pending element. We have to delay the call to m_flistener.startElement(name, atts) because of the xsl:attribute and xsl:copy calls. In other words, the attributes have to be fully collected before you can call startElement.

m_pendingStartDoc

protected boolean m_pendingStartDoc
Flag to tell if a StartDocument event is pending.

m_resultNameSpaces

protected java.util.Stack m_resultNameSpaces
A stack to keep track of the result tree namespaces.

m_currentNode

protected org.w3c.dom.Node m_currentNode
The current input element that is being processed.

m_recursionLimit

public static int m_recursionLimit
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

protected XSLTEngineImpl()
                  throws org.xml.sax.SAXException
Construct an XSLT processor that uses the default DTM (Document Table Model) liaison and XML parser. 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(java.lang.String parserLiaisonClassName)
               throws org.xml.sax.SAXException
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)
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()
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


createLiaison

public XMLParserLiaison createLiaison()
                               throws org.xml.sax.SAXException
Get a Liaison class, as specified by parserLiaisonClassName property Patch from Costin Manolache


createXercesLiaison

public XMLParserLiaison createXercesLiaison()
                                     throws org.xml.sax.SAXException
Create a Xerces Liaison - used for special handling of DTM Patch from Costin Manolache


process

public void process(XSLTInputSource inputSource,
                    XSLTInputSource stylesheetSource,
                    XSLTResultTarget outputTarget)
             throws org.xml.sax.SAXException
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
Bottleneck the creation of the stylesheet for derivation purposes.


processStylesheet

public StylesheetRoot processStylesheet(XSLTInputSource stylesheetSource)
                                 throws org.xml.sax.SAXException
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
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)
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()
Get the current stylesheet for this processor.
Specified by:
getStylesheet in interface XSLTProcessor


getOutputFileName

public java.lang.String getOutputFileName()
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)
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
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
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
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
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
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)
Given a DOM Document, tell what URI was used to parse it.
Specified by:
findURIFromDoc in interface XPathEnvSupport


getSourceDocsTable

public java.util.Hashtable getSourceDocsTable()
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)
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
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)
Execute the function-available() function.
Specified by:
functionAvailable in interface XPathEnvSupport


elementAvailable

public boolean elementAvailable(java.lang.String namespace,
                                java.lang.String extensionName)
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
Handle an extension function.
Specified by:
extFunction in interface XPathEnvSupport


addTraceListener

public void addTraceListener(TraceListener tl)
                      throws java.util.TooManyListenersException
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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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.

displayDuration

protected void displayDuration(java.lang.String info,
                               java.lang.Object key)
Display the duration since pushTime was called.


setDiagnosticsOutput

public void setDiagnosticsOutput(java.io.OutputStream out)
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)
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


diag

protected void diag(java.lang.String s)
Bottleneck output of diagnostics.


setTraceTemplates

public void setTraceTemplates(boolean b)
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)
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)
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)
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.

traceSelect

protected void traceSelect(org.w3c.dom.Element template,
                           org.w3c.dom.NodeList nl)
                    throws org.xml.sax.SAXException
Print a trace of a selection being made.


traceTemplate

protected void traceTemplate(org.w3c.dom.Node templateNode)
                      throws org.xml.sax.SAXException
Print a trace of a template that is being called, either by a match, name, or as part of for-each.


diagnoseTemplateChildren

protected void diagnoseTemplateChildren(org.w3c.dom.Node templateChild,
                                        org.w3c.dom.Node sourceNode)
Print some diagnostics about the current template child.


cloneToResultTree

protected void cloneToResultTree(Stylesheet stylesheetTree,
                                 org.w3c.dom.Node node,
                                 boolean shouldCloneWithChildren,
                                 boolean overrideStrip,
                                 boolean shouldCloneAttributes)
                          throws org.xml.sax.SAXException,
                                 java.net.MalformedURLException,
                                 java.io.FileNotFoundException,
                                 java.io.IOException
Clone an element with or without children. TODO: Fix or figure out node clone failure!

Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

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
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
Given a result tree fragment, walk the tree and output it to the result stream.


copyAttributeToTarget

protected void copyAttributeToTarget(org.w3c.dom.Attr attr,
                                     org.w3c.dom.Node contextNode,
                                     Stylesheet stylesheetTree,
                                     MutableAttrListImpl attrList,
                                     org.w3c.dom.Element namespaceContext)
                              throws org.xml.sax.SAXException,
                                     java.net.MalformedURLException,
                                     java.io.FileNotFoundException,
                                     java.io.IOException
Copy an attribute to the created output element, executing attribute templates as need be, and processing the xsl:use attribute.

Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

copyAttributesToAttList

protected void copyAttributesToAttList(org.w3c.dom.Element contextNode,
                                       Stylesheet stylesheetTree,
                                       MutableAttrListImpl attList)
                                throws org.xml.sax.SAXException,
                                       java.net.MalformedURLException,
                                       java.io.FileNotFoundException,
                                       java.io.IOException
Copy the attributes from the XSL element to the created output element, executing attribute templates and processing the xsl:use attribute as need be.

Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

shouldStripSourceNode

public boolean shouldStripSourceNode(org.w3c.dom.Node textNode)
                              throws org.xml.sax.SAXException
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()
Get the execution context for XPath.


setExecContext

public void setExecContext(XMLParserLiaison liaison)
Set the execution context for XPath.


getXMLProcessorLiaison

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


createXString

public XString createXString(java.lang.String s)
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)
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)
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)
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)
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)
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()
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
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
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)
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)
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


deassociateXLocatorToNode

public void deassociateXLocatorToNode(org.w3c.dom.Node node)
Deassociate 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:
deassociateXLocatorToNode in interface XPathEnvSupport


getStyleSheetURIfromDoc

public java.lang.String getStyleSheetURIfromDoc(org.w3c.dom.Node sourceTree)
Deprecated.  
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)
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)
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()
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
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.

resetCurrentState

protected final void resetCurrentState(org.w3c.dom.Node xmlNode)
Reset the current element state


findElementByAttribute

protected org.w3c.dom.Element findElementByAttribute(org.w3c.dom.Node elem,
                                                     java.lang.String targetElementName,
                                                     java.lang.String targetAttributeName,
                                                     java.lang.String targetAttributeValue)
Given a tag name, an attribute name, and an attribute value, do a very crude recursive search and locate the first match.


getDocumentHandler

public org.xml.sax.DocumentHandler getDocumentHandler()
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)
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()
Get the current formatter listener.
Specified by:
getFormatterListener in interface XSLTProcessor


setFormatterListener

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


setDOMFactory

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


getDOMFactory

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


setProblemListener

public void setProblemListener(ProblemListener l)
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()
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)
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)
Implement the setDocumentLocator event.


startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Implement the startDocument event.


endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Implement the endDocument event.


startElement

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


endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Implement the endElement event.


startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
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
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
Implement the characters event.


charactersRaw

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


ignorableWhitespace

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


processingInstruction

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


comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
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
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
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
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
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)

flushPending

protected void flushPending()
                     throws org.xml.sax.SAXException
Flush the pending element.


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs60