Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Directories | 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 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00038 
00039 
00040 
00041 // Base class header file...
00042 #include <xalanc/PlatformSupport/ExecutionContext.hpp>
00043 
00044 
00045 
00046 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00047 #include <xalanc/PlatformSupport/XalanNumberFormat.hpp>
00048 #endif
00049 
00050 
00051 
00052 #include <xalanc/Include/XalanAutoPtr.hpp>
00053 
00054 
00055 
00056 #include <xalanc/PlatformSupport/AttributeListImpl.hpp>
00057 #include <xalanc/PlatformSupport/XalanCollationServices.hpp>
00058 
00059 
00060 
00061 #include <xalanc/XSLT/TopLevelArg.hpp>
00062 
00063 
00064 
00065 XALAN_CPP_NAMESPACE_BEGIN
00066 
00067 
00068 
00069 class CountersTable;
00070 class ElemTemplate;
00071 class ElemTemplateElement;
00072 class ElemVariable;
00073 class FormatterListener;
00074 class FormatterToText;
00075 class GenerateEvent;
00076 class KeyDeclaration;
00077 class PrefixResolver;
00078 class NodeRefListBase;
00079 class NodeSorter;
00080 class PrintWriter;
00081 class XalanQName;
00082 class SelectionEvent;
00083 class Stylesheet;
00084 class StylesheetRoot;
00085 class XalanOutputStream;
00086 class TracerEvent;
00087 class Writer;
00088 class XalanDocument;
00089 class XalanDocumentFragment;
00090 class XalanElement;
00091 class XalanNode;
00092 class XalanNumberFormat;
00093 class XPath;
00094 class XObject;
00095 class XObjectPtr;
00096 class XResultTreeFrag;
00097 
00098 
00099 
00100 //
00101 // An abstract class which provides support for executing stylesheets.
00102 //
00103 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext
00104 {
00105 public:
00106 
00107 #if defined(XALAN_STRICT_ANSI_HEADERS)
00108     typedef std::size_t     tl_size_type;
00109 #else
00110     typedef size_t          tl_size_type;
00111 #endif
00112 
00113 #if defined(XALAN_NO_STD_NAMESPACE)
00114     typedef ostream         StreamType;
00115 #else
00116     typedef std::ostream    StreamType;
00117 #endif
00118 
00119     explicit
00120     StylesheetExecutionContext(XObjectFactory*  theXObjectFactory = 0);
00121 
00122     virtual
00123     ~StylesheetExecutionContext();
00124 
00125     // These interfaces are new...
00126 
00134     virtual void
00135     error(
00136             const XalanDOMString&       msg,
00137             const ElemTemplateElement&  styleNode,
00138             const XalanNode*            sourceNode = 0) const = 0;
00139 
00147     virtual void
00148     error(
00149             const char*                 msg,
00150             const ElemTemplateElement&  styleNode,
00151             const XalanNode*            sourceNode = 0) const = 0;
00152 
00160     virtual void
00161     warn(
00162             const XalanDOMString&       msg,
00163             const ElemTemplateElement&  styleNode,
00164             const XalanNode*            sourceNode = 0) const = 0;
00165 
00173     virtual void
00174     warn(
00175             const char*                 msg,
00176             const ElemTemplateElement&  styleNode,
00177             const XalanNode*            sourceNode = 0) const = 0;
00178 
00186     virtual void
00187     message(
00188             const XalanDOMString&       msg,
00189             const ElemTemplateElement&  styleNode,
00190             const XalanNode*            sourceNode = 0) const = 0;
00191 
00192 
00200     virtual void
00201     message(
00202             const char*                 msg,
00203             const ElemTemplateElement&  styleNode,
00204             const XalanNode*            sourceNode = 0) const = 0;
00205 
00211     virtual bool
00212     getQuietConflictWarnings() const = 0;
00213 
00220     virtual bool
00221     getCopyTextNodesOnly() const = 0;
00222 
00229     virtual void
00230     setCopyTextNodesOnly(bool   fValue) = 0;
00231 
00232     /*
00233      * A class to manage setting and restoring the flag
00234      * for restricting copying only text nodes to the
00235      * result tree
00236      */
00237     class SetAndRestoreCopyTextNodesOnly
00238     {
00239     public:
00240 
00241         SetAndRestoreCopyTextNodesOnly(
00242             StylesheetExecutionContext&     executionContext,
00243             bool                            fValue) :
00244             m_executionContext(executionContext),
00245             m_fValue(executionContext.getCopyTextNodesOnly())
00246         {
00247             executionContext.setCopyTextNodesOnly(fValue);
00248         }
00249 
00250         ~SetAndRestoreCopyTextNodesOnly()
00251         {
00252             m_executionContext.setCopyTextNodesOnly(m_fValue);
00253         }
00254 
00255     private:
00256 
00257         // Not implemented...
00258         SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&);
00259 
00260         SetAndRestoreCopyTextNodesOnly&
00261         operator=(const SetAndRestoreCopyTextNodesOnly&);
00262 
00263         // Data members...
00264         StylesheetExecutionContext&     m_executionContext;
00265 
00266         const bool                      m_fValue;
00267     };
00268 
00276     virtual XalanNode*
00277     getRootDocument() const = 0;
00278 
00286     virtual void
00287     setRootDocument(XalanNode*  theDocument) = 0;
00288 
00294     virtual void
00295     setStylesheetRoot(const StylesheetRoot*     theStylesheet) = 0;
00296 
00302     virtual const XalanQName*
00303     getCurrentMode() const = 0;
00304 
00310     virtual void
00311     setCurrentMode(const XalanQName* theMode) = 0; 
00312 
00318     virtual const ElemTemplate*
00319     getCurrentTemplate() const = 0;
00320 
00326     virtual void
00327     pushCurrentTemplate(const ElemTemplate*     theTemplate) = 0;
00328 
00329     virtual void
00330     popCurrentTemplate() = 0;
00331 
00332     /*
00333      * A class to manage pushing and popping the current
00334      * template instance.
00335      */
00336     class PushAndPopCurrentTemplate
00337     {
00338     public:
00339 
00340         PushAndPopCurrentTemplate(
00341             StylesheetExecutionContext&     executionContext,
00342             const ElemTemplate*             theTemplate) :
00343             m_executionContext(executionContext)
00344         {
00345             executionContext.pushCurrentTemplate(theTemplate);
00346         }
00347 
00348         ~PushAndPopCurrentTemplate()
00349         {
00350             m_executionContext.popCurrentTemplate();
00351         }
00352 
00353     private:
00354 
00355         // Data members...
00356         StylesheetExecutionContext&     m_executionContext;
00357     };
00358 
00364     virtual bool
00365     doDiagnosticsOutput() const = 0;
00366 
00372     virtual void
00373     diag(const XalanDOMString&  theString) = 0;
00374 
00381     virtual void
00382     pushTime(const void*    theKey) = 0;
00383 
00390     virtual void
00391     displayDuration(
00392             const XalanDOMString&   theMessage,
00393             const void*             theKey) = 0;
00394 
00398     virtual bool
00399     isElementPending() const = 0;
00400 
00408     virtual void
00409     replacePendingAttribute(
00410             const XalanDOMChar*     theName,
00411             const XalanDOMChar*     theNewType,
00412             const XalanDOMChar*     theNewValue) = 0;
00413 
00419     virtual FormatterListener*
00420     getFormatterListener() const = 0;
00421 
00427     virtual void
00428     setFormatterListener(FormatterListener*     flistener) = 0;
00429 
00430     virtual void
00431     pushOutputContext(FormatterListener*    flistener = 0) = 0;
00432 
00433     virtual void
00434     popOutputContext() = 0;
00435 
00436     class OutputContextPushPop
00437     {
00438     public:
00439 
00446         OutputContextPushPop(
00447             StylesheetExecutionContext&     theExecutionContext,
00448             FormatterListener*              theNewListener = 0) :
00449             m_executionContext(theExecutionContext)
00450         {
00451             m_executionContext.pushOutputContext(theNewListener);
00452         }
00453 
00454         ~OutputContextPushPop()
00455         {
00456             m_executionContext.popOutputContext();
00457         }
00458 
00459     private:
00460 
00461         StylesheetExecutionContext&     m_executionContext;
00462     };
00463 
00470     virtual void
00471     addResultAttribute(
00472             const XalanDOMString&   aname,
00473             const XalanDOMString&   value) = 0;
00474 
00481     virtual void
00482     addResultAttribute(
00483             const XalanDOMString&   aname,
00484             const XalanDOMChar*     value) = 0;
00485 
00491     virtual void
00492     copyNamespaceAttributes(const XalanNode&    src) = 0;
00493 
00501     virtual const XalanDOMString*
00502     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const = 0;
00503 
00511     virtual const XalanDOMString*
00512     getResultNamespaceForPrefix(const XalanDOMString&   thePrefix) const = 0;
00513 
00522     virtual bool
00523     isPendingResultPrefix(const XalanDOMString& thePrefix) = 0;
00524 
00530     virtual XalanDOMString
00531     getUniqueNamespaceValue() const = 0;
00532 
00538     virtual void
00539     getUniqueNamespaceValue(XalanDOMString&     theValue) const = 0;
00540 
00546     virtual int
00547     getIndent() const = 0;
00548 
00554     virtual void
00555     setIndent(int   indentAmount) = 0;
00556 
00565     virtual const XPath*
00566     createMatchPattern(
00567             const XalanDOMString&   str,
00568             const PrefixResolver&   resolver) = 0;
00569 
00575     virtual void
00576     returnXPath(const XPath*    xpath) = 0;
00577 
00578     // A helper class to automatically return an XPath instance.
00579     class XPathGuard
00580     {
00581     public:
00582 
00583         XPathGuard(
00584                 StylesheetExecutionContext&     context,
00585                 const XPath*                    xpath = 0) :
00586             m_context(context),
00587             m_xpath(xpath)
00588         {
00589         }
00590 
00591         ~XPathGuard()
00592         {
00593             if (m_xpath != 0)
00594             {
00595                 m_context.returnXPath(m_xpath);
00596             }
00597         }
00598 
00599         const XPath*
00600         get() const
00601         {
00602             return m_xpath;
00603         }
00604 
00605         const XPath*
00606         release()
00607         {
00608             const XPath* const  temp = m_xpath;
00609 
00610             m_xpath = 0;
00611 
00612             return temp;
00613         }
00614 
00615         void
00616         reset(const XPath*  xpath)
00617         {
00618             if (m_xpath != 0)
00619             {
00620                 m_context.returnXPath(m_xpath);
00621             }
00622 
00623             m_xpath = xpath;
00624         }
00625 
00626     private:
00627 
00628         StylesheetExecutionContext&     m_context;
00629 
00630         const XPath*                    m_xpath;
00631     };
00632 
00633 #if defined(XALAN_NO_STD_NAMESPACE)
00634     typedef vector<TopLevelArg>         ParamVectorType;
00635 #else
00636     typedef std::vector<TopLevelArg>    ParamVectorType;
00637 #endif
00638 
00645     virtual void
00646     pushTopLevelVariables(const ParamVectorType&    topLevelParams) = 0;
00647 
00657     virtual const XObjectPtr
00658     createVariable(
00659             const XPath&                xpath,
00660             XalanNode*                  contextNode,
00661             const PrefixResolver&       resolver) = 0;
00662 
00671     virtual const XObjectPtr
00672     createVariable(
00673             const ElemTemplateElement&  templateChild,
00674             XalanNode*                  sourceNode) = 0;
00675 
00688     virtual void
00689     pushVariable(
00690             const XalanQName&           name,
00691             const ElemTemplateElement*  element,
00692             const XalanDOMString&       str,
00693             XalanNode*                  contextNode,
00694             const PrefixResolver&       resolver) = 0;
00695 
00707     virtual void
00708     pushVariable(
00709             const XalanQName&           name,
00710             const ElemTemplateElement*  element,
00711             const XPath&                xpath,
00712             XalanNode*                  contextNode,
00713             const PrefixResolver&       resolver) = 0;
00714 
00724     virtual void
00725     pushVariable(
00726             const XalanQName&           name,
00727             const ElemTemplateElement*  element,
00728             const ElemTemplateElement&  templateChild,
00729             XalanNode*                  sourceNode) = 0;
00730 
00739     virtual void
00740     pushVariable(
00741             const XalanQName&           name,
00742             const XObjectPtr            val,
00743             const ElemTemplateElement*  element) = 0;
00744 
00753     virtual void
00754     pushVariable(
00755             const XalanQName&           name,
00756             const ElemVariable*         var,
00757             const ElemTemplateElement*  element) = 0;
00758 
00763     virtual void
00764     pushContextMarker() = 0;
00765 
00769     virtual void
00770     popContextMarker() = 0;
00771 
00772     /*
00773      * A class to manage pushing and popping an element's stack
00774      * frame context.
00775      */
00776     class PushAndPopContextMarker
00777     {
00778     public:
00779 
00780         PushAndPopContextMarker(StylesheetExecutionContext&     executionContext) :
00781             m_executionContext(executionContext)
00782         {
00783             executionContext.pushContextMarker();
00784         }
00785 
00786         PushAndPopContextMarker(
00787                 StylesheetExecutionContext&     executionContext,
00788                 int&                            currentStackFrameIndex) :
00789             m_executionContext(executionContext)
00790         {
00791             currentStackFrameIndex = executionContext.getCurrentStackFrameIndex();
00792 
00793             executionContext.pushContextMarker();
00794         }
00795 
00796         ~PushAndPopContextMarker()
00797         {
00798             m_executionContext.popContextMarker();
00799         }
00800 
00801         StylesheetExecutionContext&
00802         getExecutionContext() const
00803         {
00804             return m_executionContext;
00805         }
00806 
00807     private:
00808 
00809         StylesheetExecutionContext&     m_executionContext;
00810     };
00811 
00815     virtual void
00816     resolveTopLevelParams() = 0;
00817 
00821     virtual void
00822     clearTopLevelParams() = 0;
00823 
00824     class ResolveAndClearTopLevelParams
00825     {
00826     public:
00827 
00828         ResolveAndClearTopLevelParams(StylesheetExecutionContext&   executionContext) :
00829             m_executionContext(executionContext)
00830         {
00831             m_executionContext.resolveTopLevelParams();
00832         }
00833 
00834         ~ResolveAndClearTopLevelParams()
00835         {
00836             m_executionContext.clearTopLevelParams();
00837         }
00838 
00839     private:
00840 
00841         StylesheetExecutionContext&     m_executionContext;
00842     };
00843 
00850     virtual void
00851     pushParams(const ElemTemplateElement&   xslCallTemplateElement) = 0;
00852 
00860     virtual const XObjectPtr
00861     getParamVariable(const XalanQName&  theName) = 0;
00862 
00868     virtual void
00869     pushElementFrame(const ElemTemplateElement*     elem) = 0;
00870 
00876     virtual void
00877     popElementFrame() = 0;
00878 
00879     /*
00880      * A class to manage pushing and popping an element's stack
00881      * frame context.
00882      */
00883     class PushAndPopElementFrame
00884     {
00885     public:
00886 
00887         PushAndPopElementFrame(
00888             StylesheetExecutionContext&     executionContext,
00889             const ElemTemplateElement*      element) :
00890             m_executionContext(executionContext)
00891         {
00892             executionContext.pushElementFrame(element);
00893         }
00894 
00895         ~PushAndPopElementFrame()
00896         {
00897             m_executionContext.popElementFrame();
00898         }
00899 
00900     private:
00901 
00902         StylesheetExecutionContext&     m_executionContext;
00903     };
00904 
00910     virtual int
00911     getGlobalStackFrameIndex() const = 0;
00912 
00919     virtual int
00920     getCurrentStackFrameIndex() const = 0;
00921 
00928     virtual void
00929     setCurrentStackFrameIndex(int   currentStackFrameIndex = -1) = 0;
00930 
00931     /*
00932      * A class to manage the state of the variable stacks frame index.
00933      */
00934     class SetAndRestoreCurrentStackFrameIndex
00935     {
00936     public:
00937 
00938         SetAndRestoreCurrentStackFrameIndex(
00939             StylesheetExecutionContext&     executionContext,
00940             int                             newIndex) :
00941             m_executionContext(executionContext),
00942             m_savedIndex(executionContext.getCurrentStackFrameIndex())
00943         {
00944             executionContext.setCurrentStackFrameIndex(newIndex);
00945         }
00946 
00947         ~SetAndRestoreCurrentStackFrameIndex()
00948         {
00949             m_executionContext.setCurrentStackFrameIndex(m_savedIndex);
00950         }
00951 
00952     private:
00953 
00954         StylesheetExecutionContext&     m_executionContext;
00955 
00956         const int                       m_savedIndex;
00957     };
00958 
00959     /*
00960      * A class to manage stack state during execution.
00961      */
00962     class ParamsPushPop : public PushAndPopContextMarker
00963     {
00964     public:
00965 
00966         ParamsPushPop(
00967                 StylesheetExecutionContext&     executionContext,
00968                 const ElemTemplateElement&      xslCallTemplateElement) :
00969             PushAndPopContextMarker(executionContext)
00970         {
00971             doPush(xslCallTemplateElement);
00972         }
00973 
00974         ParamsPushPop(
00975                 StylesheetExecutionContext&     executionContext,
00976                 const ElemTemplateElement&      xslCallTemplateElement,
00977                 int&                            savedStackFrameIndex) :
00978             PushAndPopContextMarker(executionContext, savedStackFrameIndex)
00979         {
00980             doPush(
00981                 xslCallTemplateElement,
00982                 savedStackFrameIndex);
00983         }
00984 
00985         ~ParamsPushPop()
00986         {
00987         }
00988 
00989     private:
00990 
00991         void
00992         doPush(
00993             const ElemTemplateElement&      xslCallTemplateElement,
00994             int                             stackFrameIndex);
00995 
00996         void
00997         doPush(const ElemTemplateElement&   xslCallTemplateElement);
00998     };
00999 
01009     virtual void
01010     startDocument() = 0;
01011 
01023     virtual void
01024     endDocument() = 0;
01025 
01031     virtual void
01032     startElement(const XalanDOMChar*    name) = 0;
01033 
01039     virtual void
01040     endElement(const XalanDOMChar*  name) = 0;
01041 
01049     virtual void
01050     characters(
01051             const XalanDOMChar*         ch,
01052             XalanDOMString::size_type   start,
01053             XalanDOMString::size_type   length) = 0;
01054 
01064     virtual void
01065     charactersRaw(
01066             const XalanDOMChar*         ch,
01067             XalanDOMString::size_type   start,
01068             XalanDOMString::size_type   length) = 0;
01069 
01075     virtual void
01076     comment(const XalanDOMChar*     data) = 0;
01077 
01084     virtual void
01085     processingInstruction(
01086             const XalanDOMChar*     target,
01087             const XalanDOMChar*     data) = 0;
01088 
01092     virtual void
01093     flushPending() = 0;
01094 
01101     virtual void
01102     cloneToResultTree(
01103             const XalanNode&    node,
01104             const LocatorType*  locator) = 0;
01105 
01115     virtual void
01116     cloneToResultTree(
01117             const XalanNode&        node,
01118             XalanNode::NodeType     nodeType,
01119             bool                    overrideStrip,
01120             bool                    shouldCloneAttributes,
01121             const LocatorType*      locator) = 0;
01122 
01130     virtual const XObjectPtr
01131     createXResultTreeFrag(
01132             const ElemTemplateElement&  templateChild,
01133             XalanNode*                  sourceNode) = 0;
01134 
01142     virtual void
01143     outputToResultTree(
01144             const XObject&      xobj,
01145             const LocatorType*  locator) = 0;
01146 
01154     virtual void
01155     outputResultTreeFragment(
01156             const XObject&      theTree,
01157             const LocatorType*  locator) = 0;
01158 
01164     virtual const XalanDOMString&
01165     getXSLNameSpaceURL() const = 0;
01166 
01172     virtual const XalanDOMString&
01173     getXalanXSLNameSpaceURL() const = 0;
01174 
01180     virtual bool
01181     findOnElementRecursionStack(const ElemTemplateElement*  theElement) const = 0;
01182 
01188     virtual void
01189     pushOnElementRecursionStack(const ElemTemplateElement*  theElement) = 0;
01190 
01196     virtual const ElemTemplateElement*
01197     popElementRecursionStack() = 0;
01198 
01202     class ElementRecursionStackPusher
01203     {
01204     public:
01205 
01212         ElementRecursionStackPusher(
01213                     StylesheetExecutionContext&     executionContext,
01214                     const ElemTemplateElement*      element) :
01215             m_executionContext(executionContext)
01216         {
01217             m_executionContext.pushOnElementRecursionStack(element);
01218         }
01219 
01220         ~ElementRecursionStackPusher()
01221         {
01222             m_executionContext.popElementRecursionStack();
01223         }
01224 
01225     private:
01226 
01227         StylesheetExecutionContext&         m_executionContext;
01228     };
01229 
01230 
01240     virtual bool
01241     returnXResultTreeFrag(XResultTreeFrag*  theXResultTreeFrag) = 0;
01242 
01243 
01244     enum eDummy
01245     {
01246         eDefaultXMLIndentAmount = 0,
01247         eDefaultHTMLIndentAmount = 0
01248     };
01249 
01253     enum eEscapeURLs
01254     {
01255         eEscapeURLsDefault,     // Use the value in the stylesheet
01256         eEscapeURLsNo,          // Don't escape URLs
01257         eEscapeURLsYes          // Escape URLs
01258     };
01259 
01267     virtual eEscapeURLs
01268     getEscapeURLs() const = 0;
01269 
01277     virtual void
01278     setEscapeURLs(eEscapeURLs   value) = 0;
01279 
01280 
01284     enum eOmitMETATag
01285     {
01286         eOmitMETATagDefault,    // Use the value in the stylesheet
01287         eOmitMETATagNo,         // Don't omit the META tag
01288         eOmitMETATagYes         // Omit the META tag
01289     };
01290 
01298     virtual eOmitMETATag
01299     getOmitMETATag() const = 0;
01300 
01308     virtual void
01309     setOmitMETATag(eOmitMETATag     value) = 0;
01310 
01331     virtual FormatterListener*
01332     createFormatterToXML(
01333             Writer&                 writer,
01334             const XalanDOMString&   version = XalanDOMString(),
01335             bool                    doIndent = false,
01336             int                     indent = eDefaultXMLIndentAmount,
01337             const XalanDOMString&   encoding = XalanDOMString(),
01338             const XalanDOMString&   mediaType = XalanDOMString(),
01339             const XalanDOMString&   doctypeSystem = XalanDOMString(),
01340             const XalanDOMString&   doctypePublic = XalanDOMString(),
01341             bool                    xmlDecl = true,
01342             const XalanDOMString&   standalone = XalanDOMString()) = 0;
01343 
01361     virtual FormatterListener*
01362     createFormatterToHTML(
01363             Writer&                 writer,
01364             const XalanDOMString&   encoding = XalanDOMString(),
01365             const XalanDOMString&   mediaType = XalanDOMString(),
01366             const XalanDOMString&   doctypeSystem = XalanDOMString(),
01367             const XalanDOMString&   doctypePublic = XalanDOMString(),
01368             bool                    doIndent = true,
01369             int                     indent = eDefaultHTMLIndentAmount,
01370             bool                    escapeURLs = true,
01371             bool                    omitMetaTag = false) = 0;
01372 
01379     virtual FormatterListener*
01380     createFormatterToText(
01381             Writer&                 writer,
01382             const XalanDOMString&   encoding) = 0;
01383 
01384     class BorrowReturnFormatterToText
01385     {
01386     public:
01387 
01388         BorrowReturnFormatterToText(
01389                 StylesheetExecutionContext&     executionContext,
01390                 Writer&                         writer,
01391                 bool                            normalizeLinefeed = true,
01392                 bool                            handleIgnorableWhitespace = true);
01393 
01394         ~BorrowReturnFormatterToText()
01395         {
01396             assert(m_formatter != 0);
01397 
01398             m_executionContext.returnFormatterToText(m_formatter);
01399         }
01400 
01401         FormatterToText&
01402         operator*() const
01403         {
01404             assert(m_formatter != 0);
01405 
01406             return *m_formatter;
01407         }
01408 
01409         FormatterToText*
01410         get() const
01411         {
01412             assert(m_formatter != 0);
01413 
01414             return m_formatter;
01415         }
01416 
01417         FormatterToText*
01418         operator->() const
01419         {
01420             return get();
01421         }
01422 
01423     private:
01424 
01425         StylesheetExecutionContext&     m_executionContext;
01426 
01427         FormatterToText*                m_formatter;
01428     };
01429 
01430 
01431     friend class BorrowReturnFormatterToText;
01432 
01438     virtual NodeSorter*
01439     borrowNodeSorter() = 0;
01440 
01447     virtual bool
01448     returnNodeSorter(NodeSorter*    theSorter) = 0;
01449 
01450     class BorrowReturnNodeSorter
01451     {
01452     public:
01453 
01454         BorrowReturnNodeSorter(StylesheetExecutionContext&  executionContext) :
01455             m_executionContext(executionContext),
01456             m_sorter(executionContext.borrowNodeSorter())
01457         {
01458             assert(m_sorter != 0);
01459         }
01460 
01461         ~BorrowReturnNodeSorter()
01462         {
01463             assert(m_sorter != 0);
01464 
01465             m_executionContext.returnNodeSorter(m_sorter);
01466         }
01467 
01468         NodeSorter&
01469         operator*() const
01470         {
01471             assert(m_sorter != 0);
01472 
01473             return *m_sorter;
01474         }
01475 
01476         NodeSorter*
01477         get() const
01478         {
01479             assert(m_sorter != 0);
01480 
01481             return m_sorter;
01482         }
01483 
01484         NodeSorter*
01485         operator->() const
01486         {
01487             return get();
01488         }
01489 
01490     private:
01491 
01492         StylesheetExecutionContext&     m_executionContext;
01493 
01494         NodeSorter*                     m_sorter;
01495     };
01496 
01497 
01498     typedef XalanAutoPtr<XalanNumberFormat>     XalanNumberFormatAutoPtr;
01499 
01506     virtual XalanNumberFormatAutoPtr
01507     createXalanNumberFormat() = 0;
01508 
01509 
01510     // Trace interface...
01511 
01517     virtual tl_size_type
01518     getTraceListeners() const = 0;
01519 
01525     virtual void
01526     fireGenerateEvent(const GenerateEvent&  ge) = 0;
01527 
01533     virtual void
01534     fireTraceEvent(const TracerEvent&   te) = 0;
01535 
01541     virtual void
01542     fireSelectEvent(const SelectionEvent&   se) = 0;
01543 
01549     virtual bool
01550     getTraceSelects() const = 0;
01551 
01559     virtual void
01560     traceSelect(
01561             const ElemTemplateElement&  theStylesheetElement,
01562             const NodeRefListBase&      nl,
01563             const XPath*                xpath) = 0;
01564 
01574     virtual int
01575     collationCompare(
01576             const XalanDOMString&               theLHS,
01577             const XalanDOMString&               theRHS,
01578             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01579 
01590     virtual int
01591     collationCompare(
01592             const XalanDOMString&               theLHS,
01593             const XalanDOMString&               theRHS,
01594             const XalanDOMString&               theLocale,
01595             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01596 
01606     virtual int
01607     collationCompare(
01608             const XalanDOMChar*                 theLHS,
01609             const XalanDOMChar*                 theRHS,
01610             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01611 
01622     virtual int
01623     collationCompare(
01624             const XalanDOMChar*                 theLHS,
01625             const XalanDOMChar*                 theRHS,
01626             const XalanDOMChar*                 theLocale,
01627             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) = 0;
01628 
01635     virtual bool
01636     getInConstruction(const KeyDeclaration&     keyDeclaration) const = 0;
01637 
01643     virtual void
01644     beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 
01645 
01651     virtual void
01652     endConstruction(const KeyDeclaration& keyDeclaration) = 0;
01653 
01660     virtual PrintWriter*
01661     createPrintWriter(XalanOutputStream*        theTextOutputStream) = 0;
01662 
01671     virtual PrintWriter*
01672     createPrintWriter(
01673             const XalanDOMString&       theFileName,
01674             const XalanDOMString&       theEncoding) = 0;
01675 
01682     virtual PrintWriter*
01683     createPrintWriter(StreamType&   theStream) = 0;
01684 
01691     virtual PrintWriter*
01692     createPrintWriter(FILE*     theStream) = 0;
01693 
01700     virtual CountersTable&
01701     getCountersTable() = 0;
01702 
01708     virtual void
01709     characters(const XalanNode&     node) = 0;
01710 
01716     virtual void
01717     characters(const XObjectPtr&    xobject) = 0;
01718 
01725     virtual void
01726     charactersRaw(const XalanNode&  node) = 0;
01727 
01733     virtual void
01734     charactersRaw(const XObjectPtr&     xobject) = 0;
01735 
01736 
01737     // These interfaces are inherited from XPathExecutionContext...
01738 
01739     virtual void
01740     reset() = 0;
01741 
01742     virtual XalanNode*
01743     getCurrentNode() const = 0;
01744 
01745     virtual void
01746     pushCurrentNode(XalanNode*  theCurrentNode) = 0;
01747 
01748     virtual void
01749     popCurrentNode() = 0;
01750 
01751     virtual bool
01752     isNodeAfter(
01753             const XalanNode&    node1,
01754             const XalanNode&    node2) const = 0;
01755 
01756     virtual void
01757     pushContextNodeList(const NodeRefListBase&  theList) = 0;
01758 
01759     virtual void    
01760     popContextNodeList() = 0;
01761 
01762     virtual const NodeRefListBase&
01763     getContextNodeList() const = 0;
01764 
01765     virtual size_type
01766     getContextNodeListLength() const = 0;
01767 
01768     virtual size_type
01769     getContextNodeListPosition(const XalanNode&     contextNode) const = 0;
01770 
01778     virtual bool
01779     elementAvailable(const XalanQName&  theQName) const = 0;
01780 
01790     virtual bool
01791     elementAvailable(
01792             const XalanDOMString&   theName,
01793             const LocatorType*      locator) const = 0;
01794 
01802     virtual bool
01803     functionAvailable(const XalanQName&     theQName) const = 0;
01804 
01813     virtual bool
01814     functionAvailable(
01815             const XalanDOMString&   theName,
01816             const LocatorType*      locator) const = 0;
01817 
01818     virtual const XObjectPtr
01819     extFunction(
01820             const XalanDOMString&           theNamespace,
01821             const XalanDOMString&           functionName,
01822             XalanNode*                      context,
01823             const XObjectArgVectorType&     argVec,
01824             const LocatorType*              locator) = 0;
01825 
01826     virtual XalanDocument*
01827     parseXML(
01828             const XalanDOMString&   urlString,
01829             const XalanDOMString&   base) const = 0;
01830 
01831     virtual MutableNodeRefList*
01832     borrowMutableNodeRefList() = 0;
01833 
01834     virtual bool
01835     returnMutableNodeRefList(MutableNodeRefList*    theList) = 0;
01836 
01837     virtual MutableNodeRefList*
01838     createMutableNodeRefList() const = 0;
01839 
01840     virtual XalanDOMString&
01841     getCachedString() = 0;
01842 
01843     virtual bool
01844     releaseCachedString(XalanDOMString&     theString) = 0;
01845 
01846     virtual void
01847     getNodeSetByKey(
01848             XalanDocument*          doc,
01849             const XalanQName&       qname,
01850             const XalanDOMString&   ref,
01851             MutableNodeRefList&     nodelist) = 0;
01852 
01853     virtual void
01854     getNodeSetByKey(
01855             XalanDocument*          doc,
01856             const XalanDOMString&   name,
01857             const XalanDOMString&   ref,
01858             const LocatorType*      locator,
01859             MutableNodeRefList&     nodelist) = 0;
01860 
01861     virtual const XObjectPtr
01862     getVariable(
01863             const XalanQName&   name,
01864             const LocatorType*  locator = 0) = 0;
01865 
01866     virtual const PrefixResolver*
01867     getPrefixResolver() const = 0;
01868 
01869     virtual void
01870     setPrefixResolver(const PrefixResolver*     thePrefixResolver) = 0;
01871 
01872     virtual const XalanDOMString*
01873     getNamespaceForPrefix(const XalanDOMString&     prefix) const = 0;
01874 
01875     virtual XalanDOMString
01876     findURIFromDoc(const XalanDocument*     owner) const = 0;
01877 
01878     virtual const XalanDOMString&
01879     getUnparsedEntityURI(
01880             const XalanDOMString&   theName,
01881             const XalanDocument&    theDocument) const = 0;
01882 
01883     virtual bool
01884     shouldStripSourceNode(const XalanText&  node) = 0;
01885 
01886     virtual XalanDocument*
01887     getSourceDocument(const XalanDOMString&     theURI) const = 0;
01888 
01889     virtual void
01890     setSourceDocument(
01891             const XalanDOMString&   theURI,
01892             XalanDocument*          theDocument) = 0;
01893 
01894     virtual void
01895     formatNumber(
01896             double                  number,
01897             const XalanDOMString&   pattern,
01898             XalanDOMString&         theResult,
01899             const XalanNode*        context = 0,
01900             const LocatorType*      locator = 0) = 0;
01901 
01902     virtual void
01903     formatNumber(
01904             double                  number,
01905             const XalanDOMString&   pattern,
01906             const XalanDOMString&   dfsName,
01907             XalanDOMString&         theResult,
01908             const XalanNode*        context = 0,
01909             const LocatorType*      locator = 0) = 0;
01910 
01911     // These interfaces are inherited from ExecutionContext...
01912 
01913     virtual void
01914     error(
01915             const XalanDOMString&   msg,
01916             const XalanNode*        sourceNode,
01917             const LocatorType*      locator) const = 0;
01918 
01919     virtual void
01920     error(
01921             const char*         msg,
01922             const XalanNode*    sourceNode,
01923             const LocatorType*  locator) const = 0;
01924 
01925     virtual void
01926     warn(
01927             const XalanDOMString&   msg,
01928             const XalanNode*        sourceNode = 0,
01929             const LocatorType*      locator = 0) const = 0;
01930 
01931     virtual void
01932     warn(
01933             const char*         msg,
01934             const XalanNode*    sourceNode = 0,
01935             const LocatorType*  locator = 0) const = 0;
01936 
01937     virtual void
01938     message(
01939             const XalanDOMString&   msg,
01940             const XalanNode*        sourceNode = 0,
01941             const LocatorType*      locator = 0) const = 0;
01942 
01943     virtual void
01944     message(
01945             const char*         msg,
01946             const XalanNode*    sourceNode = 0,
01947             const LocatorType*  locator = 0) const = 0;
01948 
01949 protected:
01950 
01956     virtual FormatterToText*
01957     borrowFormatterToText() = 0;
01958 
01965     virtual bool
01966     returnFormatterToText(FormatterToText*  theFormatter) = 0;
01967 };
01968 
01969 
01970 
01971 XALAN_CPP_NAMESPACE_END
01972 
01973 
01974 
01975 #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.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.