com.caucho.xsl
Class StylesheetImpl

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

public class StylesheetImpl
extends AbstractStylesheet

Implementation base class for stylesheets. It is made public only because generated Java and JavaScript classes need to access these routines.


Field Summary
protected  boolean defaultDisableEscaping
           
protected  java.util.HashMap templates
           
 char[] text
           
 
Fields inherited from class com.caucho.xsl.AbstractStylesheet
errorPage, output
 
Fields inherited from interface com.caucho.xsl.CauchoStylesheet
CACHE_DEPENDS, DEPENDS, GLOBAL_PARAM
 
Constructor Summary
StylesheetImpl()
           
 
Method Summary
protected  void _xsl_init(XslWriter out, Node context, Env env)
           
protected  void addFunction(java.lang.String name, XPathFun fun)
           
 void anyNumber(XslWriter out, Node node, Env env, com.caucho.xpath.pattern.AbstractPattern countPattern, com.caucho.xpath.pattern.AbstractPattern fromPattern, XslNumberFormat format)
           
 void applyNode(XslWriter out, Node node, Env env)
           
protected  void applyNode(XslWriter out, Node node, Env env, int min, int max)
           
protected  void applyNodeDefault(XslWriter out, Node node, Env env)
          The default rule when no templates match.
protected  void copy(AbstractStylesheet stylesheet)
          Copies the current stylesheet into the new stylesheet.
 void exprNumber(XslWriter out, Node node, Env env, Expr expr, XslNumberFormat format)
           
 boolean getGenerateLocation()
           
 java.lang.String getNodeValue(Node node)
           
 OutputFormat getOutputFormat()
          Returns the values specified in the xsl:output directives.
 java.lang.Object getProperty(java.lang.String name)
          Returns a stylesheet property.
protected  Template getTemplate(java.util.HashMap templates, Node node, Env env, int min, int max)
          Gets a template.
 void init(Path path)
          Initialize the stylesheet with the search path.
protected static Template[] mergeTemplates(Template[] star, Template[] templates)
          Merges two template arrays into the final one.
 void multiNumber(XslWriter out, Node node, Env env, com.caucho.xpath.pattern.AbstractPattern countPattern, com.caucho.xpath.pattern.AbstractPattern fromPattern, XslNumberFormat format)
           
protected  Document ownerDocument(Node node)
           
 void printValue(XslWriter out, Node node)
           
 void setGenerateLocation(boolean generateLocation)
           
 void setOutputFormat(OutputFormat output)
           
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a stylesheet property.
protected  void setSpaces(java.util.HashMap preserve, java.util.HashMap preservePrefix, java.util.HashMap strip, java.util.HashMap stripPrefix)
           
 void singleNumber(XslWriter out, Node node, Env env, com.caucho.xpath.pattern.AbstractPattern countPattern, com.caucho.xpath.pattern.AbstractPattern fromPattern, XslNumberFormat format)
           
 void transform(Node xml, XMLWriter writer, TransformerImpl transformer)
          Transforms the input node to the output writer
protected  java.util.ArrayList xslSort(Node node, Env env, com.caucho.xpath.pattern.AbstractPattern pattern, Sort[] sortList)
           
 
Methods inherited from class com.caucho.xsl.AbstractStylesheet
addCacheDepend, addDepend, addDepend, clone, getCacheDepends, getDepends, getOutputProperties, getPath, isModified, newNodeTransformer, newSAXTransformer, newStreamTransformer, newStringTransformer, newTransformer
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

public char[] text

templates

protected java.util.HashMap templates

defaultDisableEscaping

protected boolean defaultDisableEscaping
Constructor Detail

StylesheetImpl

public StylesheetImpl()
Method Detail

copy

protected void copy(AbstractStylesheet stylesheet)
Description copied from class: AbstractStylesheet
Copies the current stylesheet into the new stylesheet. Used to create the transformer.
Overrides:
copy in class AbstractStylesheet
Following copied from class: com.caucho.xsl.AbstractStylesheet
Parameters:
stylesheet - the new stylesheet which will contain the copied values.

getOutputFormat

public OutputFormat getOutputFormat()
Description copied from interface: Stylesheet
Returns the values specified in the xsl:output directives.

setOutputFormat

public void setOutputFormat(OutputFormat output)

setSpaces

protected void setSpaces(java.util.HashMap preserve,
                         java.util.HashMap preservePrefix,
                         java.util.HashMap strip,
                         java.util.HashMap stripPrefix)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Description copied from class: AbstractStylesheet
Sets a stylesheet property.
Overrides:
setProperty in class AbstractStylesheet

setGenerateLocation

public void setGenerateLocation(boolean generateLocation)

getGenerateLocation

public boolean getGenerateLocation()

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from class: AbstractStylesheet
Returns a stylesheet property.
Overrides:
getProperty in class AbstractStylesheet

addFunction

protected void addFunction(java.lang.String name,
                           XPathFun fun)

init

public void init(Path path)
          throws java.lang.Exception
Description copied from class: AbstractStylesheet
Initialize the stylesheet with the search path.
Overrides:
init in class AbstractStylesheet
Following copied from class: com.caucho.xsl.AbstractStylesheet
Parameters:
path - the path of the stylepath used to search for stylesheets.

transform

public void transform(Node xml,
                      XMLWriter writer,
                      TransformerImpl transformer)
               throws org.xml.sax.SAXException,
                      java.io.IOException,
                      TransformerException
Transforms the input node to the output writer
Overrides:
transform in class AbstractStylesheet
Parameters:
xml - the input node to be transformed
writer - output writer receiving the output
transformer - the transformer to be used

_xsl_init

protected void _xsl_init(XslWriter out,
                         Node context,
                         Env env)
                  throws java.lang.Exception

ownerDocument

protected Document ownerDocument(Node node)

applyNode

public void applyNode(XslWriter out,
                      Node node,
                      Env env)
               throws java.lang.Exception

applyNode

protected void applyNode(XslWriter out,
                         Node node,
                         Env env,
                         int min,
                         int max)
                  throws java.lang.Exception

getTemplate

protected Template getTemplate(java.util.HashMap templates,
                               Node node,
                               Env env,
                               int min,
                               int max)
                        throws XPathException
Gets a template. Only those templates with importance between min and max are considered. For apply-templates, min = 0, and max = Infinity,
Parameters:
min - minimum allowed importance
max - maximum allowed importance

applyNodeDefault

protected void applyNodeDefault(XslWriter out,
                                Node node,
                                Env env)
                         throws java.lang.Exception
The default rule when no templates match. By default, it calls apply-template on element children and copies text. All other nodes are stripped.
Parameters:
out - the current writer.
node - the current node.
env - the xpath environment.

printValue

public void printValue(XslWriter out,
                       Node node)
                throws java.io.IOException

getNodeValue

public java.lang.String getNodeValue(Node node)

xslSort

protected java.util.ArrayList xslSort(Node node,
                                      Env env,
                                      com.caucho.xpath.pattern.AbstractPattern pattern,
                                      Sort[] sortList)
                               throws java.lang.Exception

singleNumber

public void singleNumber(XslWriter out,
                         Node node,
                         Env env,
                         com.caucho.xpath.pattern.AbstractPattern countPattern,
                         com.caucho.xpath.pattern.AbstractPattern fromPattern,
                         XslNumberFormat format)
                  throws java.lang.Exception

multiNumber

public void multiNumber(XslWriter out,
                        Node node,
                        Env env,
                        com.caucho.xpath.pattern.AbstractPattern countPattern,
                        com.caucho.xpath.pattern.AbstractPattern fromPattern,
                        XslNumberFormat format)
                 throws java.lang.Exception

anyNumber

public void anyNumber(XslWriter out,
                      Node node,
                      Env env,
                      com.caucho.xpath.pattern.AbstractPattern countPattern,
                      com.caucho.xpath.pattern.AbstractPattern fromPattern,
                      XslNumberFormat format)
               throws java.lang.Exception

exprNumber

public void exprNumber(XslWriter out,
                       Node node,
                       Env env,
                       Expr expr,
                       XslNumberFormat format)
                throws java.lang.Exception

mergeTemplates

protected static Template[] mergeTemplates(Template[] star,
                                           Template[] templates)
Merges two template arrays into the final one.