com.novell.xsl.process
Class TopLevelVariableTemplate

java.lang.Object
  extended bycom.novell.xsl.process.TemplateCollection
      extended bycom.novell.xsl.process.VariableTemplate
          extended bycom.novell.xsl.process.TopLevelVariableTemplate
All Implemented Interfaces:
Expression, Template, XPathResetCache

public class TopLevelVariableTemplate
extends VariableTemplate
implements XPathResetCache

A template that instantiates a top-level XSLT variable


Field Summary
 
Fields inherited from class com.novell.xsl.process.VariableTemplate
currentValue
 
Constructor Summary
TopLevelVariableTemplate(VariableTemplate variable, int importance, int number, Node nsContext)
          Constructs a VariableTemplate that create binds a value to a variable
 
Method Summary
 ExpressionValue evaluate(Node contextNode, ExpressionContext context)
          Evaluate the expression with repect to the passed context Note: The contextNode and context parameters may be null if and only if isConstant() returns true for the expression implementation.
 int getImportance()
          Return the import precedence of this top-level variable template
 int getNumber()
          Return the relative position of this template in the stylesheet
 void instantiate(ProcessingEnv env, Node currentNode, ResultHandler result)
          Instantiates this template for the specified current node and sends the result to the specified result handler.
 void registerForReset(XPathResetRegistrar registrar)
          Register this expression or any subexpression that implements XPathResetCache with an object that wants to call resetCache() Override VariableTemplate
 void replace(Expression replacement)
          Allow this instance of a top-level variable to be replaced by another, more important one.
 void resetCache()
          Reset any cached data for another invocation
 void setLazyEnv(ProcessingEnv lazyEnv)
          Set up the processing environment for lazy evaluation of this top-level variable
 
Methods inherited from class com.novell.xsl.process.VariableTemplate
dump, getCurrentValue, getName, getResultType, getSelect, isConstant, isParam, setCurrentValue
 
Methods inherited from class com.novell.xsl.process.TemplateCollection
getNamespaceContext, getTemplates, instantiateTemplates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopLevelVariableTemplate

public TopLevelVariableTemplate(VariableTemplate variable,
                                int importance,
                                int number,
                                Node nsContext)
Constructs a VariableTemplate that create binds a value to a variable

Parameters:
variable - the parsed TemplateVariable for this top-level variable
importance - the import precedence of this top-level variable
number - the variable number (appearance in stylesheet)
nsContext - The node in the style sheet from which this template comes
Method Detail

setLazyEnv

public void setLazyEnv(ProcessingEnv lazyEnv)
Set up the processing environment for lazy evaluation of this top-level variable


replace

public void replace(Expression replacement)
Allow this instance of a top-level variable to be replaced by another, more important one. This is used to allow the replacement of a variable by another with the same name but greater import precedence.


getImportance

public int getImportance()
Return the import precedence of this top-level variable template

Returns:
The relative import precedence of this template

getNumber

public int getNumber()
Return the relative position of this template in the stylesheet

Returns:
The relative position of this template in the stylesheet

instantiate

public void instantiate(ProcessingEnv env,
                        Node currentNode,
                        ResultHandler result)
                 throws XSLException
Instantiates this template for the specified current node and sends the result to the specified result handler.

For a VariableTemplate, this method evaluates the select expression, or instantiates the result fragment template, and places the variable within scope.

Specified by:
instantiate in interface Template
Overrides:
instantiate in class VariableTemplate
Parameters:
env - the current processing environment
currentNode - the current source node
result - the handler to which results are sent
Throws:
XSLException - if a fatal error occurs during instantiation

evaluate

public ExpressionValue evaluate(Node contextNode,
                                ExpressionContext context)
                         throws XPathEvaluationException
Evaluate the expression with repect to the passed context Note: The contextNode and context parameters may be null if and only if isConstant() returns true for the expression implementation.

Specified by:
evaluate in interface Expression
Overrides:
evaluate in class VariableTemplate
Parameters:
contextNode - context node for expression evaluation
context - expression context for expression evaluation
Returns:
result of evaluating expression
Throws:
XPathEvaluationException

registerForReset

public void registerForReset(XPathResetRegistrar registrar)
Register this expression or any subexpression that implements XPathResetCache with an object that wants to call resetCache() Override VariableTemplate

Specified by:
registerForReset in interface Expression
Overrides:
registerForReset in class VariableTemplate

resetCache

public void resetCache()
Reset any cached data for another invocation

Specified by:
resetCache in interface XPathResetCache