com.caucho.xsl
Class StylesheetImpl

java.lang.Object
  |
  +--com.caucho.xsl.AbstractStylesheet
        |
        +--com.caucho.xsl.StylesheetImpl
All Implemented Interfaces:
CauchoStylesheet, Stylesheet
Direct Known Subclasses:
JavaScriptStylesheet, 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.


Inner classes inherited from class com.caucho.xsl.AbstractStylesheet
AbstractStylesheet.Depend
 
Field Summary
protected  boolean defaultDisableEscaping
           
protected  java.util.HashMap templates
           
 char[] text
           
 
Fields inherited from class com.caucho.xsl.AbstractStylesheet
errorPage
 
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, Pattern countPattern, Pattern fromPattern, XslNumberFormat format)
           
 void applyNode(XslWriter out, Node node, Env env)
           
protected  void applyNode(XslWriter out, Node node, Env env, java.lang.String mode, int min, int max)
           
protected  void applyNodeDefault(XslWriter out, Node node, Env env, java.lang.String mode)
          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)
           
 java.lang.String getNodeValue(Node node)
           
 OutputFormat getOutputFormat()
          Returns the values specified in the xsl:output directives.
 Path getPath()
           
 java.lang.Object getProperty(java.lang.String name)
          Returns a stylesheet property.
protected  Template getTemplate(Node node, Env env, java.lang.String mode, int min, int max)
          Gets a template.
 void init(Path path)
          Initialize the stylesheet with the search path.
 void multiNumber(XslWriter out, Node node, Env env, Pattern countPattern, Pattern fromPattern, XslNumberFormat format)
           
 void printValue(XslWriter out, Node node)
           
 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 strip)
           
 void singleNumber(XslWriter out, Node node, Env env, Pattern countPattern, Pattern 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, Pattern pattern, Sort[] sortList)
           
 
Methods inherited from class com.caucho.xsl.AbstractStylesheet
addCacheDepend, addDepend, addDepend, clone, getCacheDepends, getDepends, isModified, newNodeTransformer, newSAXTransformer, newStreamTransformer, newStringTransformer
 
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)

getPath

public Path getPath()

setSpaces

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

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

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:
stylePath - path used to search for stylesheets.

transform

public void transform(Node xml,
                      XMLWriter writer,
                      TransformerImpl transformer)
               throws java.lang.Exception
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

applyNode

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

applyNode

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

getTemplate

protected Template getTemplate(Node node,
                               Env env,
                               java.lang.String mode,
                               int min,
                               int max)
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,
                                java.lang.String mode)
                         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.
mode - the XSL mode.

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,
                                      Pattern pattern,
                                      Sort[] sortList)
                               throws java.lang.Exception

singleNumber

public void singleNumber(XslWriter out,
                         Node node,
                         Env env,
                         Pattern countPattern,
                         Pattern fromPattern,
                         XslNumberFormat format)
                  throws java.lang.Exception

multiNumber

public void multiNumber(XslWriter out,
                        Node node,
                        Env env,
                        Pattern countPattern,
                        Pattern fromPattern,
                        XslNumberFormat format)
                 throws java.lang.Exception

anyNumber

public void anyNumber(XslWriter out,
                      Node node,
                      Env env,
                      Pattern countPattern,
                      Pattern 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