Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo