com.caucho.xsl
Class AbstractStylesheet

java.lang.Object
  extended by com.caucho.xsl.AbstractStylesheet
All Implemented Interfaces:
CauchoStylesheet, javax.xml.transform.Templates
Direct Known Subclasses:
StylesheetImpl

public abstract class AbstractStylesheet
extends java.lang.Object
implements CauchoStylesheet, javax.xml.transform.Templates

A compiled XSL stylesheet. Stylesheets use 'transform' to transform an XML tree to an XML Document.

The resulting document can be printed, or it can be added to another XML tree.


Field Summary
protected  java.lang.String _errorPage
           
protected  java.util.Properties _output
           
protected  AbstractStylesheet _stylesheet
           
protected  javax.xml.transform.URIResolver _uriResolver
           
 
Fields inherited from interface com.caucho.xsl.CauchoStylesheet
CACHE_DEPENDS, DEPENDS, GLOBAL_PARAM
 
Constructor Summary
AbstractStylesheet()
           
 
Method Summary
protected  void addCacheDepend(java.lang.String path)
          Adds a cache dependency.
protected  void addDepend(PersistentDependency depend)
          Add a dependency to the stylesheet.
 java.lang.Object clone()
          Clone the stylesheet.
protected  void copy(AbstractStylesheet stylesheet)
          Copies the current stylesheet into the new stylesheet.
 java.util.ArrayList<java.lang.String> getCacheDepends()
           
 java.util.ArrayList<PersistentDependency> getDepends()
          Returns the dependency list of the stylesheet.
 java.util.Properties getOutputProperties()
          Returns the output properties for the stylesheet.
 Path getPath()
           
 java.lang.Object getProperty(java.lang.String name)
          Returns a stylesheet property.
 javax.xml.transform.URIResolver getURIResolver()
           
 void init(Path path)
          Initialize the stylesheet with the search path.
 boolean isModified()
          Returns true if the any of the source stylesheets have been modified since this stylesheet was compiled.
 javax.xml.transform.Transformer newTransformer()
          Creates a new transformer.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a stylesheet property.
 void setURIResolver(javax.xml.transform.URIResolver resolver)
           
abstract  void transform(org.w3c.dom.Node xml, XMLWriter out, TransformerImpl transformer)
          Transforms the XML node to a new XML document based on this stylesheet.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_output

protected java.util.Properties _output

_stylesheet

protected AbstractStylesheet _stylesheet

_errorPage

protected java.lang.String _errorPage

_uriResolver

protected javax.xml.transform.URIResolver _uriResolver
Constructor Detail

AbstractStylesheet

public AbstractStylesheet()
Method Detail

init

public void init(Path path)
          throws java.lang.Exception
Initialize the stylesheet with the search path.

Parameters:
path - the path of the stylepath used to search for stylesheets.
Throws:
java.lang.Exception

setURIResolver

public void setURIResolver(javax.xml.transform.URIResolver resolver)

getURIResolver

public javax.xml.transform.URIResolver getURIResolver()

copy

protected void copy(AbstractStylesheet stylesheet)
Copies the current stylesheet into the new stylesheet. Used to create the transformer.

Parameters:
stylesheet - the new stylesheet which will contain the copied values.

clone

public java.lang.Object clone()
Clone the stylesheet. Used to create transformer.

Overrides:
clone in class java.lang.Object

getOutputProperties

public java.util.Properties getOutputProperties()
Returns the output properties for the stylesheet.

Specified by:
getOutputProperties in interface javax.xml.transform.Templates

getPath

public Path getPath()

getProperty

public java.lang.Object getProperty(java.lang.String name)
Returns a stylesheet property.


setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Sets a stylesheet property.


newTransformer

public javax.xml.transform.Transformer newTransformer()
Creates a new transformer.

Specified by:
newTransformer in interface javax.xml.transform.Templates

isModified

public boolean isModified()
Returns true if the any of the source stylesheets have been modified since this stylesheet was compiled.

Specified by:
isModified in interface CauchoStylesheet

addDepend

protected void addDepend(PersistentDependency depend)
Add a dependency to the stylesheet. Used to keep track of source stylesheets.

Parameters:
path - the path of the source stylesheet.

getDepends

public java.util.ArrayList<PersistentDependency> getDepends()
Returns the dependency list of the stylesheet.


addCacheDepend

protected void addCacheDepend(java.lang.String path)
Adds a cache dependency.


getCacheDepends

public java.util.ArrayList<java.lang.String> getCacheDepends()

transform

public abstract void transform(org.w3c.dom.Node xml,
                               XMLWriter out,
                               TransformerImpl transformer)
                        throws java.lang.Exception
Transforms the XML node to a new XML document based on this stylesheet.

Since Documents are DocumentFragments, calling functions can insert the contents using appendChild.

Parameters:
xml - source xml to convert
out - source xml to convert
Throws:
java.lang.Exception