com.novell.xsl.process
Class AttributeTemplate

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

public class AttributeTemplate
extends TemplateCollection

A template that adds an attribute to a result element. This template corresponds to the xsl:attribute element.


Constructor Summary
AttributeTemplate(Expression name, Expression namespace, Template[] templates, int importance, int position, Node nsContext)
          Constructs an AttributeTemplate that adds an attribute to the containing result element; the attribute's name is given by the specified expression, and its value is given by the specified templates.
 
Method Summary
 void dump(PrintWriter out, int indent)
          Dumps this object to the specified output stream.
 int getImportance()
          Return the import precedence of this AttributeTemplate.
 Expression getNameExpression()
          Return the name expression for this AttributeTemplate
 Expression getNamespaceExpression()
          Return the namespace expression for this AttributeTemplate
 int getPosition()
          Return the position of this AttributeTemplate in the stylesheet relative to other AttributeTemplates 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.
 
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

AttributeTemplate

public AttributeTemplate(Expression name,
                         Expression namespace,
                         Template[] templates,
                         int importance,
                         int position,
                         Node nsContext)
Constructs an AttributeTemplate that adds an attribute to the containing result element; the attribute's name is given by the specified expression, and its value is given by the specified templates.

Parameters:
name - the attribute value template that evaluates to the attribute's name
namespace - the attribute value template that evaluates to the namespace for the attribute name (may be null)
templates - the templates to be evaluated to get the attribute's value
importance - Import precedence of xsl:attribute element in the stylesheet
position - The position of the xsl:attribute element in the stylesheet
nsContext - The node in the style sheet from which this template comes
Method Detail

getNameExpression

public Expression getNameExpression()
Return the name expression for this AttributeTemplate

Returns:
The name expression

getNamespaceExpression

public Expression getNamespaceExpression()
Return the namespace expression for this AttributeTemplate

Returns:
The namespace expression

getPosition

public int getPosition()
Return the position of this AttributeTemplate in the stylesheet relative to other AttributeTemplates in the stylesheet.

Returns:
An int representing the position of this template in the stylesheet

getImportance

public int getImportance()
Return the import precedence of this AttributeTemplate.

Returns:
An int representing the relative import precedence of this instance.

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 an AttributeTemplate, this method adds an attribute to the result tree. The attribute's value is obtained by instantiating this template's contained templates. The contained templates should produce only text nodes.

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