Xalan-C++ API Reference  1.12.0
Public Types | Public Member Functions | List of all members
xalanc::XSLTProcessor Class Referenceabstract

This is an interface for an XSLT Processor engine. More...

#include <xalanc/XSLT/XSLTProcessor.hpp>

Inheritance diagram for xalanc::XSLTProcessor:
[legend]
Collaboration diagram for xalanc::XSLTProcessor:
[legend]

Public Types

typedef XalanSize_t size_type
 
- Public Types inherited from xalanc::ProblemListenerBase
enum  eSource {
  eXMLPARSER = 0, eXMLParser = 0, eXSLPROCESSOR = 1, eXSLTProcessor = 1,
  eXPATH = 2, eXPath = 2, eSourceCount
}
 
enum  eClassification {
  eMESSAGE = 0, eMessage = 0, eWARNING = 1, eWarning = 1,
  eERROR = 2, eError = 2, eClassificationCount
}
 
typedef eSource eProblemSource
 

Public Member Functions

 XSLTProcessor ()
 
virtual ~XSLTProcessor ()
 
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. More...
 
virtual void problem (eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)=0
 Function that is called when a problem event occurs. More...
 
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. More...
 
virtual void process (const XSLTInputSource &inputSource, XSLTResultTarget &outputTarget, StylesheetExecutionContext &executionContext)=0
 Transform the source tree to the output in the given result tree target. More...
 
virtual StylesheetRootprocessStylesheet (const XSLTInputSource &stylesheetSource, StylesheetConstructionContext &constructionContext)=0
 Given a stylesheet input source, compile the stylesheet into an internal representation. More...
 
virtual StylesheetRootprocessStylesheet (const XalanDOMString &xsldocURLString, StylesheetConstructionContext &constructionContext)=0
 Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation. More...
 
virtual void reset ()=0
 Reset the state. More...
 
virtual XalanNodegetSourceTreeFromInput (const XSLTInputSource &inputSource)=0
 Given an input source, get the source tree. More...
 
virtual const StylesheetRootgetStylesheetRoot () const =0
 Retrieve the root stylesheet. More...
 
virtual void setStylesheetRoot (const StylesheetRoot *theStylesheet)=0
 Set the root stylesheet. More...
 
virtual void setExecutionContext (StylesheetExecutionContext *theExecutionContext)=0
 Set the execution context. More...
 
virtual void resolveTopLevelParams (StylesheetExecutionContext &executionContext)=0
 Resolve the params that were pushed by the caller. More...
 
virtual XMLParserLiaisongetXMLParserLiaison () const =0
 Get the XML Parser Liaison that this processor uses. More...
 
virtual void getUniqueNamespaceValue (XalanDOMString &theValue)=0
 Generate a random namespace prefix guaranteed to be unique. More...
 
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. More...
 
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. More...
 
virtual void clearStylesheetParams ()=0
 Clear any stylesheet params. More...
 
virtual FormatterListenergetFormatterListener () const =0
 Get the current formatter listener. More...
 
virtual void setFormatterListener (FormatterListener *flistener)=0
 Set the current formatter listener. More...
 
virtual size_type getTraceListeners () const =0
 Determine the number of trace listeners. More...
 
virtual void addTraceListener (TraceListener *tl)=0
 Add a trace listener for the purposes of debugging and diagnosis. More...
 
virtual void removeTraceListener (TraceListener *tl)=0
 Remove a trace listener. More...
 
virtual void fireGenerateEvent (const GenerateEvent &ge)=0
 Fire a generate event. More...
 
virtual void fireTraceEvent (const TracerEvent &te)=0
 Fire a trace event. More...
 
virtual void fireSelectEvent (const SelectionEvent &se)=0
 Fire a selection event. More...
 
virtual bool getTraceSelects () const =0
 If this is set to true, simple traces of template calls are made. More...
 
virtual void traceSelect (StylesheetExecutionContext &executionContext, const ElemTemplateElement &theStylesheetElement, const NodeRefListBase &nl, const XPath *xpath) const =0
 Compose a diagnostic trace of the current selection. More...
 
virtual void setQuietConflictWarnings (bool b)=0
 If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream. More...
 
virtual void setDiagnosticsOutput (PrintWriter *pw)=0
 If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. More...
 
- Public Member Functions inherited from xalanc::ProblemListenerBase
 ProblemListenerBase ()
 
virtual ~ProblemListenerBase ()
 

Additional Inherited Members

- Static Public Member Functions inherited from xalanc::ProblemListenerBase
static void defaultFormat (PrintWriter &pw, eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
 Function to format a problem call to a PrintWriter instance. More...
 
static void defaultFormat (PrintWriter &pw, eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
 Function to format a problem call to a PrintWriter instance. More...
 
- Static Protected Attributes inherited from xalanc::ProblemListenerBase
static const XalanMessages::Codes s_messageCodes [eSourceCount][eClassificationCount]
 

Detailed Description

This is an interface for an XSLT Processor engine.

It's the responsibility of the implementation of the XSLTProcessor interface, collaborating with a XMLParserLiaison, the DOM, and the XPath engine, to transform a source tree of nodes into a result tree according to instructions and templates specified by a stylesheet tree. The methods process(...) are the primary public entry points.

If you reuse the processor instance, you should call reset() between calls.

Definition at line 88 of file XSLTProcessor.hpp.

Member Typedef Documentation

◆ size_type

typedef XalanSize_t xalanc::XSLTProcessor::size_type

Definition at line 92 of file XSLTProcessor.hpp.

Constructor & Destructor Documentation

◆ XSLTProcessor()

xalanc::XSLTProcessor::XSLTProcessor ( )

◆ ~XSLTProcessor()

virtual xalanc::XSLTProcessor::~XSLTProcessor ( )
virtual

Member Function Documentation

◆ addTraceListener()

virtual void xalanc::XSLTProcessor::addTraceListener ( TraceListener tl)
pure virtual

Add a trace listener for the purposes of debugging and diagnosis.

Parameters
tlpointer to listener to add

Implemented in xalanc::XSLTEngineImpl.

◆ clearStylesheetParams()

virtual void xalanc::XSLTProcessor::clearStylesheetParams ( )
pure virtual

Clear any stylesheet params.

Implemented in xalanc::XSLTEngineImpl.

◆ fireGenerateEvent()

virtual void xalanc::XSLTProcessor::fireGenerateEvent ( const GenerateEvent ge)
pure virtual

Fire a generate event.

Parameters
gegenerate event to fire

Implemented in xalanc::XSLTEngineImpl.

◆ fireSelectEvent()

virtual void xalanc::XSLTProcessor::fireSelectEvent ( const SelectionEvent se)
pure virtual

Fire a selection event.

Parameters
seselection event to fire

Implemented in xalanc::XSLTEngineImpl.

◆ fireTraceEvent()

virtual void xalanc::XSLTProcessor::fireTraceEvent ( const TracerEvent te)
pure virtual

Fire a trace event.

Parameters
tetrace event to fire

Implemented in xalanc::XSLTEngineImpl.

◆ getFormatterListener()

virtual FormatterListener* xalanc::XSLTProcessor::getFormatterListener ( ) const
pure virtual

Get the current formatter listener.

Returns
pointer to formatter listener

Implemented in xalanc::XSLTEngineImpl.

◆ getSourceTreeFromInput()

virtual XalanNode* xalanc::XSLTProcessor::getSourceTreeFromInput ( const XSLTInputSource inputSource)
pure virtual

Given an input source, get the source tree.

Parameters
inputSourcepointer to input source
Returns
source tree

Implemented in xalanc::XSLTEngineImpl.

◆ getStylesheetRoot()

virtual const StylesheetRoot* xalanc::XSLTProcessor::getStylesheetRoot ( ) const
pure virtual

Retrieve the root stylesheet.

Returns
pointer to root stylesheet

Implemented in xalanc::XSLTEngineImpl.

◆ getTraceListeners()

virtual size_type xalanc::XSLTProcessor::getTraceListeners ( ) const
pure virtual

Determine the number of trace listeners.

Returns
number of listeners

Implemented in xalanc::XSLTEngineImpl.

◆ getTraceSelects()

virtual bool xalanc::XSLTProcessor::getTraceSelects ( ) const
pure virtual

If this is set to true, simple traces of template calls are made.

Returns
true if traces made

Implemented in xalanc::XSLTEngineImpl.

◆ getUniqueNamespaceValue()

virtual void xalanc::XSLTProcessor::getUniqueNamespaceValue ( XalanDOMString theValue)
pure virtual

Generate a random namespace prefix guaranteed to be unique.

Parameters
theValueA string for returning the new prefix

Implemented in xalanc::XSLTEngineImpl.

◆ getXMLParserLiaison()

virtual XMLParserLiaison& xalanc::XSLTProcessor::getXMLParserLiaison ( ) const
pure virtual

Get the XML Parser Liaison that this processor uses.

Returns
XML parser liaison object

Implemented in xalanc::XSLTEngineImpl.

◆ problem() [1/2]

virtual void xalanc::XSLTProcessor::problem ( eSource  source,
eClassification  classification,
const XalanDOMString msg,
const Locator *  locator,
const XalanNode sourceNode 
)
pure virtual

Function that is called when a problem event occurs.

Parameters
sourceEither eXMLParser, eXSLProcessor, or eXPATH.
classificationEither eMessage, eWarning, or eError.
locatorThe current Locator instance for the stylesheet. Maybe be a null pointer.
sourceNodeThe current source node, if any.
msgThe error message.

Implements xalanc::ProblemListenerBase.

Implemented in xalanc::XSLTEngineImpl.

◆ problem() [2/2]

virtual void xalanc::XSLTProcessor::problem ( eSource  source,
eClassification  classification,
const XalanDOMString msg,
const XalanNode sourceNode 
)
pure virtual

Function that is called when a problem event occurs.

This version assumes location information is already formatted into the message.

Parameters
sourceeither eXMLPARSER, eXSLPROCESSOR, or eXPATH
classificationeither eMESSAGE, eERROR or eWARNING
msgstring message explaining the problem.

Implements xalanc::ProblemListenerBase.

Implemented in xalanc::XSLTEngineImpl.

◆ process() [1/2]

virtual void xalanc::XSLTProcessor::process ( const XSLTInputSource inputSource,
const XSLTInputSource stylesheetSource,
XSLTResultTarget outputTarget,
StylesheetConstructionContext constructionContext,
StylesheetExecutionContext executionContext 
)
pure virtual

Transform the source tree to the output in the given result tree target.

The processor will process the input source, the stylesheet source, and transform to the output target.

Parameters
inputSourceinput source
stylesheetSourcestylesheet source
outputTargetoutput source tree
constructionContextcontext for construction of objects
executionContextcurrent execution context
Exceptions
XSLProcessorException

Implemented in xalanc::XSLTEngineImpl.

◆ process() [2/2]

virtual void xalanc::XSLTProcessor::process ( const XSLTInputSource inputSource,
XSLTResultTarget outputTarget,
StylesheetExecutionContext executionContext 
)
pure virtual

Transform the source tree to the output in the given result tree target.

This function does not create a stylesheet tree, it assumes the provided StylesheetExecutionContext has the stylesheet tree to use. This is set by calling StylesheetExecutionContext::setStylesheetRoot().

Parameters
inputSourceinput source
outputTargetoutput source tree
executionContextcurrent execution context
Exceptions
XSLProcessorException

Implemented in xalanc::XSLTEngineImpl.

◆ processStylesheet() [1/2]

virtual StylesheetRoot* xalanc::XSLTProcessor::processStylesheet ( const XalanDOMString xsldocURLString,
StylesheetConstructionContext constructionContext 
)
pure virtual

Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.

Parameters
xmldocURLStringURI to the input XML document
constructionContextcontext for construction of objects
Returns
pointer to compiled stylesheet object
Exceptions
XSLProcessorException

Implemented in xalanc::XSLTEngineImpl.

◆ processStylesheet() [2/2]

virtual StylesheetRoot* xalanc::XSLTProcessor::processStylesheet ( const XSLTInputSource stylesheetSource,
StylesheetConstructionContext constructionContext 
)
pure virtual

Given a stylesheet input source, compile the stylesheet into an internal representation.

Parameters
stylesheetSourceinput source for the stylesheet
constructionContextcontext for construction of objects
Returns
pointer to the compiled stylesheet object
Exceptions
XSLProcessorException

Implemented in xalanc::XSLTEngineImpl.

◆ removeTraceListener()

virtual void xalanc::XSLTProcessor::removeTraceListener ( TraceListener tl)
pure virtual

Remove a trace listener.

Parameters
tlTrace listener to be removed.

Implemented in xalanc::XSLTEngineImpl.

◆ reset()

virtual void xalanc::XSLTProcessor::reset ( )
pure virtual

Reset the state.

This needs to be called after a process() call is invoked, if the processor is to be used again.

Implemented in xalanc::XSLTEngineImpl.

◆ resolveTopLevelParams()

virtual void xalanc::XSLTProcessor::resolveTopLevelParams ( StylesheetExecutionContext executionContext)
pure virtual

Resolve the params that were pushed by the caller.

Implemented in xalanc::XSLTEngineImpl.

◆ setDiagnosticsOutput()

virtual void xalanc::XSLTProcessor::setDiagnosticsOutput ( PrintWriter pw)
pure virtual

If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.

If the value is null, then diagnostics will be turned off.

Parameters
pwpointer to print writer

Implemented in xalanc::XSLTEngineImpl.

◆ setExecutionContext()

virtual void xalanc::XSLTProcessor::setExecutionContext ( StylesheetExecutionContext theExecutionContext)
pure virtual

Set the execution context.

Must be set if after calling setStylesheetRoot.

Parameters
theExecutionContextpointer to new execution context.

Implemented in xalanc::XSLTEngineImpl.

◆ setFormatterListener()

virtual void xalanc::XSLTProcessor::setFormatterListener ( FormatterListener flistener)
pure virtual

Set the current formatter listener.

Parameters
flistenerpointer to new formatter listener

Implemented in xalanc::XSLTEngineImpl.

◆ setQuietConflictWarnings()

virtual void xalanc::XSLTProcessor::setQuietConflictWarnings ( bool  b)
pure virtual

If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream.

True by default.

Parameters
btrue if conflict warnings should be suppressed.

Implemented in xalanc::XSLTEngineImpl.

◆ setStylesheetParam() [1/2]

virtual void xalanc::XSLTProcessor::setStylesheetParam ( const XalanDOMString key,
const XalanDOMString expression 
)
pure virtual

Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.

Top-level params are "sticky," and must be removed with a call to clearStylesheetParams().

Parameters
keyname of the param
expressionexpression that will be evaluated

Implemented in xalanc::XSLTEngineImpl.

◆ setStylesheetParam() [2/2]

virtual void xalanc::XSLTProcessor::setStylesheetParam ( const XalanDOMString key,
XObjectPtr  value 
)
pure virtual

Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.

Top-level params are "sticky," and must be removed with a call to clearStylesheetParams().

Parameters
keyname of the parameter
valueXObject value for parameter

Implemented in xalanc::XSLTEngineImpl.

◆ setStylesheetRoot()

virtual void xalanc::XSLTProcessor::setStylesheetRoot ( const StylesheetRoot theStylesheet)
pure virtual

Set the root stylesheet.

Parameters
theStylesheetpointer to new root stylesheet

Implemented in xalanc::XSLTEngineImpl.

◆ traceSelect()

virtual void xalanc::XSLTProcessor::traceSelect ( StylesheetExecutionContext executionContext,
const ElemTemplateElement theStylesheetElement,
const NodeRefListBase nl,
const XPath xpath 
) const
pure virtual

Compose a diagnostic trace of the current selection.

Parameters
executionContextThe current execution context
theStylesheetElementThe executing stylesheet element
nlThe list of selected nodes
xpathA pointer to the XPath which generated the list of nodes, if any.

Implemented in xalanc::XSLTEngineImpl.


The documentation for this class was generated from the following file: