Xalan-C++ API Reference 1.12.0
XSLTProcessor.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
19#if !defined(XALAN_XSLTPROCESSOR_HEADER_GUARD)
20#define XALAN_XSLTPROCESSOR_HEADER_GUARD
21
22
23
24// Base include file. Must be first.
25#include "XSLTDefinitions.hpp"
26
27
28
29#include <cstddef>
30
31
32
34
35
36
37namespace XERCES_CPP_NAMESPACE
38{
39 class Locator;
40}
41
42
43
44namespace XALAN_CPP_NAMESPACE {
45
46
47
48using xercesc::Locator;;
49
50
51
52class ElemTemplateElement;
53class FormatterListener;
54class GenerateEvent;
55class NodeRefListBase;
56class PrefixResolver;
57class PrintWriter;
58class SelectionEvent;
59class StylesheetConstructionContext;
60class StylesheetExecutionContext;
61class StylesheetRoot;
62class TraceListener;
63class TracerEvent;
64class XalanDOMString;
65class XalanDocument;
66class XalanElement;
67class XalanNode;
68class XMLParserLiaison;
69class XObject;
70class XObjectPtr;
71class XPath;
72class XPathExecutionContext;
73class XSLTInputSource;
74class XSLTResultTarget;
75
76
77
78/**
79 * This is an interface for an XSLT Processor engine. It's the responsibility
80 * of the implementation of the XSLTProcessor interface, collaborating with a
81 * XMLParserLiaison, the DOM, and the XPath engine, to transform a source tree
82 * of nodes into a result tree according to instructions and templates
83 * specified by a stylesheet tree. The methods process(...) are
84 * the primary public entry points.
85 *
86 * If you reuse the processor instance, you should call reset() between calls.
87 */
89{
90public:
91
93
95
96 virtual
98
99
100 // These interfaces are inherited from ProblemListenerBase.
101
102 virtual void
104 eSource source,
106 const XalanDOMString& msg,
107 const Locator* locator,
108 const XalanNode* sourceNode) = 0;
109
110 virtual void
112 eSource source,
114 const XalanDOMString& msg,
115 const XalanNode* sourceNode) = 0;
116
117 // These interfaces are new to XSLTProcessor
118 /**
119 * Transform the source tree to the output in the given result tree target.
120 * The processor will process the input source, the stylesheet source,
121 * and transform to the output target.
122 *
123 * @param inputSource input source
124 * @param stylesheetSource stylesheet source
125 * @param outputTarget output source tree
126 * @param constructionContext context for construction of objects
127 * @param executionContext current execution context
128 * @exception XSLProcessorException
129 */
130 virtual void
137
138 /**
139 * Transform the source tree to the output in the given result tree target.
140 * This function does not create a stylesheet tree, it assumes the
141 * provided StylesheetExecutionContext has the stylesheet tree to use. This
142 * is set by calling StylesheetExecutionContext::setStylesheetRoot().
143 *
144 * @param inputSource input source
145 * @param outputTarget output source tree
146 * @param executionContext current execution context
147 * @exception XSLProcessorException
148 */
149 virtual void
154
155 /**
156 * Given a stylesheet input source, compile the stylesheet into an internal
157 * representation.
158 *
159 * @param stylesheetSource input source for the stylesheet
160 * @param constructionContext context for construction of objects
161 * @return pointer to the compiled stylesheet object
162 * @exception XSLProcessorException
163 */
164 virtual StylesheetRoot*
168
169 /**
170 * Given a URI to an XSL stylesheet, compile the stylesheet into an internal
171 * representation.
172 *
173 * @param xmldocURLString URI to the input XML document
174 * @param constructionContext context for construction of objects
175 * @return pointer to compiled stylesheet object
176 * @exception XSLProcessorException
177 */
178 virtual StylesheetRoot*
182
183 /**
184 * Reset the state. This needs to be called after a process() call
185 * is invoked, if the processor is to be used again.
186 */
187 virtual void
188 reset() = 0;
189
190 /**
191 * Given an input source, get the source tree.
192 *
193 * @param inputSource pointer to input source
194 * @return source tree
195 */
196 virtual XalanNode*
198
199 /**
200 * Retrieve the root stylesheet.
201 *
202 * @return pointer to root stylesheet
203 */
204 virtual const StylesheetRoot*
205 getStylesheetRoot() const = 0;
206
207 /**
208 * Set the root stylesheet.
209 *
210 * @param theStylesheet pointer to new root stylesheet
211 */
212 virtual void
214
215 /**
216 * Set the execution context. Must be set if after calling
217 * setStylesheetRoot.
218 *
219 * @param theExecutionContext pointer to new execution context.
220 */
221 virtual void
223
224 /**
225 * Resolve the params that were pushed by the caller.
226 */
227 virtual void
229
230 /**
231 * Get the XML Parser Liaison that this processor uses.
232 *
233 * @return XML parser liaison object
234 */
235 virtual XMLParserLiaison&
237
238
239 /**
240 * Generate a random namespace prefix guaranteed to be unique.
241 *
242 * @param theValue A string for returning the new prefix
243 */
244 virtual void
246
247 /**
248 * Set a top-level parameter, which the stylesheet can access
249 * with a top-level xsl:param. Top-level params are "sticky,"
250 * and must be removed with a call to clearStylesheetParams().
251 *
252 * @param key name of the parameter
253 * @param value XObject value for parameter
254 */
255 virtual void
257 const XalanDOMString& key,
258 XObjectPtr value) = 0;
259
260 /**
261 * Set a top-level parameter, which the stylesheet can access
262 * with a top-level xsl:param. Top-level params are "sticky,"
263 * and must be removed with a call to clearStylesheetParams().
264 *
265 * @param key name of the param
266 * @param expression expression that will be evaluated
267 */
268 virtual void
270 const XalanDOMString& key,
271 const XalanDOMString& expression) = 0;
272
273 /**
274 * Clear any stylesheet params.
275 */
276 virtual void
278
279 /**
280 * Get the current formatter listener.
281 *
282 * @return pointer to formatter listener
283 */
284 virtual FormatterListener*
286
287 /**
288 * Set the current formatter listener.
289 *
290 * @param flistener pointer to new formatter listener
291 */
292 virtual void
294
295 /**
296 * Determine the number of trace listeners.
297 *
298 * @return number of listeners
299 */
300 virtual size_type
301 getTraceListeners() const = 0;
302
303 /**
304 * Add a trace listener for the purposes of debugging and diagnosis.
305 *
306 * @param tl pointer to listener to add
307 */
308 virtual void
310
311 /**
312 * Remove a trace listener.
313 *
314 * @param tl Trace listener to be removed.
315 */
316 virtual void
318
319 /**
320 * Fire a generate event.
321 *
322 * @param ge generate event to fire
323 */
324 virtual void
326
327 /**
328 * Fire a trace event.
329 *
330 * @param te trace event to fire
331 */
332 virtual void
334
335 /**
336 * Fire a selection event.
337 *
338 * @param se selection event to fire
339 */
340 virtual void
342
343 /**
344 * If this is set to true, simple traces of template calls are made.
345 *
346 * @return true if traces made
347 */
348 virtual bool
349 getTraceSelects() const = 0;
350
351 /**
352 * Compose a diagnostic trace of the current selection
353 *
354 * @param executionContext The current execution context
355 * @param theStylesheetElement The executing stylesheet element
356 * @param nl The list of selected nodes
357 * @param xpath A pointer to the XPath which generated the list of nodes, if any.
358 */
359 virtual void
363 const NodeRefListBase& nl,
364 const XPath* xpath) const = 0;
365
366 /**
367 * If the quietConflictWarnings property is set to
368 * true, warnings about pattern conflicts won't be
369 * printed to the diagnostics stream.
370 * True by default.
371 *
372 * @param b true if conflict warnings should be suppressed.
373 */
374 virtual void
376
377 /**
378 * If this is set, diagnostics will be
379 * written to the m_diagnosticsPrintWriter stream. If
380 * the value is null, then diagnostics will be turned
381 * off.
382 *
383 * @param pw pointer to print writer
384 */
385 virtual void
387};
388
389
390
391}
392
393
394
395#endif // XALAN_XSLTPROCESSOR_HEADER_GUARD
#define XALAN_XSLT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
A SAX-based formatter interface for the XSL processor.
This is the class for events generated by the XSL processor after it generates a new node in the resu...
Local implementation of NodeRefList.
This is the abstract class that is used when reporting a problem some kind, that requires a message,...
This acts as the stylesheet root of the stylesheet tree, and holds values that are shared by all styl...
This is the parent class of events generated for tracing the progress of the XSL processor.
Class to hold XObjectPtr return types.
Definition XObject.hpp:884
This is an interface for an XSLT Processor engine.
virtual void process(const XSLTInputSource &inputSource, const XSLTInputSource &stylesheetSource, XSLTResultTarget &outputTarget, StylesheetConstructionContext &constructionContext, StylesheetExecutionContext &executionContext)=0
Transform the source tree to the output in the given result tree target.
virtual bool getTraceSelects() const =0
If this is set to true, simple traces of template calls are made.
virtual void setExecutionContext(StylesheetExecutionContext *theExecutionContext)=0
Set the execution context.
virtual void fireSelectEvent(const SelectionEvent &se)=0
Fire a selection event.
virtual void clearStylesheetParams()=0
Clear any stylesheet params.
virtual void setFormatterListener(FormatterListener *flistener)=0
Set the current formatter listener.
virtual void setStylesheetRoot(const StylesheetRoot *theStylesheet)=0
Set the root stylesheet.
virtual void reset()=0
Reset the state.
virtual void fireTraceEvent(const TracerEvent &te)=0
Fire a trace event.
virtual StylesheetRoot * processStylesheet(const XSLTInputSource &stylesheetSource, StylesheetConstructionContext &constructionContext)=0
Given a stylesheet input source, compile the stylesheet into an internal representation.
virtual void setStylesheetParam(const XalanDOMString &key, XObjectPtr value)=0
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
virtual void process(const XSLTInputSource &inputSource, XSLTResultTarget &outputTarget, StylesheetExecutionContext &executionContext)=0
Transform the source tree to the output in the given result tree target.
virtual StylesheetRoot * processStylesheet(const XalanDOMString &xsldocURLString, StylesheetConstructionContext &constructionContext)=0
Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)=0
Function that is called when a problem event occurs.
virtual const StylesheetRoot * getStylesheetRoot() const =0
Retrieve the root stylesheet.
virtual void fireGenerateEvent(const GenerateEvent &ge)=0
Fire a generate event.
virtual size_type getTraceListeners() const =0
Determine the number of trace listeners.
virtual void getUniqueNamespaceValue(XalanDOMString &theValue)=0
Generate a random namespace prefix guaranteed to be unique.
virtual void resolveTopLevelParams(StylesheetExecutionContext &executionContext)=0
Resolve the params that were pushed by the caller.
virtual void setQuietConflictWarnings(bool b)=0
If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be print...
virtual void setStylesheetParam(const XalanDOMString &key, const XalanDOMString &expression)=0
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
virtual void traceSelect(StylesheetExecutionContext &executionContext, const ElemTemplateElement &theStylesheetElement, const NodeRefListBase &nl, const XPath *xpath) const =0
Compose a diagnostic trace of the current selection.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)=0
Function that is called when a problem event occurs.
virtual FormatterListener * getFormatterListener() const =0
Get the current formatter listener.
virtual void setDiagnosticsOutput(PrintWriter *pw)=0
If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
virtual XalanNode * getSourceTreeFromInput(const XSLTInputSource &inputSource)=0
Given an input source, get the source tree.
virtual void removeTraceListener(TraceListener *tl)=0
Remove a trace listener.
virtual void addTraceListener(TraceListener *tl)=0
Add a trace listener for the purposes of debugging and diagnosis.
virtual XMLParserLiaison & getXMLParserLiaison() const =0
Get the XML Parser Liaison that this processor uses.