org.apache.xalan.xslt
Class ElemTemplateElement

java.lang.Object
  |
  +--org.apache.xalan.xslt.UnImplNode
        |
        +--org.apache.xalan.xslt.ElemTemplateElement
Direct Known Subclasses:
ElemApplyImport, ElemAttribute, ElemCallTemplate, ElemChoose, ElemComment, ElemCopyOf, ElemDecimalFormat, ElemFallback, ElemForEach, ElemIf, ElemMessage, ElemNumber, ElemOtherwise, ElemPI, ElemSort, ElemTemplate, ElemText, ElemTextLiteral, ElemUse, ElemValueOf, ElemVariable, ElemWhen, ElemWithParam

public class ElemTemplateElement
extends org.apache.xalan.xslt.UnImplNode
implements PrefixResolver, java.io.Serializable, NodeCallback

**For advanced use only** An instance of this class represents an element inside an xsl:template class. It has a single "execute" method which is expected to perform the given action on the result tree. This class acts like a Element node, and implements the Element interface, but is not a full implementation of that interface... it only implements enough for basic traversal of the tree.

See Also:
Stylesheet, Serialized Form

Field Summary
 int m_columnNumber
          **For advanced use only** The columnOffset where the element occurs in the xsl file.
 boolean m_defaultSpace
          **For advanced use only** Tell if this element has the default space handling turned off or on according to the xml:space attribute.
 java.lang.String m_elemName
          **For advanced use only** The name of the element.
 boolean m_finishedConstruction
          **For advanced use only** Tell if we've finished construction.
 int m_lineNumber
          **For advanced use only** The line number where the element occurs in the xsl file.
 ElemTemplateElement m_parentNode
          **For advanced use only** Parent node.
 Stylesheet m_stylesheet
          **For advanced use only** The owning stylesheet.
 
Constructor Summary
ElemTemplateElement(XSLTEngineImpl processor, Stylesheet stylesheetTree, java.lang.String name, org.xml.sax.AttributeList atts, int lineNumber, int columnNumber)
          **For advanced use only** Construct a template element instance.
 
Method Summary
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          **For advanced use only** Add a child to the child list.
 java.lang.String childrenToString(XSLTEngineImpl processor, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNode, QName mode)
          **For advanced use only** Take the contents of a template element, process it, and convert it to a string.
 void error(int msg, java.lang.Object[] args)
          **For advanced use only** Throw a template element runtime error.
 void execute(XSLTEngineImpl processor, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNode, QName mode)
          **For advanced use only** Execute the element's primary function.
 void executeChildren(XSLTEngineImpl processor, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNode, QName mode)
          **For advanced use only** Process the children of a template.
 java.lang.String getBaseIdentifier()
          **For advanced use only** Return the base identifier.
 org.w3c.dom.NodeList getChildNodes()
          **For advanced use only** Return the nodelist (same reference).
 org.w3c.dom.Node getFirstChild()
          **For advanced use only** Get the first child
 org.w3c.dom.Node getLastChild()
          **For advanced use only** Get the last child.
 int getLength()
          **For advanced use only** NodeList method: Count the immediate children of this node
 java.lang.String getNamespaceForPrefix(java.lang.String prefix)
          **For advanced use only** Given a namespace, get the corrisponding prefix.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix, org.w3c.dom.Node context)
          **For advanced use only** Given a namespace, get the corrisponding prefix.
 org.w3c.dom.Node getNextSibling()
          **For advanced use only** Get the next sibling or return null.
 java.lang.String getNodeName()
          **For advanced use only** Return the node name.
 short getNodeType()
          **For advanced use only** Get the type of the node.
 org.w3c.dom.Document getOwnerDocument()
          **For advanced use only** Get the stylesheet owner.
 org.w3c.dom.Node getParentNode()
          **For advanced use only** Get the parent.
 java.lang.String getTagName()
          **For advanced use only** Return the element name.
 int getXSLToken()
          **For advanced use only** Get an integer representation of the element type.
 boolean hasChildNodes()
          **For advanced use only** Tell if there are child nodes.
static boolean isSpace(char ch)
          **For advanced use only** Returns whether the specified ch conforms to the XML 1.0 definition of whitespace.
 boolean isWhiteSpace(java.lang.String string)
          **For advanced use only** Tell if the string is whitespace.
 org.w3c.dom.Node item(int index)
          **For advanced use only** NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.
 void processLocatedNode(XPathSupport execContext, org.w3c.dom.Node sourceNode, java.lang.Object callbackInfo)
          **For advanced use only** Implementation of NodeCallback interface.
 
Methods inherited from class org.apache.xalan.xslt.UnImplNode
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getElementsByTagName, getElementsByTagNameNS, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getPreviousSibling, hasAttribute, hasAttributeNS, hasAttributes, insertBefore, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setNodeValue, setPrefix, supports
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_stylesheet

public Stylesheet m_stylesheet
**For advanced use only** The owning stylesheet. (Should this only be put on the template element, to conserve space?)

m_lineNumber

public int m_lineNumber
**For advanced use only** The line number where the element occurs in the xsl file.

m_columnNumber

public int m_columnNumber
**For advanced use only** The columnOffset where the element occurs in the xsl file.

m_defaultSpace

public boolean m_defaultSpace
**For advanced use only** Tell if this element has the default space handling turned off or on according to the xml:space attribute.

m_finishedConstruction

public boolean m_finishedConstruction
**For advanced use only** Tell if we've finished construction. This is set to false until the endElement is encountered. It's mainly used to tell us when we need to use the element tree to resolve namespace prefixes, instead of the dynamic namespace stack that is used from the stylesheet.

m_elemName

public java.lang.String m_elemName
**For advanced use only** The name of the element.

m_parentNode

public ElemTemplateElement m_parentNode
**For advanced use only** Parent node.
Constructor Detail

ElemTemplateElement

public ElemTemplateElement(XSLTEngineImpl processor,
                           Stylesheet stylesheetTree,
                           java.lang.String name,
                           org.xml.sax.AttributeList atts,
                           int lineNumber,
                           int columnNumber)
                    throws org.xml.sax.SAXException
**For advanced use only** Construct a template element instance.
Parameters:
processor - The XSLT Processor.
stylesheetTree - The owning stylesheet.
name - The name of the element.
atts - The element attributes.
lineNumber - The line in the XSLT file that the element occurs on.
columnNumber - The column index in the XSLT file that the element occurs on.
Throws:
org.xml.sax.SAXException - Never.
Method Detail

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix,
                                              org.w3c.dom.Node context)
**For advanced use only** Given a namespace, get the corrisponding prefix.
Specified by:
getNamespaceForPrefix in interface PrefixResolver

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix)
**For advanced use only** Given a namespace, get the corrisponding prefix.
Specified by:
getNamespaceForPrefix in interface PrefixResolver

execute

public void execute(XSLTEngineImpl processor,
                    org.w3c.dom.Node sourceTree,
                    org.w3c.dom.Node sourceNode,
                    QName mode)
             throws XSLProcessorException,
                    java.net.MalformedURLException,
                    java.io.FileNotFoundException,
                    java.io.IOException,
                    org.xml.sax.SAXException
**For advanced use only** Execute the element's primary function. Subclasses of this function may recursivly execute down the element tree.
Parameters:
processor - The XSLT Processor.
sourceTree - The input source tree.
sourceNode - The current context node.
mode - The current mode.
Throws:
XSLProcessorException -  
java.net.MalformedURLException -  
java.io.FileNotFoundException -  
java.io.IOException -  
org.xml.sax.SAXException -  

executeChildren

public void executeChildren(XSLTEngineImpl processor,
                            org.w3c.dom.Node sourceTree,
                            org.w3c.dom.Node sourceNode,
                            QName mode)
                     throws XSLProcessorException,
                            java.net.MalformedURLException,
                            java.io.FileNotFoundException,
                            java.io.IOException,
                            org.xml.sax.SAXException
**For advanced use only** Process the children of a template.
Parameters:
processor - The XSLT processor instance.
sourceTree - The input source tree.
sourceNode - The current context node.
mode - The current mode.
Throws:
XSLProcessorException - Thrown from one of the child execute methods.
java.net.MalformedURLException - Might be thrown from the document() function, or from xsl:include or xsl:import.
java.io.FileNotFoundException - Might be thrown from the document() function, or from xsl:include or xsl:import.
java.io.IOException - Might be thrown from the document() function, or from xsl:include or xsl:import.
org.xml.sax.SAXException - Might be thrown from the document() function, or from xsl:include or xsl:import.

childrenToString

public java.lang.String childrenToString(XSLTEngineImpl processor,
                                         org.w3c.dom.Node sourceTree,
                                         org.w3c.dom.Node sourceNode,
                                         QName mode)
                                  throws XSLProcessorException,
                                         java.net.MalformedURLException,
                                         java.io.FileNotFoundException,
                                         java.io.IOException,
                                         org.xml.sax.SAXException
**For advanced use only** Take the contents of a template element, process it, and convert it to a string.
Parameters:
processor - The XSLT processor instance.
sourceTree - The primary source tree.
sourceNode - The current source node context.
mode - The current mode.
Returns:
The stringized result of executing the elements children.
Throws:
XSLProcessorException - Thrown from one of the child execute methods.
java.net.MalformedURLException - Might be thrown from the document() function, or from xsl:include or xsl:import.
java.io.FileNotFoundException - Might be thrown from the document() function, or from xsl:include or xsl:import.
java.io.IOException - Might be thrown from the document() function, or from xsl:include or xsl:import.
org.xml.sax.SAXException - Might be thrown from the document() function, or from xsl:include or xsl:import.

getXSLToken

public int getXSLToken()
**For advanced use only** Get an integer representation of the element type.
Returns:
An integer representation of the element, defined in the Constants class.
See Also:
Constants.java

isSpace

public static boolean isSpace(char ch)
**For advanced use only** Returns whether the specified ch conforms to the XML 1.0 definition of whitespace. Refer to the definition of S for details.
Parameters:
ch - Character to check as XML whitespace.
Returns:
=true if ch is XML whitespace; otherwise =false.
See Also:

isWhiteSpace

public boolean isWhiteSpace(java.lang.String string)
**For advanced use only** Tell if the string is whitespace.
Parameters:
string - The string in question.
Returns:
True if the string is pure whitespace.

processLocatedNode

public void processLocatedNode(XPathSupport execContext,
                               org.w3c.dom.Node sourceNode,
                               java.lang.Object callbackInfo)
                        throws org.xml.sax.SAXException
**For advanced use only** Implementation of NodeCallback interface. Process the node as soon as it is located by the XLocator.
Specified by:
processLocatedNode in interface NodeCallback
Parameters:
execContext - Execution context.
sourceNode - The source node that was located.
callbackInfo - Opaque info for the caller's benefit.

error

public void error(int msg,
                  java.lang.Object[] args)
**For advanced use only** Throw a template element runtime error. (Note: should we throw a SAXException instead?)
Parameters:
msg - Description of the error that occured.

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
**For advanced use only** Add a child to the child list.
Parameters:
newChild -  
Throws:
org.w3c.dom.DOMException -  
Overrides:
appendChild in class org.apache.xalan.xslt.UnImplNode

hasChildNodes

public boolean hasChildNodes()
**For advanced use only** Tell if there are child nodes.
Overrides:
hasChildNodes in class org.apache.xalan.xslt.UnImplNode

getNodeType

public short getNodeType()
**For advanced use only** Get the type of the node.
Overrides:
getNodeType in class org.apache.xalan.xslt.UnImplNode

getParentNode

public org.w3c.dom.Node getParentNode()
**For advanced use only** Get the parent.
Overrides:
getParentNode in class org.apache.xalan.xslt.UnImplNode

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
**For advanced use only** Return the nodelist (same reference).
Overrides:
getChildNodes in class org.apache.xalan.xslt.UnImplNode

getFirstChild

public org.w3c.dom.Node getFirstChild()
**For advanced use only** Get the first child
Overrides:
getFirstChild in class org.apache.xalan.xslt.UnImplNode

getLastChild

public org.w3c.dom.Node getLastChild()
**For advanced use only** Get the last child.
Overrides:
getLastChild in class org.apache.xalan.xslt.UnImplNode

getNextSibling

public org.w3c.dom.Node getNextSibling()
**For advanced use only** Get the next sibling or return null.
Overrides:
getNextSibling in class org.apache.xalan.xslt.UnImplNode

getLength

public int getLength()
**For advanced use only** NodeList method: Count the immediate children of this node
Returns:
int
Overrides:
getLength in class org.apache.xalan.xslt.UnImplNode

item

public org.w3c.dom.Node item(int index)
**For advanced use only** NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.
Parameters:
index -  
Returns:
org.w3c.dom.Node
Overrides:
item in class org.apache.xalan.xslt.UnImplNode

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
**For advanced use only** Get the stylesheet owner.
Overrides:
getOwnerDocument in class org.apache.xalan.xslt.UnImplNode

getTagName

public java.lang.String getTagName()
**For advanced use only** Return the element name.
Overrides:
getTagName in class org.apache.xalan.xslt.UnImplNode

getNodeName

public java.lang.String getNodeName()
**For advanced use only** Return the node name.
Overrides:
getNodeName in class org.apache.xalan.xslt.UnImplNode

getBaseIdentifier

public java.lang.String getBaseIdentifier()
**For advanced use only** Return the base identifier.
Specified by:
getBaseIdentifier in interface PrefixResolver