com.caucho.xsl
Class StylesheetImpl

java.lang.Object
  extended by com.caucho.xsl.AbstractStylesheet
      extended by com.caucho.xsl.StylesheetImpl
All Implemented Interfaces:
CauchoStylesheet, javax.xml.transform.Templates
Direct Known Subclasses:
IdentityStylesheet, 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, _stylesheet, _uriResolver
 
Fields inherited from interface com.caucho.xsl.CauchoStylesheet
CACHE_DEPENDS, DEPENDS, GLOBAL_PARAM
 
Constructor Summary
StylesheetImpl()
           
 
Method Summary
protected  void _xsl_init(XslWriter out, org.w3c.dom.Node context, Env env)
           
protected  void addFunction(java.lang.String name, XPathFun fun)
           
 void anyNumber(XslWriter out, org.w3c.dom.Node node, Env env, AbstractPattern countPattern, AbstractPattern fromPattern, XslNumberFormat format)
           
 void applyNode(XslWriter out, org.w3c.dom.Node node, Env env)
           
protected  void applyNode(XslWriter out, org.w3c.dom.Node node, Env env, int min, int max)
           
protected  void applyNodeDefault(XslWriter out, org.w3c.dom.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, org.w3c.dom.Node node, Env env, Expr expr, XslNumberFormat format)
           
 boolean getGenerateLocation()
           
 java.lang.String getNodeValue(org.w3c.dom.Node node)
           
 OutputFormat getOutputFormat()
           
 java.lang.Object getProperty(java.lang.String name)
          Returns a stylesheet property.
protected  Template getTemplate(java.util.HashMap templates, org.w3c.dom.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, org.w3c.dom.Node node, Env env, AbstractPattern countPattern, AbstractPattern fromPattern, XslNumberFormat format)
           
protected  org.w3c.dom.Document ownerDocument(org.w3c.dom.Node node)
           
 void printValue(XslWriter out, org.w3c.dom.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<java.lang.String,java.lang.String> preserve, java.util.HashMap<java.lang.String,java.lang.String> preservePrefix, java.util.HashMap<java.lang.String,java.lang.String> strip, java.util.HashMap<java.lang.String,java.lang.String> stripPrefix)
           
 void singleNumber(XslWriter out, org.w3c.dom.Node node, Env env, AbstractPattern countPattern, AbstractPattern fromPattern, XslNumberFormat format)
           
 void transform(org.w3c.dom.Node xml, XMLWriter writer, TransformerImpl transformer)
          Transforms the input node to the output writer
protected  java.util.ArrayList xslSort(org.w3c.dom.Node node, Env env, AbstractPattern pattern, Sort[] sortList)
           
 
Methods inherited from class com.caucho.xsl.AbstractStylesheet
addCacheDepend, addDepend, clone, getCacheDepends, getDepends, getOutputProperties, getPath, getURIResolver, isModified, newTransformer, setURIResolver
 
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
Parameters:
stylesheet - the new stylesheet which will contain the copied values.

getOutputFormat

public OutputFormat getOutputFormat()

setOutputFormat

public void setOutputFormat(OutputFormat output)

setSpaces

protected void setSpaces(java.util.HashMap<java.lang.String,java.lang.String> preserve,
                         java.util.HashMap<java.lang.String,java.lang.String> preservePrefix,
                         java.util.HashMap<java.lang.String,java.lang.String> strip,
                         java.util.HashMap<java.lang.String,java.lang.String> 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
Parameters:
path - the path of the stylepath used to search for stylesheets.
Throws:
java.lang.Exception

transform

public void transform(org.w3c.dom.Node xml,
                      XMLWriter writer,
                      TransformerImpl transformer)
               throws org.xml.sax.SAXException,
                      java.io.IOException,
                      javax.xml.transform.TransformerException
Transforms the input node to the output writer

Specified by:
transform in class AbstractStylesheet
Parameters:
xml - the input node to be transformed
writer - output writer receiving the output
transformer - the transformer to be used
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.transform.TransformerException

_xsl_init

protected void _xsl_init(XslWriter out,
                         org.w3c.dom.Node context,
                         Env env)
                  throws java.lang.Exception
Throws:
java.lang.Exception

ownerDocument

protected org.w3c.dom.Document ownerDocument(org.w3c.dom.Node node)

applyNode

public void applyNode(XslWriter out,
                      org.w3c.dom.Node node,
                      Env env)
               throws java.lang.Exception
Throws:
java.lang.Exception

applyNode

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

getTemplate

protected Template getTemplate(java.util.HashMap templates,
                               org.w3c.dom.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
Throws:
XPathException

applyNodeDefault

protected void applyNodeDefault(XslWriter out,
                                org.w3c.dom.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.
Throws:
java.lang.Exception

printValue

public void printValue(XslWriter out,
                       org.w3c.dom.Node node)
                throws java.io.IOException
Throws:
java.io.IOException

getNodeValue

public java.lang.String getNodeValue(org.w3c.dom.Node node)

xslSort

protected java.util.ArrayList xslSort(org.w3c.dom.Node node,
                                      Env env,
                                      AbstractPattern pattern,
                                      Sort[] sortList)
                               throws java.lang.Exception
Throws:
java.lang.Exception

singleNumber

public void singleNumber(XslWriter out,
                         org.w3c.dom.Node node,
                         Env env,
                         AbstractPattern countPattern,
                         AbstractPattern fromPattern,
                         XslNumberFormat format)
                  throws java.lang.Exception
Throws:
java.lang.Exception

multiNumber

public void multiNumber(XslWriter out,
                        org.w3c.dom.Node node,
                        Env env,
                        AbstractPattern countPattern,
                        AbstractPattern fromPattern,
                        XslNumberFormat format)
                 throws java.lang.Exception
Throws:
java.lang.Exception

anyNumber

public void anyNumber(XslWriter out,
                      org.w3c.dom.Node node,
                      Env env,
                      AbstractPattern countPattern,
                      AbstractPattern fromPattern,
                      XslNumberFormat format)
               throws java.lang.Exception
Throws:
java.lang.Exception

exprNumber

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

mergeTemplates

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