org.apache.xalan.templates
Class ElemTemplateElement

java.lang.Object
  extended by org.apache.xml.utils.UnImplNode
      extended by org.apache.xalan.templates.ElemTemplateElement
All Implemented Interfaces:
java.io.Serializable, javax.xml.transform.SourceLocator, XSLTVisitable, PrefixResolver, ExpressionNode, WhitespaceStrippingElementMatcher, org.w3c.dom.Document, org.w3c.dom.Element, org.w3c.dom.Node, org.w3c.dom.NodeList
Direct Known Subclasses:
DecimalFormatProperties, ElemApplyImport, ElemChoose, ElemComment, ElemCopyOf, ElemEmpty, ElemExtensionDecl, ElemExtensionScript, ElemFallback, ElemForEach, ElemIf, ElemMessage, ElemNumber, ElemOtherwise, ElemPI, ElemSort, ElemTemplate, ElemText, ElemTextLiteral, ElemUse, ElemValueOf, ElemVariable, ElemWhen, ElemWithParam, KeyDeclaration, NamespaceAlias, OutputProperties, Stylesheet, XSLTElementProcessor

public class ElemTemplateElement
extends UnImplNode
implements PrefixResolver, java.io.Serializable, ExpressionNode, WhitespaceStrippingElementMatcher, XSLTVisitable

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
private  int m_columnNumber
          the column number where the current document event ends.
private  java.util.List m_declaredPrefixes
          The list of namespace declarations for this element only.
private  boolean m_defaultSpace
          Tell if this element has the default space handling turned off or on according to the xml:space attribute.
protected  int m_docOrderNumber
          The *relative* document order number of this element.
private  org.w3c.dom.Node m_DOMBackPointer
          DOM backpointer that this element originated from.
private  int m_endColumnNumber
          the column number where the current document event ends.
private  int m_endLineNumber
          line number where the current document event ends.
(package private)  ElemTemplateElement m_firstChild
          First child.
private  boolean m_hasTextLitOnly
          Tell if this element only has one text child, for optimization purposes.
protected  boolean m_hasVariableDecl
          Tell if this element only has one text child, for optimization purposes.
private  int m_lineNumber
          line number where the current document event ends.
(package private)  ElemTemplateElement m_nextSibling
          Next sibling.
protected  ElemTemplateElement m_parentNode
          Parent node.
private  java.util.List m_prefixTable
          The table of XMLNSDecls for this element and all parent elements, screened for excluded prefixes.
(package private) static long serialVersionUID
           
 
Fields inherited from class org.apache.xml.utils.UnImplNode
actualEncoding, fDocumentURI
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
ElemTemplateElement()
          Construct a template element instance.
 
Method Summary
protected  boolean accept(XSLTVisitor visitor)
          Accept a visitor and call the appropriate method for this class.
(package private)  void addOrReplaceDecls(XMLNSDecl newDecl)
          Add or replace this namespace declaration in list of namespaces in scope for this element.
 ElemTemplateElement appendChild(ElemTemplateElement elem)
          Add a child to the child list.
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          Add a child to the child list.
protected  void callChildVisitors(XSLTVisitor visitor)
          Call the children visitors.
protected  void callChildVisitors(XSLTVisitor visitor, boolean callAttributes)
          Call the children visitors.
 void callVisitors(XSLTVisitor visitor)
          This will traverse the heararchy, calling the visitor for each member.
 boolean canAcceptVariables()
          Tell if this element can accept variable declarations.
 boolean canStripWhiteSpace()
          Get information about whether or not whitespace can be stripped.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for precedence order.
 void compose(StylesheetRoot sroot)
          This function is called after everything else has been recomposed, and allows the template to set remaining values that may be based on some other property that depends on recomposition.
 boolean containsExcludeResultPrefix(java.lang.String prefix, java.lang.String uri)
          Get whether or not the passed URL is contained flagged by the "extension-element-prefixes" property.
 void endCompose(StylesheetRoot sroot)
          This after the template's children have been composed.
 void error(java.lang.String msg)
          Throw an error.
 void error(java.lang.String msg, java.lang.Object[] args)
          Throw a template element runtime error.
private  boolean excludeResultNSDecl(java.lang.String prefix, java.lang.String uri)
          Tell if the result namespace decl should be excluded.
 void execute(TransformerImpl transformer)
          Execute the element's primary function.
(package private)  void executeNSDecls(TransformerImpl transformer)
          Send startPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.
(package private)  void executeNSDecls(TransformerImpl transformer, java.lang.String ignorePrefix)
          Send startPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.
 void exprAddChild(ExpressionNode n, int i)
          This method tells the node to add its argument to the node's list of children.
 ExpressionNode exprGetChild(int i)
          This method returns a child node.
 int exprGetNumChildren()
          Return the number of children the node has.
 ExpressionNode exprGetParent()
          Get the ExpressionNode parent of this node.
 void exprSetParent(ExpressionNode n)
          Set the parent of this node.
 java.lang.String getBaseIdentifier()
          Return the base identifier.
 org.w3c.dom.NodeList getChildNodes()
          Return the nodelist (same reference).
 int getColumnNumber()
          Return the column number where the current document event ends.
 java.util.List getDeclaredPrefixes()
          Return a table that contains all prefixes available within this element context.
 org.w3c.dom.Node getDOMBackPointer()
          If this stylesheet was created from a DOM, get the DOM backpointer that this element originated from.
 int getEndColumnNumber()
          Return the column number where the current document event ends.
 int getEndLineNumber()
          Return the line number where the current document event ends.
 org.w3c.dom.Node getFirstChild()
          Get the first child as a Node.
 ElemTemplateElement getFirstChildElem()
          Get the first child as a ElemTemplateElement.
 org.w3c.dom.Node getLastChild()
          Get the last child.
 ElemTemplateElement getLastChildElem()
          Get the last child.
 int getLength()
          NodeList method: Count the immediate children of this node
 int getLineNumber()
          Return the line number where the current document event ends.
 java.lang.String getLocalName()
          For now, just return the result of getNodeName(), which the local name.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix)
          Given a namespace, get the corrisponding prefix.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix, org.w3c.dom.Node context)
          Fullfill the PrefixResolver interface.
 org.w3c.dom.Node getNextSibling()
          Get the next sibling (as a Node) or return null.
 ElemTemplateElement getNextSiblingElem()
          Get the next sibling (as a ElemTemplateElement) or return null.
 java.lang.String getNodeName()
          Return the node name.
 short getNodeType()
          Get the type of the node.
 org.w3c.dom.Document getOwnerDocument()
          Get the stylesheet owner.
 ElemTemplate getOwnerXSLTemplate()
          Get the owning xsl:template element.
 ElemTemplateElement getParentElem()
          Get the parent as an ElemTemplateElement.
 org.w3c.dom.Node getParentNode()
          Get the parent as a Node.
 ElemTemplateElement getParentNodeElem()
          Get the parent element.
(package private)  java.util.List getPrefixTable()
          Return a table that contains all prefixes available within this element context.
 org.w3c.dom.Node getPreviousSibling()
          Get the previous sibling (as a Node) or return null.
 ElemTemplateElement getPreviousSiblingElem()
          Get the previous sibling (as a Node) or return null.
 java.lang.String getPublicId()
          Return the public identifier for the current document event.
 Stylesheet getStylesheet()
          Get the owning stylesheet.
 StylesheetComposed getStylesheetComposed()
          Get the owning "composed" stylesheet.
 StylesheetRoot getStylesheetRoot()
          Get the owning root stylesheet.
 java.lang.String getSystemId()
          Return the system identifier for the current document event.
 java.lang.String getTagName()
          Return the element name.
 int getUid()
          Get the UID (document order index).
 boolean getXmlSpace()
          Get the "xml:space" attribute.
 int getXSLToken()
          Get an integer representation of the element type.
 boolean handlesNullPrefixes()
           
 boolean hasChildNodes()
          Tell if there are child nodes.
 boolean hasTextLitOnly()
          Tell if this element only has one text child, for optimization purposes.
 boolean hasVariableDecl()
           
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
          Unimplemented.
 boolean isCompiledTemplate()
          Tell if this template is a compiled template.
 org.w3c.dom.Node item(int index)
          NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.
(package private)  boolean needToCheckExclude()
          Return whether we need to check namespace prefixes against and exclude result prefixes list.
 void recompose(StylesheetRoot root)
          This function is called during recomposition to control how this element is composed.
 ElemTemplateElement removeChild(ElemTemplateElement childETE)
          Remove a child.
 ElemTemplateElement replaceChild(ElemTemplateElement newChildElem, ElemTemplateElement oldChildElem)
          Replace the old child with a new child.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          Replace the old child with a new child.
 void resolvePrefixTables()
          Combine the parent's namespaces with this namespace for fast processing, taking care to reference the parent's namespace if this namespace adds nothing new.
 void runtimeInit(TransformerImpl transformer)
          This function will be called on top-level elements only, just before the transform begins.
 void setDOMBackPointer(org.w3c.dom.Node n)
          If this stylesheet was created from a DOM, set the DOM backpointer that this element originated from.
 void setEndLocaterInfo(javax.xml.transform.SourceLocator locator)
          Set the end location information for this element.
 void setLocaterInfo(javax.xml.transform.SourceLocator locator)
          Set the location information for this element.
 void setParentElem(ElemTemplateElement p)
          Set the parent as an ElemTemplateElement.
 void setPrefixes(org.xml.sax.helpers.NamespaceSupport nsSupport)
          From the SAX2 helper class, set the namespace table for this element.
 void setPrefixes(org.xml.sax.helpers.NamespaceSupport nsSupport, boolean excludeXSLDecl)
          Copy the namespace declarations from the NamespaceSupport object.
(package private)  void setPrefixTable(java.util.List list)
           
 void setUid(int i)
          Set the UID (document order index).
 void setXmlSpace(int v)
          Set the "xml:space" attribute.
 boolean shouldStripWhiteSpace(XPathContext support, org.w3c.dom.Element targetElement)
          Get information about whether or not an element should strip whitespace.
(package private)  void unexecuteNSDecls(TransformerImpl transformer)
          Send endPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.
(package private)  void unexecuteNSDecls(TransformerImpl transformer, java.lang.String ignorePrefix)
          Send endPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.
 
Methods inherited from class org.apache.xml.utils.UnImplNode
adoptNode, appendData, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, getActualEncoding, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getImplementation, getInputEncoding, getNamespaceURI, getNodeValue, getOwnerElement, getPrefix, getSchemaTypeInfo, getSpecified, getStrictErrorChecking, getTextContent, getUserData, getWholeText, getXmlEncoding, getXmlStandalone, getXmlVersion, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertData, isDefaultNamespace, isEqualNode, isId, isSameNode, isSupported, isWhitespaceInElementContent, lookupNamespaceURI, lookupPrefix, normalize, normalizeDocument, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, renameNode, replaceData, replaceWholeText, setActualEncoding, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setDocumentURI, setIdAttribute, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setInputEncoding, setNodeValue, setPrefix, setStrictErrorChecking, setTextContent, setUserData, setValue, setXmlEncoding, setXmlStandalone, setXmlVersion, splitText, substringData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

m_lineNumber

private int m_lineNumber
line number where the current document event ends.


m_endLineNumber

private int m_endLineNumber
line number where the current document event ends.


m_columnNumber

private int m_columnNumber
the column number where the current document event ends.


m_endColumnNumber

private int m_endColumnNumber
the column number where the current document event ends.


m_defaultSpace

private boolean m_defaultSpace
Tell if this element has the default space handling turned off or on according to the xml:space attribute.


m_hasTextLitOnly

private boolean m_hasTextLitOnly
Tell if this element only has one text child, for optimization purposes.


m_hasVariableDecl

protected boolean m_hasVariableDecl
Tell if this element only has one text child, for optimization purposes.


m_declaredPrefixes

private java.util.List m_declaredPrefixes
The list of namespace declarations for this element only.


m_prefixTable

private java.util.List m_prefixTable
The table of XMLNSDecls for this element and all parent elements, screened for excluded prefixes.


m_docOrderNumber

protected int m_docOrderNumber
The *relative* document order number of this element.


m_parentNode

protected ElemTemplateElement m_parentNode
Parent node.


m_nextSibling

ElemTemplateElement m_nextSibling
Next sibling.


m_firstChild

ElemTemplateElement m_firstChild
First child.


m_DOMBackPointer

private transient org.w3c.dom.Node m_DOMBackPointer
DOM backpointer that this element originated from.

Constructor Detail

ElemTemplateElement

public ElemTemplateElement()
Construct a template element instance.

Method Detail

isCompiledTemplate

public boolean isCompiledTemplate()
Tell if this template is a compiled template.

Returns:
Boolean flag indicating whether this is a compiled template

getXSLToken

public int getXSLToken()
Get an integer representation of the element type.

Returns:
An integer representation of the element, defined in the Constants class.
See Also:
Constants

getNodeName

public java.lang.String getNodeName()
Return the node name.

Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in class UnImplNode
Returns:
An invalid node name

getLocalName

public java.lang.String getLocalName()
For now, just return the result of getNodeName(), which the local name.

Specified by:
getLocalName in interface org.w3c.dom.Node
Overrides:
getLocalName in class UnImplNode
Returns:
The result of getNodeName().

runtimeInit

public void runtimeInit(TransformerImpl transformer)
                 throws javax.xml.transform.TransformerException
This function will be called on top-level elements only, just before the transform begins.

Parameters:
transformer - The XSLT TransformerFactory.
Throws:
javax.xml.transform.TransformerException

execute

public void execute(TransformerImpl transformer)
             throws javax.xml.transform.TransformerException
Execute the element's primary function. Subclasses of this function may recursivly execute down the element tree.

Parameters:
transformer - The XSLT TransformerFactory.
Throws:
javax.xml.transform.TransformerException - if any checked exception occurs.

getStylesheetComposed

public StylesheetComposed getStylesheetComposed()
Get the owning "composed" stylesheet. This looks up the inheritance chain until it calls getStylesheetComposed on a Stylesheet object, which will Get the owning aggregated stylesheet, or that stylesheet if it is aggregated.

Returns:
the owning "composed" stylesheet.

getStylesheet

public Stylesheet getStylesheet()
Get the owning stylesheet. This looks up the inheritance chain until it calls getStylesheet on a Stylesheet object, which will return itself.

Returns:
the owning stylesheet

getStylesheetRoot

public StylesheetRoot getStylesheetRoot()
Get the owning root stylesheet. This looks up the inheritance chain until it calls StylesheetRoot on a Stylesheet object, which will return a reference to the root stylesheet.

Returns:
the owning root stylesheet

recompose

public void recompose(StylesheetRoot root)
               throws javax.xml.transform.TransformerException
This function is called during recomposition to control how this element is composed.

Throws:
javax.xml.transform.TransformerException

compose

public void compose(StylesheetRoot sroot)
             throws javax.xml.transform.TransformerException
This function is called after everything else has been recomposed, and allows the template to set remaining values that may be based on some other property that depends on recomposition.

Throws:
javax.xml.transform.TransformerException

endCompose

public void endCompose(StylesheetRoot sroot)
                throws javax.xml.transform.TransformerException
This after the template's children have been composed.

Throws:
javax.xml.transform.TransformerException

error

public void error(java.lang.String msg,
                  java.lang.Object[] args)
Throw a template element runtime error. (Note: should we throw a TransformerException instead?)

Overrides:
error in class UnImplNode
Parameters:
msg - key of the error that occured.
args - Arguments to be used in the message

error

public void error(java.lang.String msg)
Description copied from class: UnImplNode
Throw an error.

Overrides:
error in class UnImplNode
Parameters:
msg - Message Key for the error

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Add a child to the child list. NOTE: This presumes the child did not previously have a parent. Making that assumption makes this a less expensive operation -- but requires that if you *do* want to reparent a node, you use removeChild() first to remove it from its previous context. Failing to do so will damage the tree.

Specified by:
appendChild in interface org.w3c.dom.Node
Overrides:
appendChild in class UnImplNode
Parameters:
newChild - Child to be added to child list
Returns:
Child just added to the child list
Throws:
org.w3c.dom.DOMException

appendChild

public ElemTemplateElement appendChild(ElemTemplateElement elem)
Add a child to the child list. NOTE: This presumes the child did not previously have a parent. Making that assumption makes this a less expensive operation -- but requires that if you *do* want to reparent a node, you use removeChild() first to remove it from its previous context. Failing to do so will damage the tree.

Parameters:
elem - Child to be added to child list
Returns:
Child just added to the child list

hasChildNodes

public boolean hasChildNodes()
Tell if there are child nodes.

Specified by:
hasChildNodes in interface org.w3c.dom.Node
Overrides:
hasChildNodes in class UnImplNode
Returns:
True if there are child nodes

getNodeType

public short getNodeType()
Get the type of the node.

Specified by:
getNodeType in interface org.w3c.dom.Node
Overrides:
getNodeType in class UnImplNode
Returns:
Constant for this node type

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Return the nodelist (same reference).

Specified by:
getChildNodes in interface org.w3c.dom.Node
Overrides:
getChildNodes in class UnImplNode
Returns:
The nodelist containing the child nodes (this)

removeChild

public ElemTemplateElement removeChild(ElemTemplateElement childETE)
Remove a child. ADDED 9/8/200 to support compilation. TODO: ***** Alternative is "removeMe() from my parent if any" ... which is less well checked, but more convenient in some cases. Given that we assume only experts are calling this class, it might be preferable. It's less DOMish, though.

Parameters:
childETE - The child to remove. This operation is a no-op if oldChild is not a child of this node.
Returns:
the removed child, or null if the specified node was not a child of this element.

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Replace the old child with a new child.

Specified by:
replaceChild in interface org.w3c.dom.Node
Overrides:
replaceChild in class UnImplNode
Parameters:
newChild - New child to replace with
oldChild - Old child to be replaced
Returns:
The new child
Throws:
org.w3c.dom.DOMException

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Unimplemented. See org.w3c.dom.Node

Specified by:
insertBefore in interface org.w3c.dom.Node
Overrides:
insertBefore in class UnImplNode
Parameters:
newChild - New child node to insert
refChild - Insert in front of this child
Returns:
null
Throws:
org.w3c.dom.DOMException

replaceChild

public ElemTemplateElement replaceChild(ElemTemplateElement newChildElem,
                                        ElemTemplateElement oldChildElem)
Replace the old child with a new child.

Parameters:
newChildElem - New child to replace with
oldChildElem - Old child to be replaced
Returns:
The new child
Throws:
org.w3c.dom.DOMException

getLength

public int getLength()
NodeList method: Count the immediate children of this node

Specified by:
getLength in interface org.w3c.dom.NodeList
Overrides:
getLength in class UnImplNode
Returns:
The count of children of this node

item

public org.w3c.dom.Node item(int index)
NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.

Specified by:
item in interface org.w3c.dom.NodeList
Overrides:
item in class UnImplNode
Parameters:
index - Index of child to find
Returns:
org.w3c.dom.Node: the child node at given index

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Get the stylesheet owner.

Specified by:
getOwnerDocument in interface org.w3c.dom.Node
Overrides:
getOwnerDocument in class UnImplNode
Returns:
The stylesheet owner

getOwnerXSLTemplate

public ElemTemplate getOwnerXSLTemplate()
Get the owning xsl:template element.

Returns:
The owning xsl:template element, this element if it is a xsl:template, or null if not found.

getTagName

public java.lang.String getTagName()
Return the element name.

Specified by:
getTagName in interface org.w3c.dom.Element
Overrides:
getTagName in class UnImplNode
Returns:
The element name

hasTextLitOnly

public boolean hasTextLitOnly()
Tell if this element only has one text child, for optimization purposes.

Returns:
true of this element only has one text literal child.

getBaseIdentifier

public java.lang.String getBaseIdentifier()
Return the base identifier.

Specified by:
getBaseIdentifier in interface PrefixResolver
Returns:
The base identifier

getEndLineNumber

public int getEndLineNumber()
Return the line number where the current document event ends. Note that this is the line position of the first character after the text associated with the document event.

Returns:
The line number, or -1 if none is available.
See Also:
getColumnNumber()

getLineNumber

public int getLineNumber()
Return the line number where the current document event ends. Note that this is the line position of the first character after the text associated with the document event.

Specified by:
getLineNumber in interface javax.xml.transform.SourceLocator
Returns:
The line number, or -1 if none is available.
See Also:
getColumnNumber()

getEndColumnNumber

public int getEndColumnNumber()
Return the column number where the current document event ends. Note that this is the column number of the first character after the text associated with the document event. The first column in a line is position 1.

Returns:
The column number, or -1 if none is available.
See Also:
getLineNumber()

getColumnNumber

public int getColumnNumber()
Return the column number where the current document event ends. Note that this is the column number of the first character after the text associated with the document event. The first column in a line is position 1.

Specified by:
getColumnNumber in interface javax.xml.transform.SourceLocator
Returns:
The column number, or -1 if none is available.
See Also:
getLineNumber()

getPublicId

public java.lang.String getPublicId()
Return the public identifier for the current document event.

This will be the public identifier

Specified by:
getPublicId in interface javax.xml.transform.SourceLocator
Returns:
A string containing the public identifier, or null if none is available.
See Also:
getSystemId()

getSystemId

public java.lang.String getSystemId()
Return the system identifier for the current document event.

If the system identifier is a URL, the parser must resolve it fully before passing it to the application.

Specified by:
getSystemId in interface javax.xml.transform.SourceLocator
Returns:
A string containing the system identifier, or null if none is available.
See Also:
getPublicId()

setLocaterInfo

public void setLocaterInfo(javax.xml.transform.SourceLocator locator)
Set the location information for this element.

Parameters:
locator - Source Locator with location information for this element

setEndLocaterInfo

public void setEndLocaterInfo(javax.xml.transform.SourceLocator locator)
Set the end location information for this element.

Parameters:
locator - Source Locator with location information for this element

hasVariableDecl

public boolean hasVariableDecl()

setXmlSpace

public void setXmlSpace(int v)
Set the "xml:space" attribute. A text node is preserved if an ancestor element of the text node has an xml:space attribute with a value of preserve, and no closer ancestor element has xml:space with a value of default.

Parameters:
v - Enumerated value, either Constants.ATTRVAL_PRESERVE or Constants.ATTRVAL_STRIP.
See Also:
strip in XSLT Specification, section-Creating-Text in XSLT Specification

getXmlSpace

public boolean getXmlSpace()
Get the "xml:space" attribute. A text node is preserved if an ancestor element of the text node has an xml:space attribute with a value of preserve, and no closer ancestor element has xml:space with a value of default.

Returns:
The value of the xml:space attribute
See Also:
strip in XSLT Specification, section-Creating-Text in XSLT Specification

getDeclaredPrefixes

public java.util.List getDeclaredPrefixes()
Return a table that contains all prefixes available within this element context.

Returns:
Vector containing the prefixes available within this element context

setPrefixes

public void setPrefixes(org.xml.sax.helpers.NamespaceSupport nsSupport)
                 throws javax.xml.transform.TransformerException
From the SAX2 helper class, set the namespace table for this element. Take care to call resolveInheritedNamespaceDecls. after all namespace declarations have been added.

Parameters:
nsSupport - non-null reference to NamespaceSupport from the ContentHandler.
Throws:
javax.xml.transform.TransformerException

setPrefixes

public void setPrefixes(org.xml.sax.helpers.NamespaceSupport nsSupport,
                        boolean excludeXSLDecl)
                 throws javax.xml.transform.TransformerException
Copy the namespace declarations from the NamespaceSupport object. Take care to call resolveInheritedNamespaceDecls. after all namespace declarations have been added.

Parameters:
nsSupport - non-null reference to NamespaceSupport from the ContentHandler.
excludeXSLDecl - true if XSLT namespaces should be ignored.
Throws:
javax.xml.transform.TransformerException

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix,
                                              org.w3c.dom.Node context)
Fullfill the PrefixResolver interface. Calling this for this class will throw an error.

Specified by:
getNamespaceForPrefix in interface PrefixResolver
Parameters:
prefix - The prefix to look up, which may be an empty string ("") for the default Namespace.
context - The node context from which to look up the URI.
Returns:
null if the error listener does not choose to throw an exception.

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix)
Given a namespace, get the corrisponding prefix. 9/15/00: This had been iteratively examining the m_declaredPrefixes field for this node and its parents. That makes life difficult for the compilation experiment, which doesn't have a static vector of local declarations. Replaced a recursive solution, which permits easier subclassing/overriding.

Specified by:
getNamespaceForPrefix in interface PrefixResolver
Parameters:
prefix - non-null reference to prefix string, which should map to a namespace URL.
Returns:
The namespace URL that the prefix maps to, or null if no mapping can be found.

getPrefixTable

java.util.List getPrefixTable()
Return a table that contains all prefixes available within this element context.

Returns:
reference to vector of XMLNSDecls, which may be null.

setPrefixTable

void setPrefixTable(java.util.List list)

containsExcludeResultPrefix

public boolean containsExcludeResultPrefix(java.lang.String prefix,
                                           java.lang.String uri)
Get whether or not the passed URL is contained flagged by the "extension-element-prefixes" property. This method is overridden by ElemLiteralResult.containsExcludeResultPrefix(java.lang.String, java.lang.String).

Parameters:
prefix - non-null reference to prefix that might be excluded.
Returns:
true if the prefix should normally be excluded.
See Also:
extension-element in XSLT Specification

excludeResultNSDecl

private boolean excludeResultNSDecl(java.lang.String prefix,
                                    java.lang.String uri)
                             throws javax.xml.transform.TransformerException
Tell if the result namespace decl should be excluded. Should be called before namespace aliasing (I think).

Parameters:
prefix - non-null reference to prefix.
uri - reference to namespace that prefix maps to, which is protected for null, but should really never be passed as null.
Returns:
true if the given namespace should be excluded.
Throws:
javax.xml.transform.TransformerException

resolvePrefixTables

public void resolvePrefixTables()
                         throws javax.xml.transform.TransformerException
Combine the parent's namespaces with this namespace for fast processing, taking care to reference the parent's namespace if this namespace adds nothing new. (Recursive method, walking the elements depth-first, processing parents before children). Note that this method builds m_prefixTable with aliased namespaces, *not* the original namespaces.

Throws:
javax.xml.transform.TransformerException

addOrReplaceDecls

void addOrReplaceDecls(XMLNSDecl newDecl)
Add or replace this namespace declaration in list of namespaces in scope for this element.

Parameters:
newDecl - namespace declaration to add to list

needToCheckExclude

boolean needToCheckExclude()
Return whether we need to check namespace prefixes against and exclude result prefixes list.


executeNSDecls

void executeNSDecls(TransformerImpl transformer)
              throws javax.xml.transform.TransformerException
Send startPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.

Parameters:
transformer - non-null reference to the the current transform-time state.
Throws:
javax.xml.transform.TransformerException

executeNSDecls

void executeNSDecls(TransformerImpl transformer,
                    java.lang.String ignorePrefix)
              throws javax.xml.transform.TransformerException
Send startPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.

Parameters:
transformer - non-null reference to the the current transform-time state.
ignorePrefix - string prefix to not startPrefixMapping
Throws:
javax.xml.transform.TransformerException

unexecuteNSDecls

void unexecuteNSDecls(TransformerImpl transformer)
                throws javax.xml.transform.TransformerException
Send endPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.

Parameters:
transformer - non-null reference to the the current transform-time state.
Throws:
javax.xml.transform.TransformerException

unexecuteNSDecls

void unexecuteNSDecls(TransformerImpl transformer,
                      java.lang.String ignorePrefix)
                throws javax.xml.transform.TransformerException
Send endPrefixMapping events to the result tree handler for all declared prefix mappings in the stylesheet.

Parameters:
transformer - non-null reference to the the current transform-time state.
ignorePrefix - string prefix to not endPrefixMapping
Throws:
javax.xml.transform.TransformerException

setUid

public void setUid(int i)
Set the UID (document order index).

Parameters:
i - Index of this child.

getUid

public int getUid()
Get the UID (document order index).

Returns:
Index of this child

getParentNode

public org.w3c.dom.Node getParentNode()
Get the parent as a Node.

Specified by:
getParentNode in interface org.w3c.dom.Node
Overrides:
getParentNode in class UnImplNode
Returns:
This node's parent node

getParentElem

public ElemTemplateElement getParentElem()
Get the parent as an ElemTemplateElement.

Returns:
This node's parent as an ElemTemplateElement

setParentElem

public void setParentElem(ElemTemplateElement p)
Set the parent as an ElemTemplateElement.

Parameters:
p - This node's parent as an ElemTemplateElement

getNextSibling

public org.w3c.dom.Node getNextSibling()
Get the next sibling (as a Node) or return null.

Specified by:
getNextSibling in interface org.w3c.dom.Node
Overrides:
getNextSibling in class UnImplNode
Returns:
this node's next sibling or null

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()
Get the previous sibling (as a Node) or return null. Note that this may be expensive if the parent has many kids; we accept that price in exchange for avoiding the prev pointer TODO: If we were sure parents and sibs are always ElemTemplateElements, we could hit the fields directly rather than thru accessors.

Specified by:
getPreviousSibling in interface org.w3c.dom.Node
Overrides:
getPreviousSibling in class UnImplNode
Returns:
This node's previous sibling or null

getPreviousSiblingElem

public ElemTemplateElement getPreviousSiblingElem()
Get the previous sibling (as a Node) or return null. Note that this may be expensive if the parent has many kids; we accept that price in exchange for avoiding the prev pointer TODO: If we were sure parents and sibs are always ElemTemplateElements, we could hit the fields directly rather than thru accessors.

Returns:
This node's previous sibling or null

getNextSiblingElem

public ElemTemplateElement getNextSiblingElem()
Get the next sibling (as a ElemTemplateElement) or return null.

Returns:
This node's next sibling (as a ElemTemplateElement) or null

getParentNodeElem

public ElemTemplateElement getParentNodeElem()
Get the parent element.

Returns:
This node's next parent (as a ElemTemplateElement) or null

getFirstChild

public org.w3c.dom.Node getFirstChild()
Get the first child as a Node.

Specified by:
getFirstChild in interface org.w3c.dom.Node
Overrides:
getFirstChild in class UnImplNode
Returns:
This node's first child or null

getFirstChildElem

public ElemTemplateElement getFirstChildElem()
Get the first child as a ElemTemplateElement.

Returns:
This node's first child (as a ElemTemplateElement) or null

getLastChild

public org.w3c.dom.Node getLastChild()
Get the last child.

Specified by:
getLastChild in interface org.w3c.dom.Node
Overrides:
getLastChild in class UnImplNode
Returns:
This node's last child

getLastChildElem

public ElemTemplateElement getLastChildElem()
Get the last child.

Returns:
This node's last child

getDOMBackPointer

public org.w3c.dom.Node getDOMBackPointer()
If this stylesheet was created from a DOM, get the DOM backpointer that this element originated from. For tooling use.

Returns:
DOM backpointer that this element originated from or null.

setDOMBackPointer

public void setDOMBackPointer(org.w3c.dom.Node n)
If this stylesheet was created from a DOM, set the DOM backpointer that this element originated from. For tooling use.

Parameters:
n - DOM backpointer that this element originated from.

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for precedence order. The order is determined by the getImportCountComposed() of the containing composed stylesheet and the getUid() of this element. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
o - The object to be compared to this object
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

shouldStripWhiteSpace

public boolean shouldStripWhiteSpace(XPathContext support,
                                     org.w3c.dom.Element targetElement)
                              throws javax.xml.transform.TransformerException
Get information about whether or not an element should strip whitespace.

Specified by:
shouldStripWhiteSpace in interface WhitespaceStrippingElementMatcher
Parameters:
support - The XPath runtime state.
targetElement - Element to check
Returns:
true if the whitespace should be stripped.
Throws:
javax.xml.transform.TransformerException
See Also:
strip in XSLT Specification

canStripWhiteSpace

public boolean canStripWhiteSpace()
Get information about whether or not whitespace can be stripped.

Specified by:
canStripWhiteSpace in interface WhitespaceStrippingElementMatcher
Returns:
true if the whitespace can be stripped.
See Also:
strip in XSLT Specification

canAcceptVariables

public boolean canAcceptVariables()
Tell if this element can accept variable declarations.

Returns:
true if the element can accept and process variable declarations.

exprSetParent

public void exprSetParent(ExpressionNode n)
Set the parent of this node.

Specified by:
exprSetParent in interface ExpressionNode
Parameters:
n - Must be a ElemTemplateElement.

exprGetParent

public ExpressionNode exprGetParent()
Get the ExpressionNode parent of this node.

Specified by:
exprGetParent in interface ExpressionNode

exprAddChild

public void exprAddChild(ExpressionNode n,
                         int i)
This method tells the node to add its argument to the node's list of children.

Specified by:
exprAddChild in interface ExpressionNode
Parameters:
n - Must be a ElemTemplateElement.

exprGetChild

public ExpressionNode exprGetChild(int i)
This method returns a child node. The children are numbered from zero, left to right.

Specified by:
exprGetChild in interface ExpressionNode

exprGetNumChildren

public int exprGetNumChildren()
Return the number of children the node has.

Specified by:
exprGetNumChildren in interface ExpressionNode

accept

protected boolean accept(XSLTVisitor visitor)
Accept a visitor and call the appropriate method for this class.

Parameters:
visitor - The visitor whose appropriate method will be called.
Returns:
true if the children of the object should be visited.

callVisitors

public void callVisitors(XSLTVisitor visitor)
Description copied from interface: XSLTVisitable
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

Specified by:
callVisitors in interface XSLTVisitable
Parameters:
visitor - The visitor whose appropriate method will be called.
See Also:
XSLTVisitable.callVisitors(XSLTVisitor)

callChildVisitors

protected void callChildVisitors(XSLTVisitor visitor,
                                 boolean callAttributes)
Call the children visitors.

Parameters:
visitor - The visitor whose appropriate method will be called.

callChildVisitors

protected void callChildVisitors(XSLTVisitor visitor)
Call the children visitors.

Parameters:
visitor - The visitor whose appropriate method will be called.

handlesNullPrefixes

public boolean handlesNullPrefixes()
Specified by:
handlesNullPrefixes in interface PrefixResolver
See Also:
PrefixResolver.handlesNullPrefixes()