00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALAN_ELEMFOREACH_HEADER_GUARD) 00017 #define XALAN_ELEMFOREACH_HEADER_GUARD 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include "XSLTDefinitions.hpp" 00023 00024 00025 00026 #include <xalanc/Include/XalanVector.hpp> 00027 00028 00029 00030 // Base class header file. 00031 #include "ElemTemplateElement.hpp" 00032 00033 00034 00035 #include <xalanc/XPath/NodeRefListBase.hpp> 00036 #include <xalanc/XPath/MutableNodeRefList.hpp> 00037 #include <xalanc/XPath/XObject.hpp> 00038 00039 00040 00041 #include "Constants.hpp" 00042 00043 00044 00045 XALAN_CPP_NAMESPACE_BEGIN 00046 00047 00048 00049 class ElemSort; 00050 class ElemTemplate; 00051 class NodeSorter; 00052 class XPath; 00053 00054 00055 00056 class ElemForEach: public ElemTemplateElement 00057 { 00058 public: 00059 00069 ElemForEach( 00070 StylesheetConstructionContext& constructionContext, 00071 Stylesheet& stylesheetTree, 00072 const AttributeListType& atts, 00073 int lineNumber, 00074 int columnNumber); 00075 00076 virtual 00077 ~ElemForEach(); 00078 00079 typedef XalanVector<ElemSort*> SortElemsVectorType; 00080 00081 // These methods are inherited from ElemTemplateElement ... 00082 00083 virtual const XalanDOMString& 00084 getElementName() const; 00085 00086 virtual void 00087 processSortElement( 00088 StylesheetConstructionContext& constructionContext, 00089 Stylesheet& theStylesheet, 00090 const AttributeListType& atts, 00091 const LocatorType* locator = 0); 00092 00093 virtual void 00094 postConstruction( 00095 StylesheetConstructionContext& constructionContext, 00096 const NamespacesHandler& theParentHandler); 00097 00098 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00099 virtual const ElemTemplateElement* 00100 startElement(StylesheetExecutionContext& executionContext) const; 00101 00102 virtual void 00103 endElement(StylesheetExecutionContext& executionContext) const; 00104 00105 virtual const ElemTemplateElement* 00106 getNextChildElemToExecute( 00107 StylesheetExecutionContext& executionContext, 00108 const ElemTemplateElement* currentElem) const; 00109 #else 00110 virtual void 00111 execute(StylesheetExecutionContext& executionContext) const; 00112 #endif 00113 00114 virtual const XPath* 00115 getXPath(unsigned int index = 0) const; 00116 00117 protected: 00118 00128 ElemForEach( 00129 StylesheetConstructionContext& constructionContext, 00130 Stylesheet& stylesheetTree, 00131 int lineNumber, 00132 int columnNumber, 00133 int xslToken); 00134 00135 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00136 00137 /* 00138 * Returns a pointer to a list of the selected nodes. The 00139 * nodes are sorted if required. 00140 * 00141 * @param executionContext context for executing this element 00142 * @return pointer to the list of selected (and sorted) nodes 00143 */ 00144 virtual const NodeRefListBase* 00145 createSelectedAndSortedNodeList( 00146 StylesheetExecutionContext& executionContext) const; 00147 00148 /* 00149 * Release any objects used to maintain the last selected 00150 * (and sorted) node list to be created 00151 * 00152 * @param executionContext context for executing this element 00153 */ 00154 virtual void 00155 releaseSelectedAndSortedNodeList( 00156 StylesheetExecutionContext& executionContext) const; 00157 00158 /* 00159 * Sorts a list of nodes 00160 * 00161 * @param executionContext context for executing this element 00162 * @param selectedNodeList list of nodes to be sorted 00163 * @param sortedNodeList list for sorted nodes 00164 * 00165 * @returns pointer to list of sorted nodes 00166 */ 00167 virtual const NodeRefListBase* 00168 sortChildren( 00169 StylesheetExecutionContext& executionContext, 00170 const NodeRefListBase& selectedNodeList, 00171 MutableNodeRefList& sortedNodeList) const; 00172 00173 #else 00174 00181 void 00182 transformSelectedChildren( 00183 StylesheetExecutionContext& executionContext, 00184 const ElemTemplateElement* theTemplate) const; 00185 00194 void 00195 transformSelectedChildren( 00196 StylesheetExecutionContext& executionContext, 00197 const ElemTemplateElement* theTemplate, 00198 const NodeRefListBase& sourceNodes, 00199 NodeRefListBase::size_type sourceNodesCount) const; 00200 00210 virtual void 00211 selectAndSortChildren( 00212 StylesheetExecutionContext& executionContext, 00213 const ElemTemplateElement* theTemplate, 00214 NodeSorter* sorter, 00215 int selectStackFrameIndex) const; 00216 #endif 00217 00218 const XPath* m_selectPattern; 00219 00220 private: 00221 00222 SortElemsVectorType m_sortElems; 00223 00224 SortElemsVectorType::size_type m_sortElemsCount; 00225 00226 }; 00227 00228 00229 00230 XALAN_CPP_NAMESPACE_END 00231 00232 00233 00234 #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.10 |
|