com.caucho.xsl
Class TransformerImpl

java.lang.Object
  |
  +--javax.xml.transform.Transformer
        |
        +--com.caucho.xsl.TransformerImpl
All Implemented Interfaces:
Transformer
Direct Known Subclasses:
NodeTransformerImpl, SAXTransformerImpl, StreamTransformerImpl, StringTransformerImpl

public class TransformerImpl
extends Transformer
implements Transformer


Field Summary
static java.lang.String CACHE_DEPENDS
           
protected  java.util.ArrayList cacheDepends
           
static java.lang.String GENERATE_LOCATION
           
protected static L10N L
           
static java.lang.String LINE_MAP
           
protected  com.caucho.java.LineMap lineMap
           
protected  java.util.HashMap parameters
           
protected  java.util.HashMap properties
           
protected  StylesheetImpl stylesheet
           
 
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 getCacheDepends()
           
 ErrorListener getErrorListener()
          Returns the error listener.
 boolean getFeature(java.lang.String name)
          Returns true if the Transformer implements the feature.
 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)
          Gets a transformer/stylesheet property.
 StylesheetImpl getStylesheet()
           
 URIResolver getURIResolver()
          Returns the URI to filename resolver.
protected  Node parseDocument(java.io.InputStream is, java.lang.String systemId)
          Parses the source XML document from the input stream.
protected  Node parseDocument(Source source)
          Parses the source XML document from the source.
protected  Node parseDocument(java.lang.String url)
          Parses the source document specified by a URL
protected  Node parseStringDocument(java.lang.String source, java.lang.String systemId)
          Parses a string as an XML document.
 void setErrorListener(ErrorListener errorListener)
          Sets the error listener.
 void setFeature(java.lang.String name, boolean enable)
          Sets a transformer feature.
 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)
          Sets a transformer/stylesheet property.
 void setURIResolver(URIResolver uriResolver)
          Sets the URI to filename resolver.
 void transform(Node sourceNode, org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler)
          Transforms from the source node to the sax handlers.
 Node transform(Node sourceNode, Node destNode)
          Transforms from the source node to the destination node, returning the destination node.
 void transform(Node node, java.io.OutputStream os)
           
 void transform(Node node, java.io.OutputStream os, java.lang.String encoding)
          Transforms from a DOM node to an output stream.
 void transform(Source source, Result result)
          Transforms the source into the result.
 
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

CACHE_DEPENDS

public static final java.lang.String CACHE_DEPENDS

GENERATE_LOCATION

public static final java.lang.String GENERATE_LOCATION

stylesheet

protected StylesheetImpl stylesheet

properties

protected java.util.HashMap properties

parameters

protected java.util.HashMap parameters

lineMap

protected com.caucho.java.LineMap lineMap

cacheDepends

protected java.util.ArrayList cacheDepends
Constructor Detail

TransformerImpl

protected TransformerImpl(StylesheetImpl stylesheet)
Method Detail

getURIResolver

public URIResolver getURIResolver()
Returns the URI to filename resolver.
Overrides:
getURIResolver in class Transformer

setURIResolver

public void setURIResolver(URIResolver uriResolver)
Sets the URI to filename resolver.
Overrides:
setURIResolver in class Transformer

getErrorListener

public ErrorListener getErrorListener()
Returns the error listener.
Overrides:
getErrorListener in class Transformer

setErrorListener

public void setErrorListener(ErrorListener errorListener)
Sets the error listener.
Overrides:
setErrorListener in class Transformer

getFeature

public boolean getFeature(java.lang.String name)
Description copied from interface: Transformer
Returns true if the Transformer implements the feature.
Specified by:
getFeature in interface Transformer
Following copied from interface: com.caucho.transform.Transformer
Parameters:
name - name of the feature

setFeature

public void setFeature(java.lang.String name,
                       boolean enable)
Description copied from interface: Transformer
Sets a transformer feature.
Specified by:
setFeature in interface Transformer
Following copied from interface: com.caucho.transform.Transformer
Parameters:
name - name of the feature
value - enable or disable the feature

getStylesheet

public StylesheetImpl getStylesheet()

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: Transformer
Gets a transformer/stylesheet property.
Specified by:
getProperty in interface Transformer
Following copied from interface: com.caucho.transform.Transformer
Parameters:
name - name of the property

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Description copied from interface: Transformer
Sets a transformer/stylesheet property.
Specified by:
setProperty in interface Transformer
Following copied from interface: com.caucho.transform.Transformer
Parameters:
name - name of the property
value - value of the property

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 interface Transformer
Overrides:
setParameter in class 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.
Overrides:
getOutputProperties in class Transformer
Returns:
a copy of the properties.

setOutputProperties

public void setOutputProperties(java.util.Properties properties)
Sets the output properties.
Overrides:
setOutputProperties in class 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.
Overrides:
setOutputProperty in class 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.
Overrides:
getOutputProperty in class 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 interface Transformer
Overrides:
getParameter in class Transformer
Parameters:
name - the name of the parameter.

clearParameters

public void clearParameters()
Clears all the external stylesheet parameters.
Overrides:
clearParameters in class Transformer

addFunction

public void addFunction(java.lang.String name,
                        XPathFun fun)
Adds a new custom function.
Specified by:
addFunction in interface Transformer
Parameters:
name - the name of the function.
fun - the new function.

transform

public void transform(Source source,
                      Result result)
               throws TransformerException
Transforms the source into the result.
Overrides:
transform in class Transformer
Parameters:
source - descriptor specifying the input source.
result - descriptor specifying the output result.

transform

public void transform(Node node,
                      java.io.OutputStream os)
               throws TransformerException

transform

public void transform(Node node,
                      java.io.OutputStream os,
                      java.lang.String encoding)
               throws TransformerException
Transforms from a DOM node to an output stream.
Parameters:
node - the source node
os - the destination stream

transform

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

transform

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

parseDocument

protected Node parseDocument(Source source)
                      throws java.io.IOException,
                             org.xml.sax.SAXException,
                             TransformerException
Parses the source XML document from the source.
Parameters:
source - the JAXP source.
Returns:
the parsed document.

parseDocument

protected 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.

parseDocument

protected 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.

parseStringDocument

protected 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.

addCacheDepend

public void addCacheDepend(Path path)

addCacheDepend

protected void addCacheDepend(java.lang.String path)

getCacheDepends

public java.util.ArrayList getCacheDepends()