com.caucho.xsl
Class TransformerImpl

java.lang.Object
  extended by javax.xml.transform.Transformer
      extended by com.caucho.xsl.TransformerImpl
Direct Known Subclasses:
NodeTransformerImpl, StreamTransformerImpl, StringTransformerImpl

public class TransformerImpl
extends javax.xml.transform.Transformer


Field Summary
protected  java.util.ArrayList<Path> _cacheDepends
           
protected  LineMap _lineMap
           
protected  java.util.HashMap<java.lang.String,java.lang.Object> _parameters
           
protected  java.util.HashMap<java.lang.String,java.lang.Object> _properties
           
protected  StylesheetImpl _stylesheet
           
static java.lang.String CACHE_DEPENDS
           
static java.lang.String GENERATE_LOCATION
           
protected static L10N L
           
static java.lang.String LINE_MAP
           
 
Constructor Summary
protected TransformerImpl(StylesheetImpl stylesheet)
           
 
Method Summary
 void addCacheDepend(Path path)
           
protected  void addCacheDepend(java.lang.String path)
           
 void addFunction(java.lang.String name, XPathFun fun)
          Adds a new custom function.
 void clearParameters()
          Clears all the external stylesheet parameters.
 java.util.ArrayList<Path> getCacheDepends()
           
 javax.xml.transform.ErrorListener getErrorListener()
          Returns the error listener.
 boolean getFeature(java.lang.String name)
           
 java.util.Properties getOutputProperties()
          Returns a copy of the xsl:output properties.
 java.lang.String getOutputProperty(java.lang.String name)
          Returns the value of a single named xsl:output property.
 java.lang.Object getParameter(java.lang.String name)
          Returns the named stylesheet parameter.
 java.lang.Object getProperty(java.lang.String name)
           
 StylesheetImpl getStylesheet()
           
 javax.xml.transform.URIResolver getURIResolver()
          Returns the URI to filename resolver.
protected  org.w3c.dom.Node parseDocument(java.io.InputStream is, java.lang.String systemId)
          Parses the source XML document from the input stream.
protected  org.w3c.dom.Node parseDocument(javax.xml.transform.Source source)
          Parses the source XML document from the source.
protected  org.w3c.dom.Node parseDocument(java.lang.String url)
          Parses the source document specified by a URL
protected  org.w3c.dom.Node parseStringDocument(java.lang.String source, java.lang.String systemId)
          Parses a string as an XML document.
 void setErrorListener(javax.xml.transform.ErrorListener errorListener)
          Sets the error listener.
 void setFeature(java.lang.String name, boolean enable)
           
 void setOutputProperties(java.util.Properties properties)
          Sets the output properties.
 void setOutputProperty(java.lang.String name, java.lang.String value)
          Sets a single xsl:output property.
 void setParameter(java.lang.String name, java.lang.Object value)
          Sets a parameter that XPath expressions in the stylesheet can use as $name.
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setURIResolver(javax.xml.transform.URIResolver uriResolver)
          Sets the URI to filename resolver.
 void transform(org.w3c.dom.Node sourceNode, org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler)
          Transforms from the source node to the sax handlers.
 org.w3c.dom.Node transform(org.w3c.dom.Node sourceNode, org.w3c.dom.Node destNode)
          Transforms from the source node to the destination node, returning the destination node.
 void transform(org.w3c.dom.Node node, java.io.OutputStream os)
           
 void transform(org.w3c.dom.Node node, java.io.OutputStream os, java.lang.String encoding, java.lang.String systemId)
          Transforms from a DOM node to an output stream.
 void transform(javax.xml.transform.Source source, javax.xml.transform.Result result)
          Transforms the source into the result.
 
Methods inherited from class javax.xml.transform.Transformer
reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

L

protected static L10N L

LINE_MAP

public static final java.lang.String LINE_MAP
See Also:
Constant Field Values

CACHE_DEPENDS

public static final java.lang.String CACHE_DEPENDS
See Also:
Constant Field Values

GENERATE_LOCATION

public static final java.lang.String GENERATE_LOCATION
See Also:
Constant Field Values

_stylesheet

protected StylesheetImpl _stylesheet

_properties

protected java.util.HashMap<java.lang.String,java.lang.Object> _properties

_parameters

protected java.util.HashMap<java.lang.String,java.lang.Object> _parameters

_lineMap

protected LineMap _lineMap

_cacheDepends

protected java.util.ArrayList<Path> _cacheDepends
Constructor Detail

TransformerImpl

protected TransformerImpl(StylesheetImpl stylesheet)
Method Detail

getURIResolver

public javax.xml.transform.URIResolver getURIResolver()
Returns the URI to filename resolver.

Specified by:
getURIResolver in class javax.xml.transform.Transformer

setURIResolver

public void setURIResolver(javax.xml.transform.URIResolver uriResolver)
Sets the URI to filename resolver.

Specified by:
setURIResolver in class javax.xml.transform.Transformer

getErrorListener

public javax.xml.transform.ErrorListener getErrorListener()
Returns the error listener.

Specified by:
getErrorListener in class javax.xml.transform.Transformer

setErrorListener

public void setErrorListener(javax.xml.transform.ErrorListener errorListener)
Sets the error listener.

Specified by:
setErrorListener in class javax.xml.transform.Transformer

getFeature

public boolean getFeature(java.lang.String name)

setFeature

public void setFeature(java.lang.String name,
                       boolean enable)

getStylesheet

public StylesheetImpl getStylesheet()

getProperty

public java.lang.Object getProperty(java.lang.String name)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
Sets a parameter that XPath expressions in the stylesheet can use as $name.

Specified by:
setParameter in class javax.xml.transform.Transformer
Parameters:
name - the name of the XPath variable.
value - the value for the variable.

getOutputProperties

public java.util.Properties getOutputProperties()
Returns a copy of the xsl:output properties.

Specified by:
getOutputProperties in class javax.xml.transform.Transformer
Returns:
a copy of the properties.

setOutputProperties

public void setOutputProperties(java.util.Properties properties)
Sets the output properties.

Specified by:
setOutputProperties in class javax.xml.transform.Transformer
Parameters:
properties - the new output properties.

setOutputProperty

public void setOutputProperty(java.lang.String name,
                              java.lang.String value)
Sets a single xsl:output property.

Specified by:
setOutputProperty in class javax.xml.transform.Transformer
Parameters:
name - the name of the property.
value - the value of the property.

getOutputProperty

public java.lang.String getOutputProperty(java.lang.String name)
Returns the value of a single named xsl:output property.

Specified by:
getOutputProperty in class javax.xml.transform.Transformer
Parameters:
name - the name of the property.

getParameter

public java.lang.Object getParameter(java.lang.String name)
Returns the named stylesheet parameter.

Specified by:
getParameter in class javax.xml.transform.Transformer
Parameters:
name - the name of the parameter.

clearParameters

public void clearParameters()
Clears all the external stylesheet parameters.

Specified by:
clearParameters in class javax.xml.transform.Transformer

addFunction

public void addFunction(java.lang.String name,
                        XPathFun fun)
Adds a new custom function.

Parameters:
name - the name of the function.
fun - the new function.

transform

public void transform(javax.xml.transform.Source source,
                      javax.xml.transform.Result result)
               throws javax.xml.transform.TransformerException
Transforms the source into the result.

Specified by:
transform in class javax.xml.transform.Transformer
Parameters:
source - descriptor specifying the input source.
result - descriptor specifying the output result.
Throws:
javax.xml.transform.TransformerException

transform

public void transform(org.w3c.dom.Node node,
                      java.io.OutputStream os)
               throws javax.xml.transform.TransformerException
Throws:
javax.xml.transform.TransformerException

transform

public void transform(org.w3c.dom.Node node,
                      java.io.OutputStream os,
                      java.lang.String encoding,
                      java.lang.String systemId)
               throws javax.xml.transform.TransformerException
Transforms from a DOM node to an output stream.

Parameters:
node - the source node
os - the destination stream
Throws:
javax.xml.transform.TransformerException

transform

public org.w3c.dom.Node transform(org.w3c.dom.Node sourceNode,
                                  org.w3c.dom.Node destNode)
                           throws org.xml.sax.SAXException,
                                  java.io.IOException
Transforms from the source node to the destination node, returning the destination node.

Throws:
org.xml.sax.SAXException
java.io.IOException

transform

public void transform(org.w3c.dom.Node sourceNode,
                      org.xml.sax.ContentHandler contentHandler,
                      org.xml.sax.ext.LexicalHandler lexicalHandler)
               throws org.xml.sax.SAXException,
                      java.io.IOException,
                      javax.xml.transform.TransformerException
Transforms from the source node to the sax handlers.

Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.transform.TransformerException

parseDocument

protected org.w3c.dom.Node parseDocument(javax.xml.transform.Source source)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException,
                                         javax.xml.transform.TransformerException
Parses the source XML document from the source.

Parameters:
source - the JAXP source.
Returns:
the parsed document.
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.transform.TransformerException

parseDocument

protected org.w3c.dom.Node parseDocument(java.io.InputStream is,
                                         java.lang.String systemId)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException
Parses the source XML document from the input stream.

Parameters:
is - the source input stream.
systemId - the path of the source
Returns:
document DOM node for the parsed XML.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseDocument

protected org.w3c.dom.Node parseDocument(java.lang.String url)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException
Parses the source document specified by a URL

Parameters:
url - path to the document to be parsed.
Returns:
the parsed document.
Throws:
java.io.IOException
org.xml.sax.SAXException

parseStringDocument

protected org.w3c.dom.Node parseStringDocument(java.lang.String source,
                                               java.lang.String systemId)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXException
Parses a string as an XML document.

Parameters:
source - the string to use as the XML source
systemId - the URL for the string document.
Returns:
the parsed document.
Throws:
java.io.IOException
org.xml.sax.SAXException

addCacheDepend

public void addCacheDepend(Path path)

addCacheDepend

protected void addCacheDepend(java.lang.String path)

getCacheDepends

public java.util.ArrayList<Path> getCacheDepends()