Package org.apache.xalan.templates
Class ElemForEach
java.lang.Object
org.apache.xml.utils.UnImplNode
org.apache.xalan.templates.ElemTemplateElement
org.apache.xalan.templates.ElemForEach
- All Implemented Interfaces:
Serializable,SourceLocator,XSLTVisitable,PrefixResolver,ExpressionNode,ExpressionOwner,WhitespaceStrippingElementMatcher,Document,Element,Node,NodeList
- Direct Known Subclasses:
ElemCallTemplate
public class ElemForEach extends ElemTemplateElement implements ExpressionOwner
Implement xsl:for-each.
- See Also:
- for-each in XSLT Specification, Serialized Form
-
Field Summary
Fields Modifier and Type Field Description booleanm_doc_cache_offThis is set by an "xalan-doc-cache-off" pi, or the old "xalan:doc-cache-off" pi.protected Expressionm_selectExpressionThe "select" expression.protected Vectorm_sortElemsVector containing the xsl:sort elements associated with this element.protected XPathm_xpathUsed to fix bug#16889 Store XPath away for later processing.Fields inherited from class org.apache.xalan.templates.ElemTemplateElement
m_docOrderNumber, m_hasVariableDecl, m_parentNodeFields inherited from class org.apache.xml.utils.UnImplNode
actualEncoding, fDocumentURIFields 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
Constructors Constructor Description ElemForEach()Construct a element representing xsl:for-each. -
Method Summary
Modifier and Type Method Description ElemTemplateElementappendChild(ElemTemplateElement newChild)Add a child to the child list.voidcallChildVisitors(XSLTVisitor visitor, boolean callAttributes)Call the children visitors.voidcompose(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.voidendCompose(StylesheetRoot sroot)This after the template's children have been composed.voidexecute(TransformerImpl transformer)Execute the xsl:for-each transformationExpressiongetExpression()Get the raw Expression object that this class wraps.StringgetNodeName()Return the node name.ExpressiongetSelect()Get the "select" attribute.ElemSortgetSortElem(int i)Get a xsl:sort element associated with this element.intgetSortElemCount()Get the count xsl:sort elements associated with this element.protected ElemTemplateElementgetTemplateMatch()Get template element associated with thisintgetXSLToken()Get an int constant identifying the type of element.voidsetExpression(Expression exp)Set the raw expression object for this object.voidsetSelect(XPath xpath)Set the "select" attribute.voidsetSortElem(ElemSort sortElem)Set a xsl:sort element associated with this element.DTMIteratorsortNodes(XPathContext xctxt, Vector keys, DTMIterator sourceNodes)Sort given nodesvoidtransformSelectedNodes(TransformerImpl transformer)Perform a query if needed, and call transformNode for each child.Methods inherited from class org.apache.xalan.templates.ElemTemplateElement
accept, appendChild, callChildVisitors, callVisitors, canAcceptVariables, canStripWhiteSpace, compareTo, containsExcludeResultPrefix, error, error, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getBaseIdentifier, getChildNodes, getColumnNumber, getDeclaredPrefixes, getDOMBackPointer, getEndColumnNumber, getEndLineNumber, getFirstChild, getFirstChildElem, getLastChild, getLastChildElem, getLength, getLineNumber, getLocalName, getNamespaceForPrefix, getNamespaceForPrefix, getNextSibling, getNextSiblingElem, getNodeType, getOwnerDocument, getOwnerXSLTemplate, getParentElem, getParentNode, getParentNodeElem, getPreviousSibling, getPreviousSiblingElem, getPublicId, getStylesheet, getStylesheetComposed, getStylesheetRoot, getSystemId, getTagName, getUid, getXmlSpace, handlesNullPrefixes, hasChildNodes, hasTextLitOnly, hasVariableDecl, insertBefore, isCompiledTemplate, item, recompose, removeChild, replaceChild, replaceChild, resolvePrefixTables, runtimeInit, setDOMBackPointer, setEndLocaterInfo, setLocaterInfo, setParentElem, setPrefixes, setPrefixes, setUid, setXmlSpace, shouldStripWhiteSpaceMethods 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
-
Field Details
-
m_doc_cache_off
public boolean m_doc_cache_offThis is set by an "xalan-doc-cache-off" pi, or the old "xalan:doc-cache-off" pi. The old form of the PI only works for XML parsers that are not namespace aware. It tells the engine that documents created in the location paths executed by this element will not be reparsed. It's set by StylesheetHandler during construction. Note that this feature applies _only_ to xsl:for-each elements in its current incarnation; a more general cache management solution is desperately needed. -
m_selectExpression
The "select" expression. -
m_xpath
Used to fix bug#16889 Store XPath away for later processing. -
m_sortElems
Vector containing the xsl:sort elements associated with this element.
-
-
Constructor Details
-
ElemForEach
public ElemForEach()Construct a element representing xsl:for-each.
-
-
Method Details
-
setSelect
Set the "select" attribute.- Parameters:
xpath- The XPath expression for the "select" attribute.
-
getSelect
Get the "select" attribute.- Returns:
- The XPath expression for the "select" attribute.
-
compose
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. NEEDSDOC @param sroot- Overrides:
composein classElemTemplateElement- Throws:
TransformerException
-
endCompose
This after the template's children have been composed.- Overrides:
endComposein classElemTemplateElement- Throws:
TransformerException
-
getSortElemCount
public int getSortElemCount()Get the count xsl:sort elements associated with this element.- Returns:
- The number of xsl:sort elements.
-
getSortElem
Get a xsl:sort element associated with this element.- Parameters:
i- Index of xsl:sort element to get- Returns:
- xsl:sort element at given index
-
setSortElem
Set a xsl:sort element associated with this element.- Parameters:
sortElem- xsl:sort element to set
-
getXSLToken
public int getXSLToken()Get an int constant identifying the type of element.- Overrides:
getXSLTokenin classElemTemplateElement- Returns:
- The token ID for this element
- See Also:
Constants
-
getNodeName
Return the node name.- Specified by:
getNodeNamein interfaceNode- Overrides:
getNodeNamein classElemTemplateElement- Returns:
- The element's name
-
execute
Execute the xsl:for-each transformation- Overrides:
executein classElemTemplateElement- Parameters:
transformer- non-null reference to the the current transform-time state.- Throws:
TransformerException
-
getTemplateMatch
Get template element associated with this- Returns:
- template element associated with this (itself)
-
sortNodes
public DTMIterator sortNodes(XPathContext xctxt, Vector keys, DTMIterator sourceNodes) throws TransformerExceptionSort given nodes- Parameters:
xctxt- The XPath runtime state for the sort.keys- Vector of sort keyxsourceNodes- Iterator of nodes to sort- Returns:
- iterator of sorted nodes
- Throws:
TransformerException
-
transformSelectedNodes
Perform a query if needed, and call transformNode for each child.- Parameters:
transformer- non-null reference to the the current transform-time state.- Throws:
TransformerException- Thrown in a variety of circumstances.
-
appendChild
Add a child to the child list.- Overrides:
appendChildin classElemTemplateElement- Parameters:
newChild- Child to add to child list- Returns:
- Child just added to child list
-
callChildVisitors
Call the children visitors.- Overrides:
callChildVisitorsin classElemTemplateElement- Parameters:
visitor- The visitor whose appropriate method will be called.
-
getExpression
Description copied from interface:ExpressionOwnerGet the raw Expression object that this class wraps.- Specified by:
getExpressionin interfaceExpressionOwner- Returns:
- the raw Expression object, which should not normally be null.
- See Also:
ExpressionOwner.getExpression()
-
setExpression
Description copied from interface:ExpressionOwnerSet the raw expression object for this object.- Specified by:
setExpressionin interfaceExpressionOwner- Parameters:
exp- the raw Expression object, which should not normally be null.- See Also:
ExpressionOwner.setExpression(Expression)
-