com.novell.xsl.process
Class LiteralElementTemplate

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

public class LiteralElementTemplate
extends TemplateCollection

A template that creates a literal result element.


Constructor Summary
LiteralElementTemplate(String elementName, String[] attributeNames, Expression[] attributeValues, Set extNamespaces, Set excludedNamespaces, Collection attributeSetNames, Template[] templates, Node nsNode)
          Constructs a LiteralElementTemplate that creates a literal result element with the specified qualified name and contains the specified templates.
 
Method Summary
protected  String adjustPrefix(String name, ProcessingEnv env, Map namespaceMap)
          Adjust the prefix of a QName to reflect the prefix being used for the namespace in the result tree
 void dump(PrintWriter out, int indent)
          Dumps this object to the specified output stream.
protected  String getNamespaceURI(String name, ProcessingEnv env)
          Get the namespace URI from the environment
 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

LiteralElementTemplate

public LiteralElementTemplate(String elementName,
                              String[] attributeNames,
                              Expression[] attributeValues,
                              Set extNamespaces,
                              Set excludedNamespaces,
                              Collection attributeSetNames,
                              Template[] templates,
                              Node nsNode)
Constructs a LiteralElementTemplate that creates a literal result element with the specified qualified name and contains the specified templates.

Parameters:
elementName - the element's qualified name
attributeNames - the element's qualified attribute names
attributeValues - the element's attribute values
extNamespaces - any extension namespaces defined using xsl:extension-element-prefixes
excludedNamespaces - any namespaces defined using xsl:exclude-result-prefixes on this or any ancestor, including xsl:stylesheet
attributeSetNames - The attribute sets to use when the template is instantiated (may be null).
templates - the element's contained templates
nsNode - The node in the style sheet from which this template comes
Throws:
IllegalArgumentException - if attributeNames and attributeValues are not the same length
Method Detail

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 LiteralElementTemplate, this method adds an element to the result tree. The element's children are obtained by instantiating 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

adjustPrefix

protected String adjustPrefix(String name,
                              ProcessingEnv env,
                              Map namespaceMap)
Adjust the prefix of a QName to reflect the prefix being used for the namespace in the result tree

Parameters:
name - The QName to adjust
env - The ProcessingEnv passed to instantiate()
namespaceMap - A map of namespace nodes for this literal result element, indexed by namespace name.

getNamespaceURI

protected String getNamespaceURI(String name,
                                 ProcessingEnv env)
Get the namespace URI from the environment

Parameters:
name - The QName to adjust
env - The ProcessingEnv passed to instantiate()

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