com.novell.xsl.process
Class WhenTemplate

java.lang.Object
  extended bycom.novell.xsl.process.TemplateCollection
      extended bycom.novell.xsl.process.WhenTemplate
All Implemented Interfaces:
Template

public class WhenTemplate
extends TemplateCollection

A template representing a specific case in an xsl:choose template. This template corresponds to the xsl:when element.


Constructor Summary
WhenTemplate(Expression test, Template[] templates, Node nsContext)
          Constructs a WhenTemplate that tests the specified select pattern and contains the specified templates.
 
Method Summary
 void dump(PrintWriter out, int indent)
          Dumps this object to the specified output stream.
 Expression getTest()
          Returns this template's select pattern.
 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.
 boolean isTrue(Node currentNode, ProcessingEnv env)
          Returns the result of this template's test.
 
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

WhenTemplate

public WhenTemplate(Expression test,
                    Template[] templates,
                    Node nsContext)
Constructs a WhenTemplate that tests the specified select pattern and contains the specified templates.

Parameters:
test - the expression to be tested
templates - the contained templates
nsContext - The node in the style sheet from which this template comes
Method Detail

getTest

public Expression getTest()
Returns this template's select pattern.

Returns:
this template's select pattern

isTrue

public boolean isTrue(Node currentNode,
                      ProcessingEnv env)
               throws XSLException
Returns the result of this template's test.

Parameters:
currentNode - the current source node
env - the XSLT processing environment for evaluation
Returns:
true if this template's pattern selects at least one node or false if it selects no nodes
Throws:
XSLException - if a fatal error occurs during evaluation

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 WhenTemplate, this method instantiates this template's contained templates.

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

dump

public void dump(PrintWriter out,
                 int indent)
Dumps this object to the specified output stream.

Specified by:
dump in interface Template
Overrides:
dump in class TemplateCollection
Parameters:
out - the output stream to write to
indent - number of tabs to indent