## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.10

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# StylesheetExecutionContext.hpp

Go to the documentation of this file.

    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(STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680)
    00017 #define STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680
    00018
    00019
    00020
    00021 // Base include file.  Must be first.
    00022 #include <xalanc/XSLT/XSLTDefinitions.hpp>
    00023
    00024
    00025
    00026 #include <cstddef>
    00027 #include <cstdio>
    00028 #include <memory>
    00029
    00030
    00031
    00032 // Base class header file...
    00033 #include <xalanc/XPath/XPathExecutionContext.hpp>
    00034
    00035
    00036
    00037
    00038 #include <xalanc/XalanDOM/XalanDOMString.hpp>
    00039
    00040
    00041
    00042 // Base class header file...
    00043 #include <xalanc/PlatformSupport/ExecutionContext.hpp>
    00044
    00045
    00046
    00047 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
    00048 #include <xalanc/PlatformSupport/XalanNumberFormat.hpp>
    00049 #endif
    00050
    00051
    00052
    00053 #include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
    00054
    00055
    00056
    00057
    00058 #include <xalanc/PlatformSupport/AttributeListImpl.hpp>
    00059 #include <xalanc/PlatformSupport/XalanCollationServices.hpp>
    00060
    00061
    00062
    00063 #include <xalanc/XSLT/TopLevelArg.hpp>
    00064
    00065
    00066
    00067 XALAN_CPP_NAMESPACE_BEGIN
    00068
    00069
    00070
    00071 class CountersTable;
    00072 class ElemTemplate;
    00073 class ElemTemplateElement;
    00074 class ElemVariable;
    00075 class FormatterListener;
    00076 class FormatterToText;
    00077 class GenerateEvent;
    00078 class PrefixResolver;
    00079 class NodeRefListBase;
    00080 class NodeSorter;
    00081 class PrintWriter;
    00082 class XalanQName;
    00083 class SelectionEvent;
    00084 class Stylesheet;
    00085 class StylesheetRoot;
    00086 class XalanOutputStream;
    00087 class TracerEvent;
    00088 class Writer;
    00089 class XalanDocument;
    00090 class XalanDocumentFragment;
    00091 class XalanElement;
    00092 class XalanNode;
    00093 class XalanNumberFormat;
    00094 class XPath;
    00095 class XObject;
    00096 class XObjectPtr;
    00097 class XResultTreeFrag;
    00098
    00099
    00100
    00101 //
    00102 // An abstract class which provides support for executing stylesheets.
    00103 //
    00104 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext
    00105 {
    00106 public:
    00107
    00108 #if defined(XALAN_STRICT_ANSI_HEADERS)
    00109     typedef std::size_t     tl_size_type;
    00110 #else
    00111     typedef size_t          tl_size_type;
    00112 #endif
    00113
    00114 #if defined(XALAN_NO_STD_NAMESPACE)
    00115     typedef ostream         StreamType;
    00116 #else
    00117     typedef std::ostream    StreamType;
    00118 #endif
    00119
    00120     explicit
    00121     StylesheetExecutionContext(MemoryManagerType& m_memoryManager, XObjectFactory*  theXObjectFactory = 0);
    00122
    00123     virtual
    00124     ~StylesheetExecutionContext();
    00125
    00126     // These interfaces are new...
    00127
    00135     virtual void
    00136     error(
    00137             const XalanDOMString&       msg,
    00138             const ElemTemplateElement&  styleNode,
    00139             const XalanNode*            sourceNode = 0) const = 0;
    00140
    00148     virtual void
    00149     warn(
    00150             const XalanDOMString&       msg,
    00151             const ElemTemplateElement&  styleNode,
    00152             const XalanNode*            sourceNode = 0) const = 0;
    00153
    00161     virtual void
    00162     message(
    00163             const XalanDOMString&       msg,
    00164             const ElemTemplateElement&  styleNode,
    00165             const XalanNode*            sourceNode = 0) const = 0;
    00166
    00167
    00173     virtual bool
    00174     getQuietConflictWarnings() const = 0;
    00175
    00182     virtual bool
    00183     getCopyTextNodesOnly() const = 0;
    00184
    00191     virtual void
    00192     pushCopyTextNodesOnly(bool copyTextNodesOnly) = 0;
    00193
    00198     virtual bool
    00199     popCopyTextNodesOnly() = 0;
    00200
    00201     /*
    00202      * A class to manage setting and restoring the flag
    00203      * for restricting copying only text nodes to the
    00204      * result tree
    00205      */
    00206     class SetAndRestoreCopyTextNodesOnly
    00207     {
    00208     public:
    00209
    00210         SetAndRestoreCopyTextNodesOnly(
    00211             StylesheetExecutionContext&     executionContext,
    00212             bool                            fValue) :
    00213             m_executionContext(executionContext)
    00214         {
    00215             executionContext.pushCopyTextNodesOnly(fValue);
    00216         }
    00217
    00218         ~SetAndRestoreCopyTextNodesOnly()
    00219         {
    00220             m_executionContext.popCopyTextNodesOnly();
    00221         }
    00222
    00223     private:
    00224
    00225         // Not implemented...
    00226         SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&);
    00227
    00228         SetAndRestoreCopyTextNodesOnly&
    00229         operator=(const SetAndRestoreCopyTextNodesOnly&);
    00230
    00231         // Data members...
    00232         StylesheetExecutionContext&     m_executionContext;
    00233
    00234     };
    00235
    00236 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00237
    00241     virtual void
    00242     pushProcessCurrentAttribute(bool processAttribute) = 0;
    00243
    00247     virtual bool
    00248     popProcessCurrentAttribute() = 0;
    00249
    00255     virtual void
    00256     pushSkipElementAttributes(bool skipAttributes) = 0;
    00257
    00262     virtual bool
    00263     getSkipElementAttributes() const = 0;
    00264
    00268     virtual bool
    00269     popSkipElementAttributes() =  0;
    00270
    00276     virtual void
    00277     pushExecuteIf(bool executeIf) = 0;
    00278
    00284     virtual bool
    00285     popExecuteIf() = 0;
    00286 #endif
    00287
    00295     virtual XalanNode*
    00296     getRootDocument() const = 0;
    00297
    00305     virtual void
    00306     setRootDocument(XalanNode*  theDocument) = 0;
    00307
    00313     virtual void
    00314     setStylesheetRoot(const StylesheetRoot*     theStylesheet) = 0;
    00315
    00321     virtual const XalanQName*
    00322     getCurrentMode() const = 0;
    00323
    00329     virtual void
    00330     pushCurrentMode(const XalanQName* theMode) = 0;
    00331
    00332
    00336     virtual void
    00337     popCurrentMode() =0;
    00338
    00344     virtual const ElemTemplate*
    00345     getCurrentTemplate() const = 0;
    00346
    00352     virtual void
    00353     pushCurrentTemplate(const ElemTemplate*     theTemplate) = 0;
    00354
    00355     virtual void
    00356     popCurrentTemplate() = 0;
    00357
    00358 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00359     /*
    00360      * A class to manage pushing and popping the current
    00361      * template instance.
    00362      */
    00363     class PushAndPopCurrentTemplate
    00364     {
    00365     public:
    00366
    00367         PushAndPopCurrentTemplate(
    00368             StylesheetExecutionContext&     executionContext,
    00369             const ElemTemplate*             theTemplate) :
    00370             m_executionContext(executionContext)
    00371         {
    00372             executionContext.pushCurrentTemplate(theTemplate);
    00373         }
    00374
    00375         ~PushAndPopCurrentTemplate()
    00376         {
    00377             m_executionContext.popCurrentTemplate();
    00378         }
    00379
    00380     private:
    00381
    00382         // Data members...
    00383         StylesheetExecutionContext&     m_executionContext;
    00384     };
    00385 #endif
    00386
    00390     virtual bool
    00391     isElementPending() const = 0;
    00392
    00400     virtual void
    00401     replacePendingAttribute(
    00402             const XalanDOMChar*     theName,
    00403             const XalanDOMChar*     theNewType,
    00404             const XalanDOMChar*     theNewValue) = 0;
    00405
    00411     virtual FormatterListener*
    00412     getFormatterListener() const = 0;
    00413
    00419     virtual void
    00420     setFormatterListener(FormatterListener*     flistener) = 0;
    00421
    00422     virtual void
    00423     pushOutputContext(FormatterListener*    flistener = 0) = 0;
    00424
    00425     virtual void
    00426     popOutputContext() = 0;
    00427
    00428     class OutputContextPushPop
    00429     {
    00430     public:
    00431
    00438         OutputContextPushPop(
    00439             StylesheetExecutionContext&     theExecutionContext,
    00440             FormatterListener*              theNewListener = 0) :
    00441             m_executionContext(theExecutionContext)
    00442         {
    00443             m_executionContext.pushOutputContext(theNewListener);
    00444         }
    00445
    00446         ~OutputContextPushPop()
    00447         {
    00448             m_executionContext.popOutputContext();
    00449         }
    00450
    00451     private:
    00452
    00453         StylesheetExecutionContext&     m_executionContext;
    00454     };
    00455
    00462     virtual void
    00463     addResultAttribute(
    00464             const XalanDOMString&   aname,
    00465             const XalanDOMString&   value) = 0;
    00466
    00473     virtual void
    00474     addResultAttribute(
    00475             const XalanDOMString&   aname,
    00476             const XalanDOMChar*     value) = 0;
    00477
    00483     virtual void
    00484     copyNamespaceAttributes(const XalanNode&    src) = 0;
    00485
    00493     virtual const XalanDOMString*
    00494     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const = 0;
    00495
    00503     virtual const XalanDOMString*
    00504     getResultNamespaceForPrefix(const XalanDOMString&   thePrefix) const = 0;
    00505
    00514     virtual bool
    00515     isPendingResultPrefix(const XalanDOMString& thePrefix) = 0;
    00516
    00517
    00523     virtual void
    00524     getUniqueNamespaceValue(XalanDOMString&     theValue) const = 0;
    00525
    00531     virtual int
    00532     getIndent() const = 0;
    00533
    00539     virtual void
    00540     setIndent(int   indentAmount) = 0;
    00541
    00550     virtual const XPath*
    00551     createMatchPattern(
    00552             const XalanDOMString&   str,
    00553             const PrefixResolver&   resolver) = 0;
    00554
    00560     virtual void
    00561     returnXPath(const XPath*    xpath) = 0;
    00562
    00563     // A helper class to automatically return an XPath instance.
    00564     class XPathGuard
    00565     {
    00566     public:
    00567
    00568         XPathGuard(
    00569                 StylesheetExecutionContext&     context,
    00570                 const XPath*                    xpath = 0) :
    00571             m_context(context),
    00572             m_xpath(xpath)
    00573         {
    00574         }
    00575
    00576         ~XPathGuard()
    00577         {
    00578             if (m_xpath != 0)
    00579             {
    00580                 m_context.returnXPath(m_xpath);
    00581             }
    00582         }
    00583
    00584         const XPath*
    00585         get() const
    00586         {
    00587             return m_xpath;
    00588         }
    00589
    00590         const XPath*
    00591         release()
    00592         {
    00593             const XPath* const  temp = m_xpath;
    00594
    00595             m_xpath = 0;
    00596
    00597             return temp;
    00598         }
    00599
    00600         void
    00601         reset(const XPath*  xpath)
    00602         {
    00603             if (m_xpath != 0)
    00604             {
    00605                 m_context.returnXPath(m_xpath);
    00606             }
    00607
    00608             m_xpath = xpath;
    00609         }
    00610
    00611     private:
    00612
    00613         StylesheetExecutionContext&     m_context;
    00614
    00615         const XPath*                    m_xpath;
    00616     };
    00617
    00618     typedef XalanVector<TopLevelArg>            ParamVectorType;
    00619
    00626     virtual void
    00627     pushTopLevelVariables(const ParamVectorType&    topLevelParams) = 0;
    00628
    00638     virtual const XObjectPtr
    00639     createVariable(
    00640             const XPath&                xpath,
    00641             XalanNode*                  contextNode,
    00642             const PrefixResolver&       resolver) = 0;
    00643
    00644 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00645
    00653     virtual const XObjectPtr
    00654     createVariable(
    00655             const ElemTemplateElement&  templateChild,
    00656             XalanNode*                  sourceNode) = 0;
    00657 #endif
    00658
    00671     virtual void
    00672     pushVariable(
    00673             const XalanQName&           name,
    00674             const ElemTemplateElement*  element,
    00675             const XalanDOMString&       str,
    00676             XalanNode*                  contextNode,
    00677             const PrefixResolver&       resolver) = 0;
    00678
    00690     virtual void
    00691     pushVariable(
    00692             const XalanQName&           name,
    00693             const ElemTemplateElement*  element,
    00694             const XPath&                xpath,
    00695             XalanNode*                  contextNode,
    00696             const PrefixResolver&       resolver) = 0;
    00697
    00698 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00699
    00708     virtual void
    00709     pushVariable(
    00710             const XalanQName&           name,
    00711             const ElemTemplateElement*  element,
    00712             const ElemTemplateElement&  templateChild,
    00713             XalanNode*                  sourceNode) = 0;
    00714 #endif
    00715
    00724     virtual void
    00725     pushVariable(
    00726             const XalanQName&           name,
    00727             const XObjectPtr            val,
    00728             const ElemTemplateElement*  element) = 0;
    00729
    00738     virtual void
    00739     pushVariable(
    00740             const XalanQName&           name,
    00741             const ElemVariable*         var,
    00742             const ElemTemplateElement*  element) = 0;
    00743
    00748     virtual void
    00749     pushContextMarker() = 0;
    00750
    00754     virtual void
    00755     popContextMarker() = 0;
    00756
    00757 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00758     /*
    00759      * A class to manage pushing and popping an element's stack
    00760      * frame context.
    00761      */
    00762     class PushAndPopContextMarker
    00763     {
    00764     public:
    00765
    00766         PushAndPopContextMarker(StylesheetExecutionContext&     executionContext) :
    00767             m_executionContext(executionContext)
    00768         {
    00769             executionContext.pushContextMarker();
    00770         }
    00771
    00772         PushAndPopContextMarker(
    00773                 StylesheetExecutionContext&     executionContext,
    00774                 int&                            currentStackFrameIndex) :
    00775             m_executionContext(executionContext)
    00776         {
    00777             currentStackFrameIndex = executionContext.getCurrentStackFrameIndex();
    00778
    00779             executionContext.pushContextMarker();
    00780         }
    00781
    00782         ~PushAndPopContextMarker()
    00783         {
    00784             m_executionContext.popContextMarker();
    00785         }
    00786
    00787         StylesheetExecutionContext&
    00788         getExecutionContext() const
    00789         {
    00790             return m_executionContext;
    00791         }
    00792
    00793     private:
    00794
    00795         StylesheetExecutionContext&     m_executionContext;
    00796     };
    00797 #endif
    00798
    00802     virtual void
    00803     resolveTopLevelParams() = 0;
    00804
    00808     virtual void
    00809     clearTopLevelParams() = 0;
    00810
    00811 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00812     class ResolveAndClearTopLevelParams
    00813     {
    00814     public:
    00815
    00816         ResolveAndClearTopLevelParams(StylesheetExecutionContext&   executionContext) :
    00817             m_executionContext(executionContext)
    00818         {
    00819             m_executionContext.resolveTopLevelParams();
    00820         }
    00821
    00822         ~ResolveAndClearTopLevelParams()
    00823         {
    00824             m_executionContext.clearTopLevelParams();
    00825         }
    00826
    00827     private:
    00828
    00829         StylesheetExecutionContext&     m_executionContext;
    00830     };
    00831
    00838     virtual void
    00839     pushParams(const ElemTemplateElement&   xslCallTemplateElement) = 0;
    00840
    00841 #else
    00842
    00846     virtual void beginParams() = 0;
    00847
    00851     virtual void endParams() = 0;
    00852
    00858     virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue) = 0;
    00859 #endif
    00860
    00871     virtual const XObjectPtr
    00872     getParamVariable(const XalanQName&  theName) = 0;
    00873
    00879     virtual void
    00880     pushElementFrame(const ElemTemplateElement*     elem) = 0;
    00881
    00887     virtual void
    00888     popElementFrame() = 0;
    00889
    00890 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00891     /*
    00892      * A class to manage pushing and popping an element's stack
    00893      * frame context.
    00894      */
    00895     class PushAndPopElementFrame
    00896     {
    00897     public:
    00898
    00899         PushAndPopElementFrame(
    00900             StylesheetExecutionContext&     executionContext,
    00901             const ElemTemplateElement*      element) :
    00902             m_executionContext(executionContext)
    00903         {
    00904             executionContext.pushElementFrame(element);
    00905         }
    00906
    00907         ~PushAndPopElementFrame()
    00908         {
    00909             m_executionContext.popElementFrame();
    00910         }
    00911
    00912     private:
    00913
    00914         StylesheetExecutionContext&     m_executionContext;
    00915     };
    00916 #endif
    00917
    00923     virtual int
    00924     getGlobalStackFrameIndex() const = 0;
    00925
    00932     virtual int
    00933     getCurrentStackFrameIndex() const = 0;
    00934
    00941     virtual void
    00942     pushCurrentStackFrameIndex(int currentStackFrameIndex = -1) =  0;
    00943
    00947     virtual void
    00948     popCurrentStackFrameIndex() = 0;
    00949
    00950     /*
    00951      * A class to manage the state of the variable stacks frame index.
    00952      */
    00953     class SetAndRestoreCurrentStackFrameIndex
    00954     {
    00955     public:
    00956
    00957         SetAndRestoreCurrentStackFrameIndex(
    00958             StylesheetExecutionContext&     executionContext,
    00959             int                             newIndex) :
    00960             m_executionContext(executionContext),
    00961             m_savedIndex(executionContext.getCurrentStackFrameIndex())
    00962         {
    00963             executionContext.pushCurrentStackFrameIndex(newIndex);
    00964         }
    00965
    00966         ~SetAndRestoreCurrentStackFrameIndex()
    00967         {
    00968             m_executionContext.popCurrentStackFrameIndex();
    00969         }
    00970
    00971     private:
    00972
    00973         StylesheetExecutionContext&     m_executionContext;
    00974
    00975         const int                       m_savedIndex;
    00976     };
    00977
    00978 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    00979     /*
    00980      * A class to manage stack state during execution.
    00981      */
    00982     class ParamsPushPop : public PushAndPopContextMarker
    00983     {
    00984     public:
    00985
    00986         ParamsPushPop(
    00987                 StylesheetExecutionContext&     executionContext,
    00988                 const ElemTemplateElement&      xslCallTemplateElement) :
    00989             PushAndPopContextMarker(executionContext)
    00990         {
    00991             doPush(xslCallTemplateElement);
    00992         }
    00993
    00994         ParamsPushPop(
    00995                 StylesheetExecutionContext&     executionContext,
    00996                 const ElemTemplateElement&      xslCallTemplateElement,
    00997                 int&                            savedStackFrameIndex) :
    00998             PushAndPopContextMarker(executionContext, savedStackFrameIndex)
    00999         {
    01000             doPush(
    01001                 xslCallTemplateElement,
    01002                 savedStackFrameIndex);
    01003         }
    01004
    01005         ~ParamsPushPop()
    01006         {
    01007         }
    01008
    01009     private:
    01010
    01011         void
    01012         doPush(
    01013             const ElemTemplateElement&      xslCallTemplateElement,
    01014             int                             stackFrameIndex);
    01015
    01016         void
    01017         doPush(const ElemTemplateElement&   xslCallTemplateElement);
    01018     };
    01019 #endif
    01020
    01030     virtual void
    01031     startDocument() = 0;
    01032
    01044     virtual void
    01045     endDocument() = 0;
    01046
    01052     virtual void
    01053     startElement(const XalanDOMChar*    name) = 0;
    01054
    01060     virtual void
    01061     endElement(const XalanDOMChar*  name) = 0;
    01062
    01070     virtual void
    01071     characters(
    01072             const XalanDOMChar*         ch,
    01073             XalanDOMString::size_type   start,
    01074             XalanDOMString::size_type   length) = 0;
    01075
    01085     virtual void
    01086     charactersRaw(
    01087             const XalanDOMChar*         ch,
    01088             XalanDOMString::size_type   start,
    01089             XalanDOMString::size_type   length) = 0;
    01090
    01096     virtual void
    01097     comment(const XalanDOMChar*     data) = 0;
    01098
    01105     virtual void
    01106     processingInstruction(
    01107             const XalanDOMChar*     target,
    01108             const XalanDOMChar*     data) = 0;
    01109
    01113     virtual void
    01114     flushPending() = 0;
    01115
    01122     virtual void
    01123     cloneToResultTree(
    01124             const XalanNode&    node,
    01125             const LocatorType*  locator) = 0;
    01126
    01136     virtual void
    01137     cloneToResultTree(
    01138             const XalanNode&        node,
    01139             XalanNode::NodeType     nodeType,
    01140             bool                    overrideStrip,
    01141             bool                    shouldCloneAttributes,
    01142             const LocatorType*      locator) = 0;
    01143
    01144 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    01145
    01149     virtual void
    01150     beginCreateXResultTreeFrag(
    01151             XalanNode*                  sourceNode) = 0;
    01152
    01157     virtual const XObjectPtr
    01158     endCreateXResultTreeFrag() = 0;
    01159
    01165     virtual void
    01166     beginFormatToText(
    01167             XalanDOMString&             theResult) = 0;
    01168
    01173     virtual void
    01174     endFormatToText() = 0;
    01175 #else
    01176
    01183     virtual const XObjectPtr
    01184     createXResultTreeFrag(
    01185             const ElemTemplateElement&  templateChild,
    01186             XalanNode*                  sourceNode) = 0;
    01187 #endif
    01188
    01196     virtual void
    01197     outputToResultTree(
    01198             const XObject&      xobj,
    01199             const LocatorType*  locator) = 0;
    01200
    01208     virtual void
    01209     outputResultTreeFragment(
    01210             const XObject&      theTree,
    01211             const LocatorType*  locator) = 0;
    01212
    01218     virtual const XalanDOMString&
    01219     getXSLNameSpaceURL() const = 0;
    01220
    01226     virtual const XalanDOMString&
    01227     getXalanXSLNameSpaceURL() const = 0;
    01228
    01234     virtual bool
    01235     findOnElementRecursionStack(const ElemTemplateElement*  theElement) const = 0;
    01236
    01242     virtual void
    01243     pushOnElementRecursionStack(const ElemTemplateElement*  theElement) = 0;
    01244
    01250     virtual const ElemTemplateElement*
    01251     popElementRecursionStack() = 0;
    01252
    01256     class ElementRecursionStackPusher
    01257     {
    01258     public:
    01259
    01266         ElementRecursionStackPusher(
    01267                     StylesheetExecutionContext&     executionContext,
    01268                     const ElemTemplateElement*      element) :
    01269             m_executionContext(executionContext)
    01270         {
    01271             m_executionContext.pushOnElementRecursionStack(element);
    01272         }
    01273
    01274         ~ElementRecursionStackPusher()
    01275         {
    01276             m_executionContext.popElementRecursionStack();
    01277         }
    01278
    01279     private:
    01280
    01281         StylesheetExecutionContext&         m_executionContext;
    01282     };
    01283
    01284
    01294     virtual bool
    01295     returnXResultTreeFrag(XResultTreeFrag*  theXResultTreeFrag) = 0;
    01296
    01297
    01298     enum eDummy
    01299     {
    01300         eDefaultXMLIndentAmount = 0,
    01301         eDefaultHTMLIndentAmount = 0
    01302     };
    01303
    01307     enum eEscapeURLs
    01308     {
    01309         eEscapeURLsDefault,     // Use the value in the stylesheet
    01310         eEscapeURLsNo,          // Don't escape URLs
    01311         eEscapeURLsYes          // Escape URLs
    01312     };
    01313
    01321     virtual eEscapeURLs
    01322     getEscapeURLs() const = 0;
    01323
    01331     virtual void
    01332     setEscapeURLs(eEscapeURLs   value) = 0;
    01333
    01334
    01338     enum eOmitMETATag
    01339     {
    01340         eOmitMETATagDefault,    // Use the value in the stylesheet
    01341         eOmitMETATagNo,         // Don't omit the META tag
    01342         eOmitMETATagYes         // Omit the META tag
    01343     };
    01344
    01352     virtual eOmitMETATag
    01353     getOmitMETATag() const = 0;
    01354
    01362     virtual void
    01363     setOmitMETATag(eOmitMETATag     value) = 0;
    01364
    01385
    01386     virtual FormatterListener*
    01387     createFormatterToXML(
    01388             Writer&                 writer,
    01389             const XalanDOMString&   version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01390             bool                    doIndent = false,
    01391             int                     indent = eDefaultXMLIndentAmount,
    01392             const XalanDOMString&   encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01393             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01394             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01395             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01396             bool                    xmlDecl = true,
    01397             const XalanDOMString&   standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr())) = 0;
    01398
    01416     virtual FormatterListener*
    01417     createFormatterToHTML(
    01418             Writer&                 writer,
    01419             const XalanDOMString&   encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01420             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01421             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01422             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    01423             bool                    doIndent = true,
    01424             int                     indent = eDefaultHTMLIndentAmount,
    01425             bool                    escapeURLs = true,
    01426             bool                    omitMetaTag = false) = 0;
    01427
    01434     virtual FormatterListener*
    01435     createFormatterToText(
    01436             Writer&                 writer,
    01437             const XalanDOMString&   encoding) = 0;
    01438
    01439 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    01440     class BorrowReturnFormatterToText
    01441     {
    01442     public:
    01443
    01444         BorrowReturnFormatterToText(
    01445                 StylesheetExecutionContext&     executionContext,
    01446                 Writer&                         writer,
    01447                 bool                            normalizeLinefeed = true,
    01448                 bool                            handleIgnorableWhitespace = true);
    01449
    01450         ~BorrowReturnFormatterToText()
    01451         {
    01452             assert(m_formatter != 0);
    01453
    01454             m_executionContext.returnFormatterToText(m_formatter);
    01455         }
    01456
    01457         FormatterToText&
    01458         operator*() const
    01459         {
    01460             assert(m_formatter != 0);
    01461
    01462             return *m_formatter;
    01463         }
    01464
    01465         FormatterToText*
    01466         get() const
    01467         {
    01468             assert(m_formatter != 0);
    01469
    01470             return m_formatter;
    01471         }
    01472
    01473         FormatterToText*
    01474         operator->() const
    01475         {
    01476             return get();
    01477         }
    01478
    01479     private:
    01480
    01481         StylesheetExecutionContext&     m_executionContext;
    01482
    01483         FormatterToText*                m_formatter;
    01484     };
    01485
    01486
    01487     friend class BorrowReturnFormatterToText;
    01488 #endif
    01489
    01490 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    01491
    01494     virtual NodeSorter*
    01495     getNodeSorter() = 0;
    01496
    01497 #else
    01498
    01503     virtual NodeSorter*
    01504     borrowNodeSorter() = 0;
    01505
    01512     virtual bool
    01513     returnNodeSorter(NodeSorter*    theSorter) = 0;
    01514
    01515     class BorrowReturnNodeSorter
    01516     {
    01517     public:
    01518
    01519         BorrowReturnNodeSorter(StylesheetExecutionContext&  executionContext) :
    01520             m_executionContext(executionContext),
    01521             m_sorter(executionContext.borrowNodeSorter())
    01522         {
    01523             assert(m_sorter != 0);
    01524         }
    01525
    01526         ~BorrowReturnNodeSorter()
    01527         {
    01528             assert(m_sorter != 0);
    01529
    01530             m_executionContext.returnNodeSorter(m_sorter);
    01531         }
    01532
    01533         NodeSorter&
    01534         operator*() const
    01535         {
    01536             assert(m_sorter != 0);
    01537
    01538             return *m_sorter;
    01539         }
    01540
    01541         NodeSorter*
    01542         get() const
    01543         {
    01544             assert(m_sorter != 0);
    01545
    01546             return m_sorter;
    01547         }
    01548
    01549         NodeSorter*
    01550         operator->() const
    01551         {
    01552             return get();
    01553         }
    01554
    01555     private:
    01556
    01557         StylesheetExecutionContext&     m_executionContext;
    01558
    01559         NodeSorter*                     m_sorter;
    01560     };
    01561 #endif
    01562
    01563     typedef XalanMemMgrAutoPtr<XalanNumberFormat,true>      XalanNumberFormatAutoPtr;
    01564
    01571     virtual XalanNumberFormatAutoPtr
    01572     createXalanNumberFormat() = 0;
    01573
    01574 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    01575     /*
    01576      * A class to manage the attribute sets that have been executed
    01577      * by an element
    01578      */
    01579     struct UseAttributeSetIndexes
    01580     {
    01581         UseAttributeSetIndexes() :
    01582             attributeSetNameIndex(0),
    01583             matchingAttributeSetIndex(0) {}
    01584
    01585         size_type attributeSetNameIndex;
    01586         size_type matchingAttributeSetIndex;
    01587
    01588
    01589     };
    01590
    01591     virtual void
    01592     createUseAttributeSetIndexesOnStack() = 0;
    01593
    01594     virtual UseAttributeSetIndexes&
    01595     getUseAttributeSetIndexes() = 0;
    01596
    01597     virtual void
    01598     popUseAttributeSetIndexesFromStack() = 0;
    01599
    01606     virtual void
    01607     pushInvoker(const ElemTemplateElement * invoker) = 0;
    01608
    01612     virtual void
    01613     popInvoker() = 0;
    01614
    01619     virtual const ElemTemplateElement*
    01620     getInvoker() const = 0;
    01621 #endif
    01622
    01628     virtual tl_size_type
    01629     getTraceListeners() const = 0;
    01630
    01636     virtual void
    01637     fireGenerateEvent(const GenerateEvent&  ge) = 0;
    01638
    01644     virtual void
    01645     fireTraceEvent(const TracerEvent&   te) = 0;
    01646
    01652     virtual void
    01653     fireSelectEvent(const SelectionEvent&   se) = 0;
    01654
    01660     virtual bool
    01661     getTraceSelects() const = 0;
    01662
    01670     virtual void
    01671     traceSelect(
    01672             const ElemTemplateElement&  theStylesheetElement,
    01673             const NodeRefListBase&      nl,
    01674             const XPath*                xpath) = 0;
    01675
    01685     virtual int
    01686     collationCompare(
    01687             const XalanDOMString&               theLHS,
    01688             const XalanDOMString&               theRHS,
    01689             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
    01690
    01701     virtual int
    01702     collationCompare(
    01703             const XalanDOMString&               theLHS,
    01704             const XalanDOMString&               theRHS,
    01705             const XalanDOMString&               theLocale,
    01706             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
    01707
    01717     virtual int
    01718     collationCompare(
    01719             const XalanDOMChar*                 theLHS,
    01720             const XalanDOMChar*                 theRHS,
    01721             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
    01722
    01733     virtual int
    01734     collationCompare(
    01735             const XalanDOMChar*                 theLHS,
    01736             const XalanDOMChar*                 theRHS,
    01737             const XalanDOMChar*                 theLocale,
    01738             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
    01739
    01746     virtual PrintWriter*
    01747     createPrintWriter(XalanOutputStream*        theTextOutputStream) = 0;
    01748
    01757     virtual PrintWriter*
    01758     createPrintWriter(
    01759             const XalanDOMString&       theFileName,
    01760             const XalanDOMString&       theEncoding) = 0;
    01761
    01768     virtual PrintWriter*
    01769     createPrintWriter(StreamType&   theStream) = 0;
    01770
    01777     virtual PrintWriter*
    01778     createPrintWriter(FILE*     theStream) = 0;
    01779
    01786     virtual CountersTable&
    01787     getCountersTable() = 0;
    01788
    01794     virtual void
    01795     characters(const XalanNode&     node) = 0;
    01796
    01802     virtual void
    01803     characters(const XObjectPtr&    xobject) = 0;
    01804
    01811     virtual void
    01812     charactersRaw(const XalanNode&  node) = 0;
    01813
    01819     virtual void
    01820     charactersRaw(const XObjectPtr&     xobject) = 0;
    01821
    01822
    01823     // These interfaces are inherited from XPathExecutionContext...
    01824
    01825     virtual void
    01826     reset() = 0;
    01827
    01828     virtual XalanNode*
    01829     getCurrentNode() const = 0;
    01830
    01831     virtual void
    01832     pushCurrentNode(XalanNode*  theCurrentNode) = 0;
    01833
    01834     virtual void
    01835     popCurrentNode() = 0;
    01836
    01837     virtual bool
    01838     isNodeAfter(
    01839             const XalanNode&    node1,
    01840             const XalanNode&    node2) const = 0;
    01841
    01842     virtual void
    01843     pushContextNodeList(const NodeRefListBase&  theList) = 0;
    01844
    01845     virtual void
    01846     popContextNodeList() = 0;
    01847
    01848     virtual const NodeRefListBase&
    01849     getContextNodeList() const = 0;
    01850
    01851     virtual size_type
    01852     getContextNodeListLength() const = 0;
    01853
    01854     virtual size_type
    01855     getContextNodeListPosition(const XalanNode&     contextNode) const = 0;
    01856
    01864     virtual bool
    01865     elementAvailable(const XalanQName&  theQName) const = 0;
    01866
    01876     virtual bool
    01877     elementAvailable(
    01878             const XalanDOMString&   theName,
    01879             const LocatorType*      locator) const = 0;
    01880
    01888     virtual bool
    01889     functionAvailable(const XalanQName&     theQName) const = 0;
    01890
    01899     virtual bool
    01900     functionAvailable(
    01901             const XalanDOMString&   theName,
    01902             const LocatorType*      locator) const = 0;
    01903
    01904     virtual const XObjectPtr
    01905     extFunction(
    01906             const XalanDOMString&           theNamespace,
    01907             const XalanDOMString&           functionName,
    01908             XalanNode*                      context,
    01909             const XObjectArgVectorType&     argVec,
    01910             const LocatorType*              locator) = 0;
    01911
    01912     virtual XalanDocument*
    01913     parseXML(
    01914             MemoryManagerType&      theManager,
    01915             const XalanDOMString&   urlString,
    01916             const XalanDOMString&   base) const = 0;
    01917
    01918     virtual MutableNodeRefList*
    01919     borrowMutableNodeRefList() = 0;
    01920
    01921     virtual bool
    01922     returnMutableNodeRefList(MutableNodeRefList*    theList) = 0;
    01923
    01924     virtual MutableNodeRefList*
    01925     createMutableNodeRefList(MemoryManagerType& theManager) const = 0;
    01926
    01927 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    01928
    01929     virtual MutableNodeRefList&
    01930     createAndPushMutableNodeRefList() = 0;
    01931
    01932     virtual void
    01933     releaseAndPopMutableNodeRefList() = 0;
    01934
    01935     virtual void
    01936     pushXObjectPtr(const XObjectPtr& xobjectPtr) = 0;
    01937
    01938     virtual void
    01939     popXObjectPtr() = 0;
    01940
    01941     virtual void
    01942     createAndPushNodesToTransformList(const NodeRefListBase* nodeList) = 0;
    01943
    01944     virtual XalanNode*
    01945     getNextNodeToTransform() = 0;
    01946
    01947     virtual void
    01948     popNodesToTransformList() = 0;
    01949
    01954     virtual XalanDOMString&
    01955     getAndPushCachedString() = 0;
    01956
    01961     virtual XalanDOMString&
    01962     getLastCachedString() = 0;
    01963
    01971     virtual XalanDOMString&
    01972     getAndPopCachedString() = 0;
    01973 #endif
    01974
    01975     virtual XalanDOMString&
    01976     getCachedString() = 0;
    01977
    01978     virtual bool
    01979     releaseCachedString(XalanDOMString&     theString) = 0;
    01980
    01981
    01982     virtual void
    01983     getNodeSetByKey(
    01984             XalanDocument*          doc,
    01985             const XalanQName&       qname,
    01986             const XalanDOMString&   ref,
    01987             MutableNodeRefList&     nodelist) = 0;
    01988
    01989     virtual void
    01990     getNodeSetByKey(
    01991             XalanDocument*          doc,
    01992             const XalanDOMString&   name,
    01993             const XalanDOMString&   ref,
    01994             const LocatorType*      locator,
    01995             MutableNodeRefList&     nodelist) = 0;
    01996
    01997     virtual const XObjectPtr
    01998     getVariable(
    01999             const XalanQName&   name,
    02000             const LocatorType*  locator = 0) = 0;
    02001
    02002     virtual const PrefixResolver*
    02003     getPrefixResolver() const = 0;
    02004
    02005     virtual void
    02006     setPrefixResolver(const PrefixResolver*     thePrefixResolver) = 0;
    02007
    02008     virtual const XalanDOMString*
    02009     getNamespaceForPrefix(const XalanDOMString&     prefix) const = 0;
    02010
    02011     virtual const XalanDOMString&
    02012     findURIFromDoc(const XalanDocument*     owner) const = 0;
    02013
    02014     virtual const XalanDOMString&
    02015     getUnparsedEntityURI(
    02016             const XalanDOMString&   theName,
    02017             const XalanDocument&    theDocument) const = 0;
    02018
    02019     virtual bool
    02020     shouldStripSourceNode(const XalanText&  node) = 0;
    02021
    02022     virtual XalanDocument*
    02023     getSourceDocument(const XalanDOMString&     theURI) const = 0;
    02024
    02025     virtual void
    02026     setSourceDocument(
    02027             const XalanDOMString&   theURI,
    02028             XalanDocument*          theDocument) = 0;
    02029
    02030     virtual void
    02031     formatNumber(
    02032             double                  number,
    02033             const XalanDOMString&   pattern,
    02034             XalanDOMString&         theResult,
    02035             const XalanNode*        context = 0,
    02036             const LocatorType*      locator = 0) = 0;
    02037
    02038     virtual void
    02039     formatNumber(
    02040             double                  number,
    02041             const XalanDOMString&   pattern,
    02042             const XalanDOMString&   dfsName,
    02043             XalanDOMString&         theResult,
    02044             const XalanNode*        context = 0,
    02045             const LocatorType*      locator = 0) = 0;
    02046
    02047     // These interfaces are inherited from ExecutionContext...
    02048
    02049     virtual void
    02050     error(
    02051             const XalanDOMString&   msg,
    02052             const XalanNode*        sourceNode,
    02053             const LocatorType*      locator) const = 0;
    02054
    02055     virtual void
    02056     warn(
    02057             const XalanDOMString&   msg,
    02058             const XalanNode*        sourceNode = 0,
    02059             const LocatorType*      locator = 0) const = 0;
    02060
    02061     virtual void
    02062     message(
    02063             const XalanDOMString&   msg,
    02064             const XalanNode*        sourceNode = 0,
    02065             const LocatorType*      locator = 0) const = 0;
    02066
    02067 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
    02068 protected:
    02074     virtual FormatterToText*
    02075     borrowFormatterToText() = 0;
    02076
    02083     virtual bool
    02084     returnFormatterToText(FormatterToText*  theFormatter) = 0;
    02085 #endif
    02086 };
    02087
    02088
    02089
    02090 XALAN_CPP_NAMESPACE_END
    02091
    02092
    02093
    02094 #endif  // STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680

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.10 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.