com.caucho.xsl
Class AbstractStylesheet

java.lang.Object
  |
  +--com.caucho.xsl.AbstractStylesheet
All Implemented Interfaces:
CauchoStylesheet, Stylesheet
Direct Known Subclasses:
StylesheetImpl

public abstract class AbstractStylesheet
extends java.lang.Object
implements CauchoStylesheet

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.


Inner Class Summary
static class AbstractStylesheet.Depend
          Class holding a dependency.
 
Field Summary
protected  java.lang.String errorPage
           
 
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(Path path)
          Add a dependency to the stylesheet.
protected  void addDepend(Path path, long lastModified, long length)
          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 getCacheDepends()
           
 java.util.ArrayList getDepends()
          Returns the dependency list of the stylesheet.
 java.lang.Object getProperty(java.lang.String name)
          Returns a stylesheet property.
 void init(Path stylePath)
          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.
 NodeTransformer newNodeTransformer()
          Creates a new node transformer.
 SAXTransformer newSAXTransformer()
          Creates a new SAX transformer.
 StreamTransformer newStreamTransformer()
          Creates a new stream transformer.
 StringTransformer newStringTransformer()
          Creates a new string transformer.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a stylesheet property.
abstract  void transform(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
 
Methods inherited from interface com.caucho.transform.Stylesheet
getOutputFormat
 

Field Detail

errorPage

protected java.lang.String errorPage
Constructor Detail

AbstractStylesheet

public AbstractStylesheet()
Method Detail

init

public void init(Path stylePath)
          throws java.lang.Exception
Initialize the stylesheet with the search path.
Parameters:
stylePath - path used to search for stylesheets.

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

getProperty

public java.lang.Object getProperty(java.lang.String name)
Returns a stylesheet property.
Specified by:
getProperty in interface Stylesheet

setProperty

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

newStringTransformer

public StringTransformer newStringTransformer()
Creates a new string transformer.
Specified by:
newStringTransformer in interface Stylesheet

newStreamTransformer

public StreamTransformer newStreamTransformer()
Creates a new stream transformer.
Specified by:
newStreamTransformer in interface Stylesheet

newNodeTransformer

public NodeTransformer newNodeTransformer()
Creates a new node transformer.
Specified by:
newNodeTransformer in interface Stylesheet

newSAXTransformer

public SAXTransformer newSAXTransformer()
Creates a new SAX transformer.
Specified by:
newSAXTransformer in interface Stylesheet

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(Path path)
Add a dependency to the stylesheet. Used to keep track of source stylesheets.
Parameters:
path - the path of the source stylesheet.

addDepend

protected void addDepend(Path path,
                         long lastModified,
                         long length)
Add a dependency to the stylesheet. Used to keep track of source stylesheets.
Parameters:
path - the path of the source stylesheet.
lastModified - the last-modified time of the source when this stylesheet was compiled.
length - the length of the source when this stylesheet was compiled.

getDepends

public java.util.ArrayList 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 getCacheDepends()

transform

public abstract void transform(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
Returns:
the converted document