Xalan-C++ API Reference 1.12.0
ElemForEach.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XALAN_ELEMFOREACH_HEADER_GUARD)
19#define XALAN_ELEMFOREACH_HEADER_GUARD
20
21
22
23// Base include file. Must be first.
24#include "XSLTDefinitions.hpp"
25
26
27
29
30
31
32// Base class header file.
34
35
36
40
41
42
43#include "Constants.hpp"
44
45
46
47namespace XALAN_CPP_NAMESPACE {
48
49
50
51class ElemSort;
52class ElemTemplate;
53class NodeSorter;
54class XPath;
55
56
57
59{
60public:
61
62 /**
63 * Construct an object corresponding to an "xsl:for-each" element
64 *
65 * @param constructionContext context for construction of object
66 * @param stylesheetTree stylesheet containing element
67 * @param atts list of attributes for element
68 * @param lineNumber line number in document
69 * @param columnNumber column number in document
70 */
77
78 virtual
80
82
83 // These methods are inherited from ElemTemplateElement ...
84
85 virtual const XalanDOMString&
87
88 virtual void
93 const Locator* locator = 0);
94
95 virtual void
99
100#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
101 virtual const ElemTemplateElement*
103
104 virtual void
106
107 virtual const ElemTemplateElement*
110 const ElemTemplateElement* currentElem) const;
111#else
112 virtual void
114#endif
115
116 virtual const XPath*
117 getXPath(XalanSize_t index) const;
118
119protected:
120
121 /**
122 * Construct an object derived from ElemForEach
123 *
124 * @param constructionContext context for construction of object
125 * @param stylesheetTree stylesheet containing element
126 * @param lineNumber line number in document
127 * @param columnNumber column number in document
128 * @param xslToken an integer representing the type of instance.
129 */
135 int xslToken);
136
137#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
138
139 /*
140 * Returns a pointer to a list of the selected nodes. The
141 * nodes are sorted if required.
142 *
143 * @param executionContext context for executing this element
144 * @return pointer to the list of selected (and sorted) nodes
145 */
146 virtual const NodeRefListBase*
149
150 /*
151 * Release any objects used to maintain the last selected
152 * (and sorted) node list to be created
153 *
154 * @param executionContext context for executing this element
155 */
156 virtual void
159
160 /*
161 * Sorts a list of nodes
162 *
163 * @param executionContext context for executing this element
164 * @param selectedNodeList list of nodes to be sorted
165 * @param sortedNodeList list for sorted nodes
166 *
167 * @returns pointer to list of sorted nodes
168 */
169 virtual const NodeRefListBase*
174
175#else
176 /**
177 * Perform a query if needed, and call transformChild for each child.
178 *
179 * @param executionContext The current execution context
180 * @param template The owning template context.
181 * @param sourceNodeContext The current source node context.
182 */
183 void
186 const ElemTemplateElement* theTemplate) const;
187
188 /**
189 * Perform a query if needed, and call transformChild for each child.
190 *
191 * @param executionContext The current execution context
192 * @param theTemplate The owning template context.
193 * @param sourceNodes The source nodes to transform.
194 * @param sourceNodesCount The count of source nodes to transform.
195 */
196 void
202
203 /**
204 * Perform a query if needed, and call transformChild for each child.
205 *
206 * @param executionContext The current execution context
207 * @param template The owning template context.
208 * @param sorter The NodeSorter instance, if any.
209 * @param selectStackFrameIndex stack frame context for executing the
210 * select statement
211 */
212 virtual void
217 int selectStackFrameIndex) const;
218#endif
219
221
222private:
223
224 SortElemsVectorType m_sortElems;
225
226 SortElemsVectorType::size_type m_sortElemsCount;
227
228};
229
230
231
232}
233
234
235
236#endif // XALAN_ELEMFOREACH_HEADER_GUARD
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
virtual void processSortElement(StylesheetConstructionContext &constructionContext, Stylesheet &theStylesheet, const AttributeListType &atts, const Locator *locator=0)
Called during compilation to process xsl:sort elements in the stylesheet.
const XPath * m_selectPattern
virtual void releaseSelectedAndSortedNodeList(StylesheetExecutionContext &executionContext) const
virtual void postConstruction(StylesheetConstructionContext &constructionContext, const NamespacesHandler &theParentHandler)
Called after construction is completed.
virtual ~ElemForEach()
ElemForEach(StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, XalanFileLoc lineNumber, XalanFileLoc columnNumber, int xslToken)
Construct an object derived from ElemForEach.
virtual const ElemTemplateElement * startElement(StylesheetExecutionContext &executionContext) const
Completes "pre-processing" before any sub-elements are invoked (i.e.
virtual const NodeRefListBase * sortChildren(StylesheetExecutionContext &executionContext, const NodeRefListBase &selectedNodeList, MutableNodeRefList &sortedNodeList) const
XalanVector< ElemSort * > SortElemsVectorType
ElemForEach(StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber)
Construct an object corresponding to an "xsl:for-each" element.
virtual void endElement(StylesheetExecutionContext &executionContext) const
Completes "post-processing" afer any sub-elements are invoked (i.e.
virtual const NodeRefListBase * createSelectedAndSortedNodeList(StylesheetExecutionContext &executionContext) const
virtual const ElemTemplateElement * getNextChildElemToExecute(StylesheetExecutionContext &executionContext, const ElemTemplateElement *currentElem) const
Returns the next sub-element (i.e.
virtual const XalanDOMString & getElementName() const
Get a string for the name of the element.
virtual const XPath * getXPath(XalanSize_t index) const
Get XPath pattern/expression of one of the element atribute.
Local implementation of MutableNodeRefList.
Local implementation of NodeRefList.
This class can sort vectors of nodes according to a select pattern.
This class represents the base stylesheet or an "import" stylesheet.
xercesc::AttributeList AttributeListType