Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.9

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

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 KeyDeclaration;
00079 class PrefixResolver;
00080 class NodeRefListBase;
00081 class NodeSorter;
00082 class PrintWriter;
00083 class XalanQName;
00084 class SelectionEvent;
00085 class Stylesheet;
00086 class StylesheetRoot;
00087 class XalanOutputStream;
00088 class TracerEvent;
00089 class Writer;
00090 class XalanDocument;
00091 class XalanDocumentFragment;
00092 class XalanElement;
00093 class XalanNode;
00094 class XalanNumberFormat;
00095 class XPath;
00096 class XObject;
00097 class XObjectPtr;
00098 class XResultTreeFrag;
00099 
00100 
00101 
00102 //
00103 // An abstract class which provides support for executing stylesheets.
00104 //
00105 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext
00106 {
00107 public:
00108 
00109 #if defined(XALAN_STRICT_ANSI_HEADERS)
00110     typedef std::size_t     tl_size_type;
00111 #else
00112     typedef size_t          tl_size_type;
00113 #endif
00114 
00115 #if defined(XALAN_NO_STD_NAMESPACE)
00116     typedef ostream         StreamType;
00117 #else
00118     typedef std::ostream    StreamType;
00119 #endif
00120 
00121     explicit
00122     StylesheetExecutionContext(MemoryManagerType& m_memoryManager, XObjectFactory*  theXObjectFactory = 0);
00123 
00124     virtual
00125     ~StylesheetExecutionContext();
00126 
00127     // These interfaces are new...
00128 
00136     virtual void
00137     error(
00138             const XalanDOMString&       msg,
00139             const ElemTemplateElement&  styleNode,
00140             const XalanNode*            sourceNode = 0) const = 0;
00141 
00149     virtual void
00150     warn(
00151             const XalanDOMString&       msg,
00152             const ElemTemplateElement&  styleNode,
00153             const XalanNode*            sourceNode = 0) const = 0;
00154 
00162     virtual void
00163     message(
00164             const XalanDOMString&       msg,
00165             const ElemTemplateElement&  styleNode,
00166             const XalanNode*            sourceNode = 0) const = 0;
00167 
00168 
00174     virtual bool
00175     getQuietConflictWarnings() const = 0;
00176 
00183     virtual bool
00184     getCopyTextNodesOnly() const = 0;
00185 
00192     virtual void
00193     pushCopyTextNodesOnly(bool copyTextNodesOnly) = 0;
00194 
00199     virtual bool
00200     popCopyTextNodesOnly() = 0;
00201 
00202     /*
00203      * A class to manage setting and restoring the flag
00204      * for restricting copying only text nodes to the
00205      * result tree
00206      */
00207     class SetAndRestoreCopyTextNodesOnly
00208     {
00209     public:
00210 
00211         SetAndRestoreCopyTextNodesOnly(
00212             StylesheetExecutionContext&     executionContext,
00213             bool                            fValue) :
00214             m_executionContext(executionContext)
00215         {
00216             executionContext.pushCopyTextNodesOnly(fValue);
00217         }
00218 
00219         ~SetAndRestoreCopyTextNodesOnly()
00220         {
00221             m_executionContext.popCopyTextNodesOnly();
00222         }
00223 
00224     private:
00225 
00226         // Not implemented...
00227         SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&);
00228 
00229         SetAndRestoreCopyTextNodesOnly&
00230         operator=(const SetAndRestoreCopyTextNodesOnly&);
00231 
00232         // Data members...
00233         StylesheetExecutionContext&     m_executionContext;
00234 
00235     };
00236     
00237 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00238 
00242     virtual void
00243     pushProcessCurrentAttribute(bool processAttribute) = 0;
00244 
00248     virtual bool
00249     popProcessCurrentAttribute() = 0;
00250 
00256     virtual void
00257     pushSkipElementAttributes(bool skipAttributes) = 0;
00258 
00263     virtual bool
00264     getSkipElementAttributes() const = 0;
00265 
00269     virtual bool
00270     popSkipElementAttributes() =  0;
00271 
00277     virtual void
00278     pushExecuteIf(bool executeIf) = 0;
00279     
00285     virtual bool
00286     popExecuteIf() = 0;
00287 #endif
00288 
00296     virtual XalanNode*
00297     getRootDocument() const = 0;
00298 
00306     virtual void
00307     setRootDocument(XalanNode*  theDocument) = 0;
00308 
00314     virtual void
00315     setStylesheetRoot(const StylesheetRoot*     theStylesheet) = 0;
00316 
00322     virtual const XalanQName*
00323     getCurrentMode() const = 0;
00324 
00330     virtual void
00331     pushCurrentMode(const XalanQName* theMode) = 0; 
00332 
00333 
00337     virtual void
00338     popCurrentMode() =0;
00339 
00345     virtual const ElemTemplate*
00346     getCurrentTemplate() const = 0;
00347 
00353     virtual void
00354     pushCurrentTemplate(const ElemTemplate*     theTemplate) = 0;
00355 
00356     virtual void
00357     popCurrentTemplate() = 0;
00358 
00359 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00360     /*
00361      * A class to manage pushing and popping the current
00362      * template instance.
00363      */
00364     class PushAndPopCurrentTemplate
00365     {
00366     public:
00367 
00368         PushAndPopCurrentTemplate(
00369             StylesheetExecutionContext&     executionContext,
00370             const ElemTemplate*             theTemplate) :
00371             m_executionContext(executionContext)
00372         {
00373             executionContext.pushCurrentTemplate(theTemplate);
00374         }
00375 
00376         ~PushAndPopCurrentTemplate()
00377         {
00378             m_executionContext.popCurrentTemplate();
00379         }
00380 
00381     private:
00382 
00383         // Data members...
00384         StylesheetExecutionContext&     m_executionContext;
00385     };
00386 #endif
00387 
00393     virtual bool
00394     doDiagnosticsOutput() const = 0;
00395 
00401     virtual void
00402     diag(const XalanDOMString&  theString) = 0;
00403 
00410     virtual void
00411     pushTime(const void*    theKey) = 0;
00412 
00419     virtual void
00420     displayDuration(
00421             const XalanDOMString&   theMessage,
00422             const void*             theKey) = 0;
00423 
00427     virtual bool
00428     isElementPending() const = 0;
00429 
00437     virtual void
00438     replacePendingAttribute(
00439             const XalanDOMChar*     theName,
00440             const XalanDOMChar*     theNewType,
00441             const XalanDOMChar*     theNewValue) = 0;
00442 
00448     virtual FormatterListener*
00449     getFormatterListener() const = 0;
00450 
00456     virtual void
00457     setFormatterListener(FormatterListener*     flistener) = 0;
00458 
00459     virtual void
00460     pushOutputContext(FormatterListener*    flistener = 0) = 0;
00461 
00462     virtual void
00463     popOutputContext() = 0;
00464 
00465     class OutputContextPushPop
00466     {
00467     public:
00468 
00475         OutputContextPushPop(
00476             StylesheetExecutionContext&     theExecutionContext,
00477             FormatterListener*              theNewListener = 0) :
00478             m_executionContext(theExecutionContext)
00479         {
00480             m_executionContext.pushOutputContext(theNewListener);
00481         }
00482 
00483         ~OutputContextPushPop()
00484         {
00485             m_executionContext.popOutputContext();
00486         }
00487 
00488     private:
00489 
00490         StylesheetExecutionContext&     m_executionContext;
00491     };
00492 
00499     virtual void
00500     addResultAttribute(
00501             const XalanDOMString&   aname,
00502             const XalanDOMString&   value) = 0;
00503 
00510     virtual void
00511     addResultAttribute(
00512             const XalanDOMString&   aname,
00513             const XalanDOMChar*     value) = 0;
00514 
00520     virtual void
00521     copyNamespaceAttributes(const XalanNode&    src) = 0;
00522 
00530     virtual const XalanDOMString*
00531     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const = 0;
00532 
00540     virtual const XalanDOMString*
00541     getResultNamespaceForPrefix(const XalanDOMString&   thePrefix) const = 0;
00542 
00551     virtual bool
00552     isPendingResultPrefix(const XalanDOMString& thePrefix) = 0;
00553 
00554 
00560     virtual void
00561     getUniqueNamespaceValue(XalanDOMString&     theValue) const = 0;
00562 
00568     virtual int
00569     getIndent() const = 0;
00570 
00576     virtual void
00577     setIndent(int   indentAmount) = 0;
00578 
00587     virtual const XPath*
00588     createMatchPattern(
00589             const XalanDOMString&   str,
00590             const PrefixResolver&   resolver) = 0;
00591 
00597     virtual void
00598     returnXPath(const XPath*    xpath) = 0;
00599 
00600     // A helper class to automatically return an XPath instance.
00601     class XPathGuard
00602     {
00603     public:
00604 
00605         XPathGuard(
00606                 StylesheetExecutionContext&     context,
00607                 const XPath*                    xpath = 0) :
00608             m_context(context),
00609             m_xpath(xpath)
00610         {
00611         }
00612 
00613         ~XPathGuard()
00614         {
00615             if (m_xpath != 0)
00616             {
00617                 m_context.returnXPath(m_xpath);
00618             }
00619         }
00620 
00621         const XPath*
00622         get() const
00623         {
00624             return m_xpath;
00625         }
00626 
00627         const XPath*
00628         release()
00629         {
00630             const XPath* const  temp = m_xpath;
00631 
00632             m_xpath = 0;
00633 
00634             return temp;
00635         }
00636 
00637         void
00638         reset(const XPath*  xpath)
00639         {
00640             if (m_xpath != 0)
00641             {
00642                 m_context.returnXPath(m_xpath);
00643             }
00644 
00645             m_xpath = xpath;
00646         }
00647 
00648     private:
00649 
00650         StylesheetExecutionContext&     m_context;
00651 
00652         const XPath*                    m_xpath;
00653     };
00654 
00655     typedef XalanVector<TopLevelArg>            ParamVectorType;
00656 
00663     virtual void
00664     pushTopLevelVariables(const ParamVectorType&    topLevelParams) = 0;
00665 
00675     virtual const XObjectPtr
00676     createVariable(
00677             const XPath&                xpath,
00678             XalanNode*                  contextNode,
00679             const PrefixResolver&       resolver) = 0;
00680 
00681 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00682 
00690     virtual const XObjectPtr
00691     createVariable(
00692             const ElemTemplateElement&  templateChild,
00693             XalanNode*                  sourceNode) = 0;
00694 #endif
00695 
00708     virtual void
00709     pushVariable(
00710             const XalanQName&           name,
00711             const ElemTemplateElement*  element,
00712             const XalanDOMString&       str,
00713             XalanNode*                  contextNode,
00714             const PrefixResolver&       resolver) = 0;
00715 
00727     virtual void
00728     pushVariable(
00729             const XalanQName&           name,
00730             const ElemTemplateElement*  element,
00731             const XPath&                xpath,
00732             XalanNode*                  contextNode,
00733             const PrefixResolver&       resolver) = 0;
00734 
00735 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00736 
00745     virtual void
00746     pushVariable(
00747             const XalanQName&           name,
00748             const ElemTemplateElement*  element,
00749             const ElemTemplateElement&  templateChild,
00750             XalanNode*                  sourceNode) = 0;
00751 #endif
00752 
00761     virtual void
00762     pushVariable(
00763             const XalanQName&           name,
00764             const XObjectPtr            val,
00765             const ElemTemplateElement*  element) = 0;
00766 
00775     virtual void
00776     pushVariable(
00777             const XalanQName&           name,
00778             const ElemVariable*         var,
00779             const ElemTemplateElement*  element) = 0;
00780 
00785     virtual void
00786     pushContextMarker() = 0;
00787 
00791     virtual void
00792     popContextMarker() = 0;
00793 
00794 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00795     /*
00796      * A class to manage pushing and popping an element's stack
00797      * frame context.
00798      */
00799     class PushAndPopContextMarker
00800     {
00801     public:
00802 
00803         PushAndPopContextMarker(StylesheetExecutionContext&     executionContext) :
00804             m_executionContext(executionContext)
00805         {
00806             executionContext.pushContextMarker();
00807         }
00808 
00809         PushAndPopContextMarker(
00810                 StylesheetExecutionContext&     executionContext,
00811                 int&                            currentStackFrameIndex) :
00812             m_executionContext(executionContext)
00813         {
00814             currentStackFrameIndex = executionContext.getCurrentStackFrameIndex();
00815 
00816             executionContext.pushContextMarker();
00817         }
00818 
00819         ~PushAndPopContextMarker()
00820         {
00821             m_executionContext.popContextMarker();
00822         }
00823 
00824         StylesheetExecutionContext&
00825         getExecutionContext() const
00826         {
00827             return m_executionContext;
00828         }
00829 
00830     private:
00831 
00832         StylesheetExecutionContext&     m_executionContext;
00833     };
00834 #endif
00835 
00839     virtual void
00840     resolveTopLevelParams() = 0;
00841 
00845     virtual void
00846     clearTopLevelParams() = 0;
00847 
00848 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00849     class ResolveAndClearTopLevelParams
00850     {
00851     public:
00852 
00853         ResolveAndClearTopLevelParams(StylesheetExecutionContext&   executionContext) :
00854             m_executionContext(executionContext)
00855         {
00856             m_executionContext.resolveTopLevelParams();
00857         }
00858 
00859         ~ResolveAndClearTopLevelParams()
00860         {
00861             m_executionContext.clearTopLevelParams();
00862         }
00863 
00864     private:
00865 
00866         StylesheetExecutionContext&     m_executionContext;
00867     };
00868 
00875     virtual void
00876     pushParams(const ElemTemplateElement&   xslCallTemplateElement) = 0;
00877 
00878 #else
00879 
00883     virtual void beginParams() = 0;
00884 
00888     virtual void endParams() = 0;
00889 
00895     virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue) = 0;
00896 #endif
00897 
00908     virtual const XObjectPtr
00909     getParamVariable(const XalanQName&  theName) = 0;
00910 
00916     virtual void
00917     pushElementFrame(const ElemTemplateElement*     elem) = 0;
00918 
00924     virtual void
00925     popElementFrame() = 0;
00926 
00927 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00928     /*
00929      * A class to manage pushing and popping an element's stack
00930      * frame context.
00931      */
00932     class PushAndPopElementFrame
00933     {
00934     public:
00935 
00936         PushAndPopElementFrame(
00937             StylesheetExecutionContext&     executionContext,
00938             const ElemTemplateElement*      element) :
00939             m_executionContext(executionContext)
00940         {
00941             executionContext.pushElementFrame(element);
00942         }
00943 
00944         ~PushAndPopElementFrame()
00945         {
00946             m_executionContext.popElementFrame();
00947         }
00948 
00949     private:
00950 
00951         StylesheetExecutionContext&     m_executionContext;
00952     };
00953 #endif
00954 
00960     virtual int
00961     getGlobalStackFrameIndex() const = 0;
00962 
00969     virtual int
00970     getCurrentStackFrameIndex() const = 0;
00971 
00978     virtual void
00979     pushCurrentStackFrameIndex(int currentStackFrameIndex = -1) =  0;
00980 
00984     virtual void
00985     popCurrentStackFrameIndex() = 0;
00986 
00987     /*
00988      * A class to manage the state of the variable stacks frame index.
00989      */
00990     class SetAndRestoreCurrentStackFrameIndex
00991     {
00992     public:
00993 
00994         SetAndRestoreCurrentStackFrameIndex(
00995             StylesheetExecutionContext&     executionContext,
00996             int                             newIndex) :
00997             m_executionContext(executionContext),
00998             m_savedIndex(executionContext.getCurrentStackFrameIndex())
00999         {
01000             executionContext.pushCurrentStackFrameIndex(newIndex);
01001         }
01002 
01003         ~SetAndRestoreCurrentStackFrameIndex()
01004         {
01005             m_executionContext.popCurrentStackFrameIndex();
01006         }
01007 
01008     private:
01009 
01010         StylesheetExecutionContext&     m_executionContext;
01011 
01012         const int                       m_savedIndex;
01013     };
01014 
01015 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01016     /*
01017      * A class to manage stack state during execution.
01018      */
01019     class ParamsPushPop : public PushAndPopContextMarker
01020     {
01021     public:
01022 
01023         ParamsPushPop(
01024                 StylesheetExecutionContext&     executionContext,
01025                 const ElemTemplateElement&      xslCallTemplateElement) :
01026             PushAndPopContextMarker(executionContext)
01027         {
01028             doPush(xslCallTemplateElement);
01029         }
01030 
01031         ParamsPushPop(
01032                 StylesheetExecutionContext&     executionContext,
01033                 const ElemTemplateElement&      xslCallTemplateElement,
01034                 int&                            savedStackFrameIndex) :
01035             PushAndPopContextMarker(executionContext, savedStackFrameIndex)
01036         {
01037             doPush(
01038                 xslCallTemplateElement,
01039                 savedStackFrameIndex);
01040         }
01041 
01042         ~ParamsPushPop()
01043         {
01044         }
01045 
01046     private:
01047 
01048         void
01049         doPush(
01050             const ElemTemplateElement&      xslCallTemplateElement,
01051             int                             stackFrameIndex);
01052 
01053         void
01054         doPush(const ElemTemplateElement&   xslCallTemplateElement);
01055     };
01056 #endif
01057 
01067     virtual void
01068     startDocument() = 0;
01069 
01081     virtual void
01082     endDocument() = 0;
01083 
01089     virtual void
01090     startElement(const XalanDOMChar*    name) = 0;
01091 
01097     virtual void
01098     endElement(const XalanDOMChar*  name) = 0;
01099 
01107     virtual void
01108     characters(
01109             const XalanDOMChar*         ch,
01110             XalanDOMString::size_type   start,
01111             XalanDOMString::size_type   length) = 0;
01112 
01122     virtual void
01123     charactersRaw(
01124             const XalanDOMChar*         ch,
01125             XalanDOMString::size_type   start,
01126             XalanDOMString::size_type   length) = 0;
01127 
01133     virtual void
01134     comment(const XalanDOMChar*     data) = 0;
01135 
01142     virtual void
01143     processingInstruction(
01144             const XalanDOMChar*     target,
01145             const XalanDOMChar*     data) = 0;
01146 
01150     virtual void
01151     flushPending() = 0;
01152 
01159     virtual void
01160     cloneToResultTree(
01161             const XalanNode&    node,
01162             const LocatorType*  locator) = 0;
01163 
01173     virtual void
01174     cloneToResultTree(
01175             const XalanNode&        node,
01176             XalanNode::NodeType     nodeType,
01177             bool                    overrideStrip,
01178             bool                    shouldCloneAttributes,
01179             const LocatorType*      locator) = 0;
01180 
01181 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)  
01182 
01186     virtual void
01187     beginCreateXResultTreeFrag(
01188             XalanNode*                  sourceNode) = 0;
01189 
01194     virtual const XObjectPtr
01195     endCreateXResultTreeFrag() = 0;
01196 
01202     virtual void
01203     beginFormatToText(
01204             XalanDOMString&             theResult) = 0;
01205 
01210     virtual void
01211     endFormatToText() = 0;
01212 #else
01213 
01220     virtual const XObjectPtr
01221     createXResultTreeFrag(
01222             const ElemTemplateElement&  templateChild,
01223             XalanNode*                  sourceNode) = 0;
01224 #endif
01225 
01233     virtual void
01234     outputToResultTree(
01235             const XObject&      xobj,
01236             const LocatorType*  locator) = 0;
01237 
01245     virtual void
01246     outputResultTreeFragment(
01247             const XObject&      theTree,
01248             const LocatorType*  locator) = 0;
01249 
01255     virtual const XalanDOMString&
01256     getXSLNameSpaceURL() const = 0;
01257 
01263     virtual const XalanDOMString&
01264     getXalanXSLNameSpaceURL() const = 0;
01265 
01271     virtual bool
01272     findOnElementRecursionStack(const ElemTemplateElement*  theElement) const = 0;
01273 
01279     virtual void
01280     pushOnElementRecursionStack(const ElemTemplateElement*  theElement) = 0;
01281 
01287     virtual const ElemTemplateElement*
01288     popElementRecursionStack() = 0;
01289 
01293     class ElementRecursionStackPusher
01294     {
01295     public:
01296 
01303         ElementRecursionStackPusher(
01304                     StylesheetExecutionContext&     executionContext,
01305                     const ElemTemplateElement*      element) :
01306             m_executionContext(executionContext)
01307         {
01308             m_executionContext.pushOnElementRecursionStack(element);
01309         }
01310 
01311         ~ElementRecursionStackPusher()
01312         {
01313             m_executionContext.popElementRecursionStack();
01314         }
01315 
01316     private:
01317 
01318         StylesheetExecutionContext&         m_executionContext;
01319     };
01320 
01321 
01331     virtual bool
01332     returnXResultTreeFrag(XResultTreeFrag*  theXResultTreeFrag) = 0;
01333 
01334 
01335     enum eDummy
01336     {
01337         eDefaultXMLIndentAmount = 0,
01338         eDefaultHTMLIndentAmount = 0
01339     };
01340 
01344     enum eEscapeURLs
01345     {
01346         eEscapeURLsDefault,     // Use the value in the stylesheet
01347         eEscapeURLsNo,          // Don't escape URLs
01348         eEscapeURLsYes          // Escape URLs
01349     };
01350 
01358     virtual eEscapeURLs
01359     getEscapeURLs() const = 0;
01360 
01368     virtual void
01369     setEscapeURLs(eEscapeURLs   value) = 0;
01370 
01371 
01375     enum eOmitMETATag
01376     {
01377         eOmitMETATagDefault,    // Use the value in the stylesheet
01378         eOmitMETATagNo,         // Don't omit the META tag
01379         eOmitMETATagYes         // Omit the META tag
01380     };
01381 
01389     virtual eOmitMETATag
01390     getOmitMETATag() const = 0;
01391 
01399     virtual void
01400     setOmitMETATag(eOmitMETATag     value) = 0;
01401 
01423     virtual FormatterListener*
01424     createFormatterToXML(
01425             Writer&                 writer,
01426             const XalanDOMString&   version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01427             bool                    doIndent = false,
01428             int                     indent = eDefaultXMLIndentAmount,
01429             const XalanDOMString&   encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01430             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01431             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01432             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01433             bool                    xmlDecl = true,
01434             const XalanDOMString&   standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr())) = 0;
01435 
01453     virtual FormatterListener*
01454     createFormatterToHTML(
01455             Writer&                 writer,
01456             const XalanDOMString&   encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01457             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01458             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01459             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
01460             bool                    doIndent = true,
01461             int                     indent = eDefaultHTMLIndentAmount,
01462             bool                    escapeURLs = true,
01463             bool                    omitMetaTag = false) = 0;
01464 
01471     virtual FormatterListener*
01472     createFormatterToText(
01473             Writer&                 writer,
01474             const XalanDOMString&   encoding) = 0;
01475 
01476 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01477     class BorrowReturnFormatterToText
01478     {
01479     public:
01480 
01481         BorrowReturnFormatterToText(
01482                 StylesheetExecutionContext&     executionContext,
01483                 Writer&                         writer,
01484                 bool                            normalizeLinefeed = true,
01485                 bool                            handleIgnorableWhitespace = true);
01486 
01487         ~BorrowReturnFormatterToText()
01488         {
01489             assert(m_formatter != 0);
01490 
01491             m_executionContext.returnFormatterToText(m_formatter);
01492         }
01493 
01494         FormatterToText&
01495         operator*() const
01496         {
01497             assert(m_formatter != 0);
01498 
01499             return *m_formatter;
01500         }
01501 
01502         FormatterToText*
01503         get() const
01504         {
01505             assert(m_formatter != 0);
01506 
01507             return m_formatter;
01508         }
01509 
01510         FormatterToText*
01511         operator->() const
01512         {
01513             return get();
01514         }
01515 
01516     private:
01517 
01518         StylesheetExecutionContext&     m_executionContext;
01519 
01520         FormatterToText*                m_formatter;
01521     };
01522 
01523 
01524     friend class BorrowReturnFormatterToText;
01525 #endif
01526 
01527 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01528 
01531     virtual NodeSorter*
01532     getNodeSorter() = 0;
01533 
01534 #else
01535 
01540     virtual NodeSorter*
01541     borrowNodeSorter() = 0;
01542 
01549     virtual bool
01550     returnNodeSorter(NodeSorter*    theSorter) = 0;
01551 
01552     class BorrowReturnNodeSorter
01553     {
01554     public:
01555 
01556         BorrowReturnNodeSorter(StylesheetExecutionContext&  executionContext) :
01557             m_executionContext(executionContext),
01558             m_sorter(executionContext.borrowNodeSorter())
01559         {
01560             assert(m_sorter != 0);
01561         }
01562 
01563         ~BorrowReturnNodeSorter()
01564         {
01565             assert(m_sorter != 0);
01566 
01567             m_executionContext.returnNodeSorter(m_sorter);
01568         }
01569 
01570         NodeSorter&
01571         operator*() const
01572         {
01573             assert(m_sorter != 0);
01574 
01575             return *m_sorter;
01576         }
01577 
01578         NodeSorter*
01579         get() const
01580         {
01581             assert(m_sorter != 0);
01582 
01583             return m_sorter;
01584         }
01585 
01586         NodeSorter*
01587         operator->() const
01588         {
01589             return get();
01590         }
01591 
01592     private:
01593 
01594         StylesheetExecutionContext&     m_executionContext;
01595 
01596         NodeSorter*                     m_sorter;
01597     };
01598 #endif
01599 
01600     typedef XalanMemMgrAutoPtr<XalanNumberFormat,true>      XalanNumberFormatAutoPtr;
01601 
01608     virtual XalanNumberFormatAutoPtr
01609     createXalanNumberFormat() = 0;
01610 
01611 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01612     /*
01613      * A class to manage the attribute sets that have been executed
01614      * by an element
01615      */
01616     struct UseAttributeSetIndexes
01617     {
01618         UseAttributeSetIndexes() :
01619             attributeSetNameIndex(0),
01620             matchingAttributeSetIndex(0) {}
01621             
01622         size_type attributeSetNameIndex;
01623         size_type matchingAttributeSetIndex;
01624 
01625 
01626     };
01627 
01628     virtual void
01629     createUseAttributeSetIndexesOnStack() = 0;
01630 
01631     virtual UseAttributeSetIndexes&
01632     getUseAttributeSetIndexes() = 0;
01633 
01634     virtual void
01635     popUseAttributeSetIndexesFromStack() = 0;
01636 
01643     virtual void
01644     pushInvoker(const ElemTemplateElement * invoker) = 0;
01645 
01649     virtual void
01650     popInvoker() = 0;
01651 
01656     virtual const ElemTemplateElement*
01657     getInvoker() const = 0;
01658 #endif
01659 
01665     virtual tl_size_type
01666     getTraceListeners() const = 0;
01667 
01673     virtual void
01674     fireGenerateEvent(const GenerateEvent&  ge) = 0;
01675 
01681     virtual void
01682     fireTraceEvent(const TracerEvent&   te) = 0;
01683 
01689     virtual void
01690     fireSelectEvent(const SelectionEvent&   se) = 0;
01691 
01697     virtual bool
01698     getTraceSelects() const = 0;
01699 
01707     virtual void
01708     traceSelect(
01709             const ElemTemplateElement&  theStylesheetElement,
01710             const NodeRefListBase&      nl,
01711             const XPath*                xpath) = 0;
01712 
01722     virtual int
01723     collationCompare(
01724             const XalanDOMString&               theLHS,
01725             const XalanDOMString&               theRHS,
01726             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01727 
01738     virtual int
01739     collationCompare(
01740             const XalanDOMString&               theLHS,
01741             const XalanDOMString&               theRHS,
01742             const XalanDOMString&               theLocale,
01743             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01744 
01754     virtual int
01755     collationCompare(
01756             const XalanDOMChar*                 theLHS,
01757             const XalanDOMChar*                 theRHS,
01758             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01759 
01770     virtual int
01771     collationCompare(
01772             const XalanDOMChar*                 theLHS,
01773             const XalanDOMChar*                 theRHS,
01774             const XalanDOMChar*                 theLocale,
01775             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01776 
01783     virtual bool
01784     getInConstruction(const KeyDeclaration&     keyDeclaration) const = 0;
01785 
01791     virtual void
01792     beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 
01793 
01799     virtual void
01800     endConstruction(const KeyDeclaration& keyDeclaration) = 0;
01801 
01808     virtual PrintWriter*
01809     createPrintWriter(XalanOutputStream*        theTextOutputStream) = 0;
01810 
01819     virtual PrintWriter*
01820     createPrintWriter(
01821             const XalanDOMString&       theFileName,
01822             const XalanDOMString&       theEncoding) = 0;
01823 
01830     virtual PrintWriter*
01831     createPrintWriter(StreamType&   theStream) = 0;
01832 
01839     virtual PrintWriter*
01840     createPrintWriter(FILE*     theStream) = 0;
01841 
01848     virtual CountersTable&
01849     getCountersTable() = 0;
01850 
01856     virtual void
01857     characters(const XalanNode&     node) = 0;
01858 
01864     virtual void
01865     characters(const XObjectPtr&    xobject) = 0;
01866 
01873     virtual void
01874     charactersRaw(const XalanNode&  node) = 0;
01875 
01881     virtual void
01882     charactersRaw(const XObjectPtr&     xobject) = 0;
01883 
01884 
01885     // These interfaces are inherited from XPathExecutionContext...
01886 
01887     virtual void
01888     reset() = 0;
01889 
01890     virtual XalanNode*
01891     getCurrentNode() const = 0;
01892 
01893     virtual void
01894     pushCurrentNode(XalanNode*  theCurrentNode) = 0;
01895 
01896     virtual void
01897     popCurrentNode() = 0;
01898 
01899     virtual bool
01900     isNodeAfter(
01901             const XalanNode&    node1,
01902             const XalanNode&    node2) const = 0;
01903 
01904     virtual void
01905     pushContextNodeList(const NodeRefListBase&  theList) = 0;
01906 
01907     virtual void    
01908     popContextNodeList() = 0;
01909 
01910     virtual const NodeRefListBase&
01911     getContextNodeList() const = 0;
01912 
01913     virtual size_type
01914     getContextNodeListLength() const = 0;
01915 
01916     virtual size_type
01917     getContextNodeListPosition(const XalanNode&     contextNode) const = 0;
01918 
01926     virtual bool
01927     elementAvailable(const XalanQName&  theQName) const = 0;
01928 
01938     virtual bool
01939     elementAvailable(
01940             const XalanDOMString&   theName,
01941             const LocatorType*      locator) const = 0;
01942 
01950     virtual bool
01951     functionAvailable(const XalanQName&     theQName) const = 0;
01952 
01961     virtual bool
01962     functionAvailable(
01963             const XalanDOMString&   theName,
01964             const LocatorType*      locator) const = 0;
01965 
01966     virtual const XObjectPtr
01967     extFunction(
01968             const XalanDOMString&           theNamespace,
01969             const XalanDOMString&           functionName,
01970             XalanNode*                      context,
01971             const XObjectArgVectorType&     argVec,
01972             const LocatorType*              locator) = 0;
01973 
01974     virtual XalanDocument*
01975     parseXML(
01976             MemoryManagerType&      theManager,
01977             const XalanDOMString&   urlString,
01978             const XalanDOMString&   base) const = 0;
01979 
01980     virtual MutableNodeRefList*
01981     borrowMutableNodeRefList() = 0;
01982 
01983     virtual bool
01984     returnMutableNodeRefList(MutableNodeRefList*    theList) = 0;
01985 
01986     virtual MutableNodeRefList*
01987     createMutableNodeRefList(MemoryManagerType& theManager) const = 0;
01988 
01989 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01990 
01991     virtual MutableNodeRefList& 
01992     createAndPushMutableNodeRefList() = 0;
01993 
01994     virtual void 
01995     releaseAndPopMutableNodeRefList() = 0;
01996 
01997     virtual void
01998     pushXObjectPtr(const XObjectPtr& xobjectPtr) = 0;
01999 
02000     virtual void 
02001     popXObjectPtr() = 0;
02002 
02003     virtual void 
02004     createAndPushNodesToTransformList(const NodeRefListBase* nodeList) = 0;
02005 
02006     virtual XalanNode* 
02007     getNextNodeToTransform() = 0;
02008 
02009     virtual void 
02010     popNodesToTransformList() = 0;
02011 
02016     virtual XalanDOMString&
02017     getAndPushCachedString() = 0;
02018 
02023     virtual XalanDOMString&
02024     getLastCachedString() = 0;
02025 
02033     virtual XalanDOMString&
02034     getAndPopCachedString() = 0;
02035 #endif
02036 
02037     virtual XalanDOMString&
02038     getCachedString() = 0;
02039 
02040     virtual bool
02041     releaseCachedString(XalanDOMString&     theString) = 0;
02042 
02043 
02044     virtual void
02045     getNodeSetByKey(
02046             XalanDocument*          doc,
02047             const XalanQName&       qname,
02048             const XalanDOMString&   ref,
02049             MutableNodeRefList&     nodelist) = 0;
02050 
02051     virtual void
02052     getNodeSetByKey(
02053             XalanDocument*          doc,
02054             const XalanDOMString&   name,
02055             const XalanDOMString&   ref,
02056             const LocatorType*      locator,
02057             MutableNodeRefList&     nodelist) = 0;
02058 
02059     virtual const XObjectPtr
02060     getVariable(
02061             const XalanQName&   name,
02062             const LocatorType*  locator = 0) = 0;
02063 
02064     virtual const PrefixResolver*
02065     getPrefixResolver() const = 0;
02066 
02067     virtual void
02068     setPrefixResolver(const PrefixResolver*     thePrefixResolver) = 0;
02069 
02070     virtual const XalanDOMString*
02071     getNamespaceForPrefix(const XalanDOMString&     prefix) const = 0;
02072 
02073     virtual const XalanDOMString&
02074     findURIFromDoc(const XalanDocument*     owner) const = 0;
02075 
02076     virtual const XalanDOMString&
02077     getUnparsedEntityURI(
02078             const XalanDOMString&   theName,
02079             const XalanDocument&    theDocument) const = 0;
02080 
02081     virtual bool
02082     shouldStripSourceNode(const XalanText&  node) = 0;
02083 
02084     virtual XalanDocument*
02085     getSourceDocument(const XalanDOMString&     theURI) const = 0;
02086 
02087     virtual void
02088     setSourceDocument(
02089             const XalanDOMString&   theURI,
02090             XalanDocument*          theDocument) = 0;
02091 
02092     virtual void
02093     formatNumber(
02094             double                  number,
02095             const XalanDOMString&   pattern,
02096             XalanDOMString&         theResult,
02097             const XalanNode*        context = 0,
02098             const LocatorType*      locator = 0) = 0;
02099 
02100     virtual void
02101     formatNumber(
02102             double                  number,
02103             const XalanDOMString&   pattern,
02104             const XalanDOMString&   dfsName,
02105             XalanDOMString&         theResult,
02106             const XalanNode*        context = 0,
02107             const LocatorType*      locator = 0) = 0;
02108 
02109     // These interfaces are inherited from ExecutionContext...
02110 
02111     virtual void
02112     error(
02113             const XalanDOMString&   msg,
02114             const XalanNode*        sourceNode,
02115             const LocatorType*      locator) const = 0;
02116 
02117     virtual void
02118     warn(
02119             const XalanDOMString&   msg,
02120             const XalanNode*        sourceNode = 0,
02121             const LocatorType*      locator = 0) const = 0;
02122 
02123     virtual void
02124     message(
02125             const XalanDOMString&   msg,
02126             const XalanNode*        sourceNode = 0,
02127             const LocatorType*      locator = 0) const = 0;
02128 
02129 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
02130 protected:
02136     virtual FormatterToText*
02137     borrowFormatterToText() = 0;
02138 
02145     virtual bool
02146     returnFormatterToText(FormatterToText*  theFormatter) = 0;
02147 #endif
02148 };
02149 
02150 
02151 
02152 XALAN_CPP_NAMESPACE_END
02153 
02154 
02155 
02156 #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.9
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.