00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XALAN_ELEMFOREACH_HEADER_GUARD) 00019 #define XALAN_ELEMFOREACH_HEADER_GUARD 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include "XSLTDefinitions.hpp" 00025 00026 00027 00028 #include <xalanc/Include/XalanVector.hpp> 00029 00030 00031 00032 // Base class header file. 00033 #include "ElemTemplateElement.hpp" 00034 00035 00036 00037 #include <xalanc/XPath/NodeRefListBase.hpp> 00038 #include <xalanc/XPath/MutableNodeRefList.hpp> 00039 #include <xalanc/XPath/XObject.hpp> 00040 00041 00042 00043 #include "Constants.hpp" 00044 00045 00046 00047 XALAN_CPP_NAMESPACE_BEGIN 00048 00049 00050 00051 class ElemSort; 00052 class ElemTemplate; 00053 class NodeSorter; 00054 class XPath; 00055 00056 00057 00058 class ElemForEach: public ElemTemplateElement 00059 { 00060 public: 00061 00062 /** 00063 * Construct an object corresponding to an "xsl:for-each" element 00064 * 00065 * @param constructionContext context for construction of object 00066 * @param stylesheetTree stylesheet containing element 00067 * @param atts list of attributes for element 00068 * @param lineNumber line number in document 00069 * @param columnNumber column number in document 00070 */ 00071 ElemForEach( 00072 StylesheetConstructionContext& constructionContext, 00073 Stylesheet& stylesheetTree, 00074 const AttributeListType& atts, 00075 XalanFileLoc lineNumber, 00076 XalanFileLoc columnNumber); 00077 00078 virtual 00079 ~ElemForEach(); 00080 00081 typedef XalanVector<ElemSort*> SortElemsVectorType; 00082 00083 // These methods are inherited from ElemTemplateElement ... 00084 00085 virtual const XalanDOMString& 00086 getElementName() const; 00087 00088 virtual void 00089 processSortElement( 00090 StylesheetConstructionContext& constructionContext, 00091 Stylesheet& theStylesheet, 00092 const AttributeListType& atts, 00093 const Locator* locator = 0); 00094 00095 virtual void 00096 postConstruction( 00097 StylesheetConstructionContext& constructionContext, 00098 const NamespacesHandler& theParentHandler); 00099 00100 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00101 virtual const ElemTemplateElement* 00102 startElement(StylesheetExecutionContext& executionContext) const; 00103 00104 virtual void 00105 endElement(StylesheetExecutionContext& executionContext) const; 00106 00107 virtual const ElemTemplateElement* 00108 getNextChildElemToExecute( 00109 StylesheetExecutionContext& executionContext, 00110 const ElemTemplateElement* currentElem) const; 00111 #else 00112 virtual void 00113 execute(StylesheetExecutionContext& executionContext) const; 00114 #endif 00115 00116 virtual const XPath* 00117 getXPath(XalanSize_t index) const; 00118 00119 protected: 00120 00121 /** 00122 * Construct an object derived from ElemForEach 00123 * 00124 * @param constructionContext context for construction of object 00125 * @param stylesheetTree stylesheet containing element 00126 * @param lineNumber line number in document 00127 * @param columnNumber column number in document 00128 * @param xslToken an integer representing the type of instance. 00129 */ 00130 ElemForEach( 00131 StylesheetConstructionContext& constructionContext, 00132 Stylesheet& stylesheetTree, 00133 XalanFileLoc lineNumber, 00134 XalanFileLoc columnNumber, 00135 int xslToken); 00136 00137 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00138 00139 /* 00140 * Returns a pointer to a list of the selected nodes. The 00141 * nodes are sorted if required. 00142 * 00143 * @param executionContext context for executing this element 00144 * @return pointer to the list of selected (and sorted) nodes 00145 */ 00146 virtual const NodeRefListBase* 00147 createSelectedAndSortedNodeList( 00148 StylesheetExecutionContext& executionContext) const; 00149 00150 /* 00151 * Release any objects used to maintain the last selected 00152 * (and sorted) node list to be created 00153 * 00154 * @param executionContext context for executing this element 00155 */ 00156 virtual void 00157 releaseSelectedAndSortedNodeList( 00158 StylesheetExecutionContext& executionContext) const; 00159 00160 /* 00161 * Sorts a list of nodes 00162 * 00163 * @param executionContext context for executing this element 00164 * @param selectedNodeList list of nodes to be sorted 00165 * @param sortedNodeList list for sorted nodes 00166 * 00167 * @returns pointer to list of sorted nodes 00168 */ 00169 virtual const NodeRefListBase* 00170 sortChildren( 00171 StylesheetExecutionContext& executionContext, 00172 const NodeRefListBase& selectedNodeList, 00173 MutableNodeRefList& sortedNodeList) const; 00174 00175 #else 00176 /** 00177 * Perform a query if needed, and call transformChild for each child. 00178 * 00179 * @param executionContext The current execution context 00180 * @param template The owning template context. 00181 * @param sourceNodeContext The current source node context. 00182 */ 00183 void 00184 transformSelectedChildren( 00185 StylesheetExecutionContext& executionContext, 00186 const ElemTemplateElement* theTemplate) const; 00187 00188 /** 00189 * Perform a query if needed, and call transformChild for each child. 00190 * 00191 * @param executionContext The current execution context 00192 * @param theTemplate The owning template context. 00193 * @param sourceNodes The source nodes to transform. 00194 * @param sourceNodesCount The count of source nodes to transform. 00195 */ 00196 void 00197 transformSelectedChildren( 00198 StylesheetExecutionContext& executionContext, 00199 const ElemTemplateElement* theTemplate, 00200 const NodeRefListBase& sourceNodes, 00201 NodeRefListBase::size_type sourceNodesCount) const; 00202 00203 /** 00204 * Perform a query if needed, and call transformChild for each child. 00205 * 00206 * @param executionContext The current execution context 00207 * @param template The owning template context. 00208 * @param sorter The NodeSorter instance, if any. 00209 * @param selectStackFrameIndex stack frame context for executing the 00210 * select statement 00211 */ 00212 virtual void 00213 selectAndSortChildren( 00214 StylesheetExecutionContext& executionContext, 00215 const ElemTemplateElement* theTemplate, 00216 NodeSorter* sorter, 00217 int selectStackFrameIndex) const; 00218 #endif 00219 00220 const XPath* m_selectPattern; 00221 00222 private: 00223 00224 SortElemsVectorType m_sortElems; 00225 00226 SortElemsVectorType::size_type m_sortElemsCount; 00227 00228 }; 00229 00230 00231 00232 XALAN_CPP_NAMESPACE_END 00233 00234 00235 00236 #endif // XALAN_ELEMFOREACH_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|