Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 6.0sp2 API Reference

## weblogic.apache.xalan.xslt
Class ElemTemplateElement

    java.lang.Object
      |
      +--weblogic.apache.xalan.xslt.UnImplNode
            |
            +--weblogic.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 UnImplNode
implements PrefixResolver, java.io.Serializable, NodeCallback

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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Author:
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `Stylesheet`, Serialized Form

Field Summary
`int` | `m_columnNumber` The columnOffset where the element occurs in the xsl file.
`boolean` | `m_defaultSpace` Tell if this element has the default space handling turned off or on according to the xml:space attribute.
`java.lang.String` | `m_elemName` The name of the element.
`protected StringToStringTable` | `m_excludedNamespaces` The table of namespaces that are excluded from being used in the result tree but which need to be used in to resolve prefixes.
`boolean` | `m_finishedConstruction` Tell if we've finished construction.
`protected ElemTemplateElement` | `m_firstChild` First child.
`int` | `m_lineNumber` The line number where the element occurs in the xsl file.
`protected StringToStringTable` | `m_namespaces` The table of namespaces that can be used in the result tree.
`ElemTemplateElement` | `m_parentNode` Parent node.
`Stylesheet` | `m_stylesheet` The owning stylesheet.

Constructor Summary
`ElemTemplateElement(XSLTEngineImpl processor, Stylesheet stylesheetTree, java.lang.String name, org.xml.sax.AttributeList atts, int lineNumber, int columnNumber)` Construct a template element instance.

Method Summary
`org.w3c.dom.Node` | `appendChild(org.w3c.dom.Node newChild)` 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)` Take the contents of a template element, process it, and convert it to a string.
`void` | `error(int msg, java.lang.Object[] args)` Throw a template element runtime error.
`void` | `execute(XSLTEngineImpl processor, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNode, QName mode)` Execute the element's primary function.
`void` | `executeChildren(XSLTEngineImpl processor, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNode, QName mode)` Process the children of a template.
`java.lang.String` | `getBaseIdentifier()` Return the base identifier.
`org.w3c.dom.NodeList` | `getChildNodes()` Return the nodelist (same reference).
`org.w3c.dom.Node` | `getFirstChild()` Get the first child
`org.w3c.dom.Node` | `getLastChild()` Get the last child.
`int` | `getLength()` NodeList method: Count the immediate children of this node
`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)` Given a namespace, get the corrisponding prefix.
`org.w3c.dom.Node` | `getNextSibling()` Get the next sibling 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.
`org.w3c.dom.Node` | `getParentNode()` Get the parent.
`java.lang.String` | `getTagName()` Return the element name.
`int` | `getXSLToken()` Get an integer representation of the element type.
`boolean` | `hasChildNodes()` Tell if there are child nodes.
`static boolean` | `isSpace(char ch)` Returns whether the specified ch conforms to the XML 1.0 definition of whitespace.
`boolean` | `isWhiteSpace(java.lang.String string)` Tell if the string is whitespace.
`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.
`void` | `processLocatedNode(XPathSupport execContext, org.w3c.dom.Node sourceNode, java.lang.Object callbackInfo)` Implementation of NodeCallback interface.
`protected StringToStringTable` | `processPrefixControl(java.lang.String localName, java.lang.String attrValue, StringToStringTable excludeResultPrefixes)` Process the exclude-result-prefixes or the extension-element-prefixes attributes, for the purpose of prefix exclusion.
`protected boolean` | `shouldExcludeResultNamespaceNode(ElemTemplateElement elem, java.lang.String prefix, java.lang.String uri)` Tell if the result namespace decl should be excluded.
`protected void` | `transformSelectedChildren(Stylesheet stylesheetTree, ElemTemplateElement xslInstruction, ElemTemplateElement template, org.w3c.dom.Node sourceTree, org.w3c.dom.Node sourceNodeContext, QName mode, XPath selectPattern, int xslToken, XSLTEngineImpl tcontext, int selectStackFrameIndex)` Perform a query if needed, and call transformChild for each child.

Methods inherited from class weblogic.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
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_stylesheet

    public Stylesheet m_stylesheet

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

### m_lineNumber

    public int m_lineNumber

  The line number where the element occurs in the xsl file.

### m_columnNumber

    public int m_columnNumber

  The columnOffset where the element occurs in the xsl file.

### m_defaultSpace

    public boolean m_defaultSpace

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

### m_namespaces

    protected StringToStringTable m_namespaces

  The table of namespaces that can be used in the result tree.

### m_excludedNamespaces

    protected StringToStringTable m_excludedNamespaces

  The table of namespaces that are excluded from being used in the result tree but which need to be used in to resolve prefixes.

### m_finishedConstruction

    public boolean m_finishedConstruction

  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

  The name of the element.

### m_parentNode

    public ElemTemplateElement m_parentNode

  Parent node.

### m_firstChild

    protected ElemTemplateElement m_firstChild

  First child.

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

  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)

  Given a namespace, get the corrisponding prefix.
  Specified by:
    getNamespaceForPrefix in interface PrefixResolver

### getNamespaceForPrefix

    public java.lang.String getNamespaceForPrefix(java.lang.String prefix)

  Given a namespace, get the corrisponding prefix.
  Specified by:
    getNamespaceForPrefix in interface PrefixResolver

### processPrefixControl

    protected StringToStringTable processPrefixControl(java.lang.String localName,
                                                       java.lang.String attrValue,
                                                       StringToStringTable excludeResultPrefixes)
                                                throws org.xml.sax.SAXException

  Process the exclude-result-prefixes or the extension-element-prefixes attributes, for the purpose of prefix exclusion.

### shouldExcludeResultNamespaceNode

    protected boolean shouldExcludeResultNamespaceNode(ElemTemplateElement elem,
                                                       java.lang.String prefix,
                                                       java.lang.String uri)
                                                throws org.xml.sax.SAXException

  Tell if the result namespace decl should be excluded. Should be called before namespace aliasing (I think). TODO: I believe this contains a bug, in that included elements will check with with their including stylesheet, since in this implementation right now the included templates are merged with the including stylesheet. The XSLT Recommendation says: "The designation of a namespace as an excluded namespace is effective within the subtree of the stylesheet rooted at the element bearing the `exclude-result-prefixes` or `xsl:exclude-result-prefixes` attribute; a subtree rooted at an `xsl:stylesheet` element does not include any stylesheets imported or included by children of that `xsl:stylesheet` element."

### 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

  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

  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

  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()

  Get an integer representation of the element type.

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

### transformSelectedChildren

    protected void transformSelectedChildren(Stylesheet stylesheetTree,
                                             ElemTemplateElement xslInstruction,
                                             ElemTemplateElement template,
                                             org.w3c.dom.Node sourceTree,
                                             org.w3c.dom.Node sourceNodeContext,
                                             QName mode,
                                             XPath selectPattern,
                                             int xslToken,
                                             XSLTEngineImpl tcontext,
                                             int selectStackFrameIndex)
                                      throws XSLProcessorException,
                                             java.net.MalformedURLException,
                                             java.io.FileNotFoundException,
                                             java.io.IOException,
                                             org.xml.sax.SAXException

  Perform a query if needed, and call transformChild for each child.

  Parameters:
    `stylesheetTree` - The owning stylesheet tree.
    `xslInstruction` - The stylesheet element context (depricated -- I do not think we need this).
    `template` - The owning template context.
    `sourceTree` - The input source tree.
    `sourceNodeContext` - The current source node context.
    `mode` - The current mode.
    `selectPattern` - The XPath with which to perform the selection.
    `xslToken` - The current XSLT instruction (depricated -- I do not think we want this).
    `tcontext` - The XSLTEngineImpl context.
    `selectStackFrameIndex` - The stack frame context for executing the select statement.
  Throws:
    XSLProcessorException - Thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.
    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 - Thrown in a variety of circumstances.

### isSpace

    public static boolean isSpace(char ch)

  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)

  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

  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)

  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

  Add a child to the child list.

  Parameters:
    `newChild` -
  Throws:
    org.w3c.dom.DOMException -
  Overrides:
    appendChild in class UnImplNode

### hasChildNodes

    public boolean hasChildNodes()

  Tell if there are child nodes.

  Overrides:
    hasChildNodes in class UnImplNode

### getNodeType

    public short getNodeType()

  Get the type of the node.

  Overrides:
    getNodeType in class UnImplNode

### getParentNode

    public org.w3c.dom.Node getParentNode()

  Get the parent.

  Overrides:
    getParentNode in class UnImplNode

### getChildNodes

    public org.w3c.dom.NodeList getChildNodes()

  Return the nodelist (same reference).

  Overrides:
    getChildNodes in class UnImplNode

### getFirstChild

    public org.w3c.dom.Node getFirstChild()

  Get the first child

  Overrides:
    getFirstChild in class UnImplNode

### getLastChild

    public org.w3c.dom.Node getLastChild()

  Get the last child.

  Overrides:
    getLastChild in class UnImplNode

### getNextSibling

    public org.w3c.dom.Node getNextSibling()

  Get the next sibling or return null.

  Overrides:
    getNextSibling in class UnImplNode

### getLength

    public int getLength()

  NodeList method: Count the immediate children of this node

  Returns:
    int
  Overrides:
    getLength in class UnImplNode

### 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.

  Parameters:
    `index` -
  Returns:
    org.w3c.dom.Node
  Overrides:
    item in class UnImplNode

### getOwnerDocument

    public org.w3c.dom.Document getOwnerDocument()

  Get the stylesheet owner.

  Overrides:
    getOwnerDocument in class UnImplNode

### getTagName

    public java.lang.String getTagName()

  Return the element name.

  Overrides:
    getTagName in class UnImplNode

### getNodeName

    public java.lang.String getNodeName()

  Return the node name.

  Overrides:
    getNodeName in class UnImplNode

### getBaseIdentifier

    public java.lang.String getBaseIdentifier()

  Return the base identifier.
  Specified by:
    getBaseIdentifier in interface PrefixResolver

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs60
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD