org.apache.xalan.templates
Class ElemTemplate

java.lang.Object
  extended byorg.apache.xml.utils.UnImplNode
      extended byorg.apache.xalan.templates.ElemTemplateElement
          extended byorg.apache.xalan.templates.ElemTemplate
All Implemented Interfaces:
org.w3c.dom.Document, org.w3c.dom.Element, ExpressionNode, org.w3c.dom.Node, org.w3c.dom.NodeList, PrefixResolver, Serializable, javax.xml.transform.SourceLocator, WhitespaceStrippingElementMatcher, XSLTVisitable
Direct Known Subclasses:
ElemExsltFunction, WhiteSpaceInfo

public class ElemTemplate
extends ElemTemplateElement

Implement xsl:template.

 

 
 

See Also:
section-Defining-Template-Rules in XSLT Specification, Serialized Form

Field Summary
private  int[] m_argsQNameIDs
          List of namespace/local-name pairs, DTM style, that are unique qname identifiers for the arguments.
 int m_frameSize
          The stack frame size for this template, which is equal to the maximum number of params and variables that can be declared in the template at one time.
(package private)  int m_inArgsSize
          The size of the portion of the stack frame that can hold parameter arguments.
private  XPath m_matchPattern
          The match attribute is a Pattern that identifies the source node or nodes to which the rule applies.
private  QName m_mode
          Modes allow an element to be processed multiple times, each time producing a different result.
private  QName m_name
          An xsl:template element with a name attribute specifies a named template.
private  double m_priority
          The priority of a template rule is specified by the priority attribute on the template rule.
private  String m_publicId
          The public identifier for the current document event.
private  Stylesheet m_stylesheet
          The owning stylesheet.
private  String m_systemId
          The system identifier for the current document event.
 
Fields inherited from class org.apache.xalan.templates.ElemTemplateElement
m_docOrderNumber, m_firstChild, m_hasVariableDecl, m_nextSibling, m_parentNode, m_prefixTable
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
ElemTemplate()
           
 
Method Summary
 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.
 void endCompose(StylesheetRoot sroot)
          This after the template's children have been composed.
 void execute(TransformerImpl transformer)
          Copy the template contents into the result tree.
 XPath getMatch()
          Get the "match" attribute.
 QName getMode()
          Get the "mode" attribute.
 QName getName()
          Get the "name" attribute.
 String getNodeName()
          Return the node name.
 double getPriority()
          Get the "priority" attribute.
 String getPublicId()
          Return the public identifier for the current document event.
 Stylesheet getStylesheet()
          Get the owning stylesheet.
 StylesheetComposed getStylesheetComposed()
          Get the stylesheet composed (resolves includes and imports and has methods on it that return "composed" properties.
 StylesheetRoot getStylesheetRoot()
          Get the root stylesheet.
 String getSystemId()
          Return the system identifier for the current document event.
 int getXSLToken()
          Get an int constant identifying the type of element.
 void recompose(StylesheetRoot root)
          This function is called during recomposition to control how this element is composed.
 void setLocaterInfo(javax.xml.transform.SourceLocator locator)
          Set the location information for this element.
 void setMatch(XPath v)
          Set the "match" attribute.
 void setMode(QName v)
          Set the "mode" attribute.
 void setName(QName v)
          Set the "name" attribute.
 void setPriority(double v)
          Set the "priority" attribute.
 void setStylesheet(Stylesheet sheet)
          Set the owning stylesheet.
 
Methods inherited from class org.apache.xalan.templates.ElemTemplateElement
accept, addOrReplaceDecls, appendChild, appendChild, callChildVisitors, callChildVisitors, callVisitors, canAcceptVariables, canStripWhiteSpace, compareTo, containsExcludeResultPrefix, error, error, executeNSDecls, executeNSDecls, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getBaseIdentifier, getChildNodes, getColumnNumber, getDeclaredPrefixes, getDOMBackPointer, getFirstChild, getFirstChildElem, getLastChild, getLastChildElem, getLength, getLineNumber, getLocalName, getNamespaceForPrefix, getNamespaceForPrefix, getNextSibling, getNextSiblingElem, getNodeType, getOwnerDocument, getOwnerXSLTemplate, getParentElem, getParentNode, getParentNodeElem, getPrefixes, getPreviousSibling, getPreviousSiblingElem, getTagName, getUid, getXmlSpace, handlesNullPrefixes, hasChildNodes, hasTextLitOnly, hasVariableDecl, insertBefore, isCompiledTemplate, isValidNCName, item, needToCheckExclude, removeChild, replaceChild, replaceChild, resolvePrefixTables, runtimeInit, setDOMBackPointer, setParentElem, setPrefixes, setPrefixes, setUid, setXmlSpace, shouldStripWhiteSpace, unexecuteNSDecls, unexecuteNSDecls
 
Methods inherited from class org.apache.xml.utils.UnImplNode
adoptNode, appendData, cloneNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getEncoding, getImplementation, getNamespaceURI, getNodeValue, getOwnerElement, getPrefix, getSpecified, getStandalone, getStrictErrorChecking, getVersion, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertData, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceData, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setEncoding, setNodeValue, setPrefix, setStandalone, setStrictErrorChecking, setValue, setVersion, splitText, substringData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_publicId

private String m_publicId
The public identifier for the current document event.


m_systemId

private String m_systemId
The system identifier for the current document event.


m_stylesheet

private Stylesheet m_stylesheet
The owning stylesheet. (Should this only be put on the template element, to conserve space?)


m_matchPattern

private XPath m_matchPattern
The match attribute is a Pattern that identifies the source node or nodes to which the rule applies.


m_name

private QName m_name
An xsl:template element with a name attribute specifies a named template.


m_mode

private QName m_mode
Modes allow an element to be processed multiple times, each time producing a different result.


m_priority

private double m_priority
The priority of a template rule is specified by the priority attribute on the template rule.


m_frameSize

public int m_frameSize
The stack frame size for this template, which is equal to the maximum number of params and variables that can be declared in the template at one time.


m_inArgsSize

int m_inArgsSize
The size of the portion of the stack frame that can hold parameter arguments.


m_argsQNameIDs

private int[] m_argsQNameIDs
List of namespace/local-name pairs, DTM style, that are unique qname identifiers for the arguments. The position of a given qname in the list is the argument ID, and thus the position in the stack frame.

Constructor Detail

ElemTemplate

public ElemTemplate()
Method Detail

getPublicId

public 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
Overrides:
getPublicId in class ElemTemplateElement
Returns:
A string containing the public identifier, or null if none is available.
See Also:
getSystemId()

getSystemId

public 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
Overrides:
getSystemId in class ElemTemplateElement
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.

Overrides:
setLocaterInfo in class ElemTemplateElement
Parameters:
locator - SourceLocator holding location information

getStylesheetComposed

public StylesheetComposed getStylesheetComposed()
Get the stylesheet composed (resolves includes and imports and has methods on it that return "composed" properties.

Overrides:
getStylesheetComposed in class ElemTemplateElement
Returns:
The stylesheet composed.

getStylesheet

public Stylesheet getStylesheet()
Get the owning stylesheet.

Overrides:
getStylesheet in class ElemTemplateElement
Returns:
The owning stylesheet.

setStylesheet

public void setStylesheet(Stylesheet sheet)
Set the owning stylesheet.

Parameters:
sheet - The owning stylesheet for this element

getStylesheetRoot

public StylesheetRoot getStylesheetRoot()
Get the root stylesheet.

Overrides:
getStylesheetRoot in class ElemTemplateElement
Returns:
The root stylesheet for this element

setMatch

public void setMatch(XPath v)
Set the "match" attribute. The match attribute is a Pattern that identifies the source node or nodes to which the rule applies. The match attribute is required unless the xsl:template element has a name attribute (see [6 Named Templates]). It is an error for the value of the match attribute to contain a VariableReference.

Parameters:
v - Value to set for the "match" attribute
See Also:
patterns in XSLT Specification

getMatch

public XPath getMatch()
Get the "match" attribute. The match attribute is a Pattern that identifies the source node or nodes to which the rule applies. The match attribute is required unless the xsl:template element has a name attribute (see [6 Named Templates]). It is an error for the value of the match attribute to contain a VariableReference.

Returns:
Value of the "match" attribute
See Also:
patterns in XSLT Specification

setName

public void setName(QName v)
Set the "name" attribute. An xsl:template element with a name attribute specifies a named template. If an xsl:template element has a name attribute, it may, but need not, also have a match attribute.

Parameters:
v - Value to set the "name" attribute
See Also:
named-templates in XSLT Specification

getName

public QName getName()
Get the "name" attribute. An xsl:template element with a name attribute specifies a named template. If an xsl:template element has a name attribute, it may, but need not, also have a match attribute.

Returns:
Value of the "name" attribute
See Also:
named-templates in XSLT Specification

setMode

public void setMode(QName v)
Set the "mode" attribute. Modes allow an element to be processed multiple times, each time producing a different result. If xsl:template does not have a match attribute, it must not have a mode attribute.

Parameters:
v - Value to set the "mode" attribute
See Also:
modes in XSLT Specification

getMode

public QName getMode()
Get the "mode" attribute. Modes allow an element to be processed multiple times, each time producing a different result. If xsl:template does not have a match attribute, it must not have a mode attribute.

Returns:
Value of the "mode" attribute
See Also:
modes in XSLT Specification

setPriority

public void setPriority(double v)
Set the "priority" attribute. The priority of a template rule is specified by the priority attribute on the template rule. The value of this must be a real number (positive or negative), matching the production Number with an optional leading minus sign (-).

Parameters:
v - The value to set for the "priority" attribute
See Also:
conflict in XSLT Specification

getPriority

public double getPriority()
Get the "priority" attribute. The priority of a template rule is specified by the priority attribute on the template rule. The value of this must be a real number (positive or negative), matching the production Number with an optional leading minus sign (-).

Returns:
The value of the "priority" attribute
See Also:
conflict in XSLT Specification

getXSLToken

public int getXSLToken()
Get an int constant identifying the type of element.

Overrides:
getXSLToken in class ElemTemplateElement
Returns:
The token ID for the element
See Also:
Constants

getNodeName

public String getNodeName()
Return the node name.

Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in class ElemTemplateElement
Returns:
The element's name

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.

Overrides:
compose in class ElemTemplateElement
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.

Overrides:
endCompose in class ElemTemplateElement
Throws:
javax.xml.transform.TransformerException

execute

public void execute(TransformerImpl transformer)
             throws javax.xml.transform.TransformerException
Copy the template contents into the result tree. The content of the xsl:template element is the template that is instantiated when the template rule is applied.

Overrides:
execute in class ElemTemplateElement
Parameters:
transformer - non-null reference to the the current transform-time state.
Throws:
javax.xml.transform.TransformerException

recompose

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

Overrides:
recompose in class ElemTemplateElement
Parameters:
root - The root stylesheet for this transformation.