com.caucho.xsl
Class Stylesheet

java.lang.Object
  |
  +--com.caucho.xsl.Stylesheet
Direct Known Subclasses:
StylesheetImpl

public abstract class Stylesheet
extends java.lang.Object

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 Stylesheet.Depend
           
 
Field Summary
protected  java.util.ArrayList cacheDepends
           
protected  java.lang.String errorPage
           
 
Constructor Summary
Stylesheet()
           
 
Method Summary
protected  void addCacheDepend(java.lang.String path)
           
protected  void addDepend(Path path)
           
protected  void addDepend(Path path, long lastModified)
           
 java.util.ArrayList getCacheDepends()
           
 java.lang.String getContentType()
           
 java.util.ArrayList getDepends()
           
 java.lang.String getErrorPage()
          Returns the error page, like the error page in JSP.
 long getLastModified()
          Returns last modification time
 java.lang.String getOutputAttribute(java.lang.String name)
          Returns the named output attribute.
 void init(Path path)
           
 boolean isModified()
           
 void print(WriteStream out, Node top)
           
 com.caucho.java.LineMap print(WriteStream out, Node top, boolean withLines)
          Prints a document generated by this stylesheet.
protected  void setOutputAttribute(java.lang.String name, java.lang.String value)
           
 Document transform(Node xml)
          Transforms the XML node to a new XML document based on this stylesheet.
 Document transform(Node xml, java.util.HashMap env)
          Transforms the XML node to a new XML document based on this stylesheet.
abstract  Document transform(Node xml, java.util.HashMap env, Path pwd, PageContext page)
          Transforms the XML node to a new XML document based on this stylesheet.
abstract  CacheableDocument transformCacheable(Node xml, java.util.HashMap env, Path pwd, PageContext page)
          Transforms the XML node to a new XML document based on this stylesheet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheDepends

protected java.util.ArrayList cacheDepends

errorPage

protected java.lang.String errorPage
Constructor Detail

Stylesheet

public Stylesheet()
Method Detail

init

public void init(Path path)
          throws java.lang.Exception

getOutputAttribute

public java.lang.String getOutputAttribute(java.lang.String name)
Returns the named output attribute.

setOutputAttribute

protected void setOutputAttribute(java.lang.String name,
                                  java.lang.String value)

getErrorPage

public java.lang.String getErrorPage()
Returns the error page, like the error page in JSP. Needed for XTP.

getLastModified

public long getLastModified()
Returns last modification time

isModified

public boolean isModified()

addDepend

protected void addDepend(Path path)

addDepend

protected void addDepend(Path path,
                         long lastModified)

getDepends

public java.util.ArrayList getDepends()

addCacheDepend

protected void addCacheDepend(java.lang.String path)

getCacheDepends

public java.util.ArrayList getCacheDepends()

transform

public abstract Document transform(Node xml,
                                   java.util.HashMap env,
                                   Path pwd,
                                   PageContext page)
                            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
env - hash map of properties to pass to the stylesheet
pwd - the working directory for the stylesheet
page - the JSP page context for XTP
Returns:
the converted document

transform

public Document transform(Node xml,
                          java.util.HashMap env)
                   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
env - hash map of properties to pass to the stylesheet
Returns:
the converted document

transform

public Document transform(Node xml)
                   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
Returns:
the converted document

transformCacheable

public abstract CacheableDocument transformCacheable(Node xml,
                                                     java.util.HashMap env,
                                                     Path pwd,
                                                     PageContext page)
                                              throws java.lang.Exception
Transforms the XML node to a new XML document based on this stylesheet.

The CacheableDocument class lets a caller, like XTP, avoid recomputing the stylesheet when nothing has changed.

Parameters:
xml - source xml to convert
env - hash map of properties to pass to the stylesheet
pwd - the working directory for the stylesheet
page - the JSP page context for XTP
Returns:
a cache wrapper around the converted document

getContentType

public java.lang.String getContentType()

print

public void print(WriteStream out,
                  Node top)
           throws java.io.IOException

print

public com.caucho.java.LineMap print(WriteStream out,
                                     Node top,
                                     boolean withLines)
                              throws java.io.IOException
Prints a document generated by this stylesheet.
Parameters:
out - the write stream to send output to.
top - the root of the generated document