Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.4

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

StylesheetExecutionContext.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
00006  * reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. The end-user documentation included with the redistribution,
00021  *    if any, must include the following acknowledgment:  
00022  *       "This product includes software developed by the
00023  *        Apache Software Foundation (http://www.apache.org/)."
00024  *    Alternately, this acknowledgment may appear in the software itself,
00025  *    if and wherever such third-party acknowledgments normally appear.
00026  *
00027  * 4. The names "Xalan" and "Apache Software Foundation" must
00028  *    not be used to endorse or promote products derived from this
00029  *    software without prior written permission. For written 
00030  *    permission, please contact apache@apache.org.
00031  *
00032  * 5. Products derived from this software may not be called "Apache",
00033  *    nor may "Apache" appear in their name, without prior written
00034  *    permission of the Apache Software Foundation.
00035  *
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00047  * SUCH DAMAGE.
00048  * ====================================================================
00049  *
00050  * This software consists of voluntary contributions made by many
00051  * individuals on behalf of the Apache Software Foundation and was
00052  * originally based on software copyright (c) 1999, International
00053  * Business Machines, Inc., http://www.ibm.com.  For more
00054  * information on the Apache Software Foundation, please see
00055  * <http://www.apache.org/>.
00056  *
00057  * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a>
00058  */
00059 #if !defined(STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680)
00060 #define STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680
00061 
00062 
00063 
00064 // Base include file.  Must be first.
00065 #include <XSLT/XSLTDefinitions.hpp>
00066 
00067 
00068 
00069 #if defined(XALAN_OLD_STREAMS)
00070 #include <iostream.h>
00071 #else
00072 #include <iosfwd>
00073 #endif
00074 
00075 
00076 
00077 #include <cstddef>
00078 #include <memory>
00079 
00080 
00081 
00082 // Base class header file...
00083 #include <XPath/XPathExecutionContext.hpp>
00084 
00085 
00086 
00087 #include <XalanDOM/XalanDOMString.hpp>
00088 
00089 
00090 
00091 // Base class header file...
00092 #include <PlatformSupport/ExecutionContext.hpp>
00093 
00094 
00095 
00096 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00097 #include <PlatformSupport/XalanNumberFormat.hpp>
00098 #endif
00099 
00100 
00101 
00102 #include <Include/XalanAutoPtr.hpp>
00103 
00104 
00105 
00106 #include <PlatformSupport/AttributeListImpl.hpp>
00107 
00108 
00109 
00110 #include <XSLT/KeyTable.hpp>
00111 #include <XSLT/TopLevelArg.hpp>
00112 
00113 
00114 
00115 class CountersTable;
00116 class ElemTemplate;
00117 class ElemTemplateElement;
00118 class ElemVariable;
00119 class FormatterListener;
00120 class FormatterToDOM;
00121 class FormatterToHTML;
00122 class FormatterToText;
00123 class FormatterToXML;
00124 class GenerateEvent;
00125 class KeyTable;
00126 class PrefixResolver;
00127 class NodeRefListBase;
00128 class NodeSorter;
00129 class PrintWriter;
00130 class XalanQName;
00131 class SelectionEvent;
00132 class Stylesheet;
00133 class StylesheetRoot;
00134 class XalanOutputStream;
00135 class TracerEvent;
00136 class Writer;
00137 class XalanDocument;
00138 class XalanDocumentFragment;
00139 class XalanElement;
00140 class XalanNode;
00141 class XalanNumberFormat;
00142 class XPath;
00143 class XObject;
00144 class XObjectPtr;
00145 class XResultTreeFrag;
00146 
00147 
00148 
00149 //
00150 // An abstract class which provides support for executing stylesheets.
00151 //
00152 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext
00153 {
00154 public:
00155 
00156     typedef size_t  size_type;
00157 
00158     explicit
00159     StylesheetExecutionContext(XObjectFactory*  theXObjectFactory = 0);
00160 
00161     virtual
00162     ~StylesheetExecutionContext();
00163 
00164     // These interfaces are new...
00165 
00171     virtual bool
00172     getQuietConflictWarnings() const = 0;
00173 
00180     virtual bool
00181     getCopyTextNodesOnly() const = 0;
00182 
00189     virtual void
00190     setCopyTextNodesOnly(bool   fValue) = 0;
00191 
00192     /*
00193      * A class to manage setting and restoring the flag
00194      * for restricting copying only text nodes to the
00195      * result tree
00196      */
00197     class SetAndRestoreCopyTextNodesOnly
00198     {
00199     public:
00200 
00201         SetAndRestoreCopyTextNodesOnly(
00202             StylesheetExecutionContext&     executionContext,
00203             bool                            fValue) :
00204             m_executionContext(executionContext),
00205             m_fValue(executionContext.getCopyTextNodesOnly())
00206         {
00207             executionContext.setCopyTextNodesOnly(fValue);
00208         }
00209 
00210         ~SetAndRestoreCopyTextNodesOnly()
00211         {
00212             m_executionContext.setCopyTextNodesOnly(m_fValue);
00213         }
00214 
00215     private:
00216 
00217         // Not implemented...
00218         SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&);
00219 
00220         SetAndRestoreCopyTextNodesOnly&
00221         operator=(const SetAndRestoreCopyTextNodesOnly&);
00222 
00223         // Data members...
00224         StylesheetExecutionContext&     m_executionContext;
00225 
00226         const bool                      m_fValue;
00227     };
00228 
00236     virtual XalanNode*
00237     getRootDocument() const = 0;
00238 
00246     virtual void
00247     setRootDocument(XalanNode*  theDocument) = 0;
00248 
00254     virtual XalanDocument*
00255     createDocument() const = 0;
00256 
00262     virtual void
00263     setStylesheetRoot(const StylesheetRoot*     theStylesheet) = 0;
00264 
00270     virtual const XalanQName*
00271     getCurrentMode() const = 0;
00272 
00278     virtual void
00279     setCurrentMode(const XalanQName* theMode) = 0; 
00280 
00286     virtual const ElemTemplate*
00287     getCurrentTemplate() const = 0;
00288 
00294     virtual void
00295     setCurrentTemplate(const ElemTemplate*  theTemplate) = 0; 
00296 
00297     /*
00298      * A class to manage setting and restoring the current
00299      * template instance.
00300      */
00301     class SetAndRestoreCurrentTemplate
00302     {
00303     public:
00304 
00305         SetAndRestoreCurrentTemplate(
00306             StylesheetExecutionContext&     executionContext,
00307             const ElemTemplate*             theTemplate) :
00308             m_executionContext(executionContext),
00309             m_template(executionContext.getCurrentTemplate())
00310         {
00311             executionContext.setCurrentTemplate(theTemplate);
00312         }
00313 
00314         ~SetAndRestoreCurrentTemplate()
00315         {
00316             m_executionContext.setCurrentTemplate(m_template);
00317         }
00318 
00319     private:
00320 
00321         // Not implemented...
00322         SetAndRestoreCurrentTemplate(const SetAndRestoreCurrentTemplate&);
00323 
00324         SetAndRestoreCurrentTemplate&
00325         operator=(const SetAndRestoreCurrentTemplate&);
00326 
00327         // Data members...
00328         StylesheetExecutionContext&     m_executionContext;
00329 
00330         const ElemTemplate* const       m_template;
00331     };
00332 
00338     virtual bool
00339     doDiagnosticsOutput() const = 0;
00340 
00346     virtual void
00347     diag(const XalanDOMString&  theString) = 0;
00348 
00355     virtual void
00356     pushTime(const void*    theKey) = 0;
00357 
00364     virtual void
00365     displayDuration(
00366             const XalanDOMString&   theMessage,
00367             const void*             theKey) = 0;
00368 
00372     virtual bool
00373     isElementPending() const = 0;
00374 
00382     virtual void
00383     replacePendingAttribute(
00384             const XalanDOMChar*     theName,
00385             const XalanDOMChar*     theNewType,
00386             const XalanDOMChar*     theNewValue) = 0;
00387 
00393     virtual FormatterListener*
00394     getFormatterListener() const = 0;
00395 
00401     virtual void
00402     setFormatterListener(FormatterListener*     flistener) = 0;
00403 
00404     virtual void
00405     pushOutputContext(FormatterListener*    flistener = 0) = 0;
00406 
00407     virtual void
00408     popOutputContext() = 0;
00409 
00410     class OutputContextPushPop
00411     {
00412     public:
00413 
00420         OutputContextPushPop(
00421             StylesheetExecutionContext&     theExecutionContext,
00422             FormatterListener*              theNewListener = 0) :
00423             m_executionContext(theExecutionContext)
00424         {
00425             m_executionContext.pushOutputContext(theNewListener);
00426         }
00427 
00428         ~OutputContextPushPop()
00429         {
00430             m_executionContext.popOutputContext();
00431         }
00432 
00433     private:
00434 
00435         StylesheetExecutionContext&     m_executionContext;
00436     };
00437 
00444     virtual void
00445     addResultAttribute(
00446             const XalanDOMString&   aname,
00447             const XalanDOMString&   value) = 0;
00448 
00454     virtual void
00455     copyNamespaceAttributes(const XalanNode&    src) = 0;
00456 
00464     virtual const XalanDOMString*
00465     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const = 0;
00466 
00474     virtual const XalanDOMString*
00475     getResultNamespaceForPrefix(const XalanDOMString&   thePrefix) const = 0;
00476 
00485     virtual bool
00486     isPendingResultPrefix(const XalanDOMString& thePrefix) = 0;
00487 
00493     virtual XalanDOMString
00494     getUniqueNamespaceValue() const = 0;
00495 
00501     virtual void
00502     getUniqueNamespaceValue(XalanDOMString&     theValue) const = 0;
00503 
00509     virtual int
00510     getIndent() const = 0;
00511 
00517     virtual void
00518     setIndent(int   indentAmount) = 0;
00519 
00520     // $$$ ToDo: Remove this one!!!!
00530 //  virtual const XObjectPtr
00531 //  executeXPath(
00532 //          const XalanDOMString&   str,
00533 //          XalanNode*              contextNode,
00534 //          const XalanElement&     resolver) = 0;
00535 
00544     virtual const XPath*
00545     createMatchPattern(
00546             const XalanDOMString&   str,
00547             const PrefixResolver&   resolver) = 0;
00548 
00554     virtual void
00555     returnXPath(const XPath*    xpath) = 0;
00556 
00557     // A helper class to automatically return an XPath instance.
00558     class XPathGuard
00559     {
00560     public:
00561 
00562         XPathGuard(
00563                 StylesheetExecutionContext&     context,
00564                 const XPath*                    xpath = 0) :
00565             m_context(context),
00566             m_xpath(xpath)
00567         {
00568         }
00569 
00570         ~XPathGuard()
00571         {
00572             if (m_xpath != 0)
00573             {
00574                 m_context.returnXPath(m_xpath);
00575             }
00576         }
00577 
00578         const XPath*
00579         get() const
00580         {
00581             return m_xpath;
00582         }
00583 
00584         const XPath*
00585         release()
00586         {
00587             const XPath* const  temp = m_xpath;
00588 
00589             m_xpath = 0;
00590 
00591             return temp;
00592         }
00593 
00594         void
00595         reset(const XPath*  xpath)
00596         {
00597             if (m_xpath != 0)
00598             {
00599                 m_context.returnXPath(m_xpath);
00600             }
00601 
00602             m_xpath = xpath;
00603         }
00604 
00605     private:
00606 
00607         StylesheetExecutionContext&     m_context;
00608 
00609         const XPath*                    m_xpath;
00610     };
00611 
00612 #if defined(XALAN_NO_NAMESPACES)
00613     typedef vector<TopLevelArg>         ParamVectorType;
00614 #else
00615     typedef std::vector<TopLevelArg>    ParamVectorType;
00616 #endif
00617 
00624     virtual void
00625     pushTopLevelVariables(const ParamVectorType&    topLevelParams) = 0;
00626 
00637     virtual const XObjectPtr
00638     createVariable(
00639             const ElemTemplateElement*  element,
00640             const XPath&                xpath,
00641             XalanNode*                  contextNode,
00642             const PrefixResolver&       resolver) = 0;
00643 
00653     virtual const XObjectPtr
00654     createVariable(
00655             const ElemTemplateElement*  element,
00656             const ElemTemplateElement&  templateChild,
00657             XalanNode*                  sourceNode) = 0;
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 
00707     virtual void
00708     pushVariable(
00709             const XalanQName&           name,
00710             const ElemTemplateElement*  element,
00711             const ElemTemplateElement&  templateChild,
00712             XalanNode*                  sourceNode) = 0;
00713 
00722     virtual void
00723     pushVariable(
00724             const XalanQName&           name,
00725             const XObjectPtr            val,
00726             const ElemTemplateElement*  element) = 0;
00727 
00736     virtual void
00737     pushVariable(
00738             const XalanQName&           name,
00739             const ElemVariable*         var,
00740             const ElemTemplateElement*  element) = 0;
00741 
00746     virtual void
00747     pushContextMarker() = 0;
00748 
00752     virtual void
00753     popContextMarker() = 0;
00754 
00755     /*
00756      * A class to manage pushing and popping an element's stack
00757      * frame context.
00758      */
00759     class PushAndPopContextMarker
00760     {
00761     public:
00762 
00763         PushAndPopContextMarker(StylesheetExecutionContext&     executionContext) :
00764             m_executionContext(executionContext)
00765         {
00766             executionContext.pushContextMarker();
00767         }
00768 
00769         ~PushAndPopContextMarker()
00770         {
00771             m_executionContext.popContextMarker();
00772         }
00773 
00774     private:
00775 
00776         StylesheetExecutionContext&     m_executionContext;
00777     };
00778 
00782     virtual void
00783     resolveTopLevelParams() = 0;
00784 
00788     virtual void
00789     clearTopLevelParams() = 0;
00790 
00791     class ResolveAndClearTopLevelParams
00792     {
00793     public:
00794 
00795         ResolveAndClearTopLevelParams(StylesheetExecutionContext&   executionContext) :
00796             m_executionContext(executionContext)
00797         {
00798             m_executionContext.resolveTopLevelParams();
00799         }
00800 
00801         ~ResolveAndClearTopLevelParams()
00802         {
00803             m_executionContext.clearTopLevelParams();
00804         }
00805 
00806     private:
00807 
00808         StylesheetExecutionContext&     m_executionContext;
00809     };
00810 
00819     virtual void
00820     pushParams(
00821             const ElemTemplateElement&  xslCallTemplateElement,
00822             XalanNode*                  sourceNode,
00823             const ElemTemplateElement*  targetTemplate) = 0;
00824 
00832     virtual const XObjectPtr
00833     getParamVariable(const XalanQName&  theName) = 0;
00834 
00840     virtual void
00841     pushElementFrame(const ElemTemplateElement*     elem) = 0;
00842 
00848     virtual void
00849     popElementFrame(const ElemTemplateElement*  elem) = 0;
00850 
00851     /*
00852      * A class to manage pushing and popping an element's stack
00853      * frame context.
00854      */
00855     class PushAndPopElementFrame
00856     {
00857     public:
00858 
00859         PushAndPopElementFrame(
00860             StylesheetExecutionContext&     executionContext,
00861             const ElemTemplateElement*      element) :
00862             m_executionContext(executionContext),
00863             m_element(element)
00864         {
00865             executionContext.pushElementFrame(element);
00866         }
00867 
00868         ~PushAndPopElementFrame()
00869         {
00870             m_executionContext.popElementFrame(m_element);
00871         }
00872 
00873     private:
00874 
00875         StylesheetExecutionContext&     m_executionContext;
00876 
00877         const ElemTemplateElement*      m_element;
00878     };
00879 
00885     virtual int
00886     getGlobalStackFrameIndex() const = 0;
00887 
00894     virtual int
00895     getCurrentStackFrameIndex() const = 0;
00896 
00903     virtual void
00904     setCurrentStackFrameIndex(int   currentStackFrameIndex = -1) = 0;
00905 
00906     /*
00907      * A class to manage the state of the variable stacks frame index.
00908      */
00909     class SetAndRestoreCurrentStackFrameIndex
00910     {
00911     public:
00912 
00913         SetAndRestoreCurrentStackFrameIndex(
00914             StylesheetExecutionContext&     executionContext,
00915             int                             newIndex) :
00916             m_executionContext(executionContext),
00917             m_savedIndex(executionContext.getCurrentStackFrameIndex())
00918         {
00919             executionContext.setCurrentStackFrameIndex(newIndex);
00920         }
00921 
00922         ~SetAndRestoreCurrentStackFrameIndex()
00923         {
00924             m_executionContext.setCurrentStackFrameIndex(m_savedIndex);
00925         }
00926 
00927         int
00928         getStackFrameIndex() const
00929         {
00930             return m_savedIndex;
00931         }
00932 
00933     private:
00934 
00935         StylesheetExecutionContext&     m_executionContext;
00936 
00937         const int                       m_savedIndex;
00938     };
00939 
00940     /*
00941      * A class to manage stack state during execution.
00942      */
00943     class ParamsPushPop
00944     {
00945     public:
00946 
00947         ParamsPushPop(
00948             StylesheetExecutionContext&     executionContext,
00949             const ElemTemplateElement&      xslCallTemplateElement,
00950             XalanNode*                      sourceNode,
00951             const ElemTemplateElement*      targetTemplate);
00952 
00953         ~ParamsPushPop();
00954 
00955         int
00956         getStackFrameIndex() const
00957         {
00958             return m_savedStackFrameIndex;
00959         }
00960 
00961     private:
00962 
00963         StylesheetExecutionContext&     m_executionContext;
00964     
00965         const int                       m_savedStackFrameIndex;
00966     };
00967 
00977     virtual void
00978     startDocument() = 0;
00979 
00991     virtual void
00992     endDocument() = 0;
00993 
00999     virtual void
01000     startElement(const XalanDOMChar*    name) = 0;
01001 
01007     virtual void
01008     endElement(const XalanDOMChar*  name) = 0;
01009 
01017     virtual void
01018     characters(
01019             const XalanDOMChar*         ch,
01020             XalanDOMString::size_type   start,
01021             XalanDOMString::size_type   length) = 0;
01022 
01032     virtual void
01033     charactersRaw(
01034             const XalanDOMChar*         ch,
01035             XalanDOMString::size_type   start,
01036             XalanDOMString::size_type   length) = 0;
01037 
01043     virtual void
01044     comment(const XalanDOMChar*     data) = 0;
01045 
01052     virtual void
01053     processingInstruction(
01054             const XalanDOMChar*     target,
01055             const XalanDOMChar*     data) = 0;
01056 
01060     virtual void
01061     flushPending() = 0;
01062 
01069     virtual void
01070     cloneToResultTree(
01071             const XalanNode&            node,
01072             const ElemTemplateElement*  styleNode) = 0;
01073 
01084     virtual void
01085     cloneToResultTree(
01086             const XalanNode&            node,
01087             XalanNode::NodeType         nodeType,
01088             bool                        isLiteral,
01089             bool                        overrideStrip,
01090             bool                        shouldCloneAttributes,
01091             const ElemTemplateElement*  styleNode) = 0;
01092 
01100     virtual const XObjectPtr
01101     createXResultTreeFrag(
01102             const ElemTemplateElement&  templateChild,
01103             XalanNode*                  sourceNode) = 0;
01104 
01112     virtual void
01113     outputToResultTree(
01114             const XObject&              xobj,
01115             const ElemTemplateElement*  styleNode) = 0;
01116 
01124     virtual void
01125     outputResultTreeFragment(
01126             const XObject&              theTree,
01127             const ElemTemplateElement*  styleNode) = 0;
01128 
01134     virtual const XalanDOMString&
01135     getXSLNameSpaceURL() const = 0;
01136 
01142     virtual const XalanDOMString&
01143     getXalanXSLNameSpaceURL() const = 0;
01144 
01150     virtual bool
01151     findOnElementRecursionStack(const ElemTemplateElement*  theElement) const = 0;
01152 
01158     virtual void
01159     pushOnElementRecursionStack(const ElemTemplateElement*  theElement) = 0;
01160 
01166     virtual const ElemTemplateElement*
01167     popElementRecursionStack() = 0;
01168 
01172     class ElementRecursionStackPusher
01173     {
01174     public:
01175 
01182         ElementRecursionStackPusher(
01183                     StylesheetExecutionContext&     executionContext,
01184                     const ElemTemplateElement*      element) :
01185             m_executionContext(executionContext)
01186         {
01187             m_executionContext.pushOnElementRecursionStack(element);
01188         }
01189 
01190         ~ElementRecursionStackPusher()
01191         {
01192             m_executionContext.popElementRecursionStack();
01193         }
01194 
01195     private:
01196 
01197         StylesheetExecutionContext&         m_executionContext;
01198     };
01199 
01200 
01210     virtual bool
01211     returnXResultTreeFrag(XResultTreeFrag*  theXResultTreeFrag) = 0;
01212 
01213 
01214     enum eDummy
01215     {
01216         eDefaultXMLIndentAmount = 0,
01217         eDefaultHTMLIndentAmount = 0
01218     };
01219 
01223     enum eEscapeURLs
01224     {
01225         eEscapeURLsDefault,     // Use the value in the stylesheet
01226         eEscapeURLsNo,          // Don't escape URLs
01227         eEscapeURLsYes          // Escape URLs
01228     };
01229 
01237     virtual eEscapeURLs
01238     getEscapeURLs() const = 0;
01239 
01247     virtual void
01248     setEscapeURLs(eEscapeURLs   value) = 0;
01249 
01250 
01254     enum eOmitMETATag
01255     {
01256         eOmitMETATagDefault,    // Use the value in the stylesheet
01257         eOmitMETATagNo,         // Don't omit the META tag
01258         eOmitMETATagYes         // Omit the META tag
01259     };
01260 
01268     virtual eOmitMETATag
01269     getOmitMETATag() const = 0;
01270 
01278     virtual void
01279     setOmitMETATag(eOmitMETATag     value) = 0;
01280 
01301     virtual FormatterToXML*
01302     createFormatterToXML(
01303             Writer&                 writer,
01304             const XalanDOMString&   version = XalanDOMString(),
01305             bool                    doIndent = false,
01306             int                     indent = eDefaultXMLIndentAmount,
01307             const XalanDOMString&   encoding = XalanDOMString(),
01308             const XalanDOMString&   mediaType = XalanDOMString(),
01309             const XalanDOMString&   doctypeSystem = XalanDOMString(),
01310             const XalanDOMString&   doctypePublic = XalanDOMString(),
01311             bool                    xmlDecl = true,
01312             const XalanDOMString&   standalone = XalanDOMString()) = 0;
01313 
01331     virtual FormatterToHTML*
01332     createFormatterToHTML(
01333             Writer&                 writer,
01334             const XalanDOMString&   encoding = XalanDOMString(),
01335             const XalanDOMString&   mediaType = XalanDOMString(),
01336             const XalanDOMString&   doctypeSystem = XalanDOMString(),
01337             const XalanDOMString&   doctypePublic = XalanDOMString(),
01338             bool                    doIndent = true,
01339             int                     indent = eDefaultHTMLIndentAmount,
01340             bool                    escapeURLs = true,
01341             bool                    omitMetaTag = false) = 0;
01342 
01351     virtual FormatterToDOM*
01352     createFormatterToDOM(
01353             XalanDocument*          doc,
01354             XalanDocumentFragment*  docFrag,
01355             XalanElement*           currentElement) = 0;
01356 
01365     virtual FormatterToDOM*
01366     createFormatterToDOM(
01367             XalanDocument*  doc,
01368             XalanElement*   elem) = 0;
01369 
01376     virtual FormatterToText*
01377     createFormatterToText(
01378             Writer&                 writer,
01379             const XalanDOMString&   encoding) = 0;
01380 
01386     virtual FormatterToText*
01387     borrowFormatterToText() = 0;
01388 
01395     virtual bool
01396     returnFormatterToText(FormatterToText*  theFormatter) = 0;
01397 
01398     class BorrowReturnFormatterToText
01399     {
01400     public:
01401 
01402         BorrowReturnFormatterToText(
01403                 StylesheetExecutionContext&     executionContext,
01404                 Writer&                         writer,
01405                 bool                            normalizeLinefeed = true,
01406                 bool                            handleIgnorableWhitespace = true);
01407 
01408         ~BorrowReturnFormatterToText()
01409         {
01410             assert(m_formatter != 0);
01411 
01412             m_executionContext.returnFormatterToText(m_formatter);
01413         }
01414 
01415         FormatterToText&
01416         operator*() const
01417         {
01418             assert(m_formatter != 0);
01419 
01420             return *m_formatter;
01421         }
01422 
01423         FormatterToText*
01424         get() const
01425         {
01426             assert(m_formatter != 0);
01427 
01428             return m_formatter;
01429         }
01430 
01431         FormatterToText*
01432         operator->() const
01433         {
01434             return get();
01435         }
01436 
01437     private:
01438 
01439         StylesheetExecutionContext&     m_executionContext;
01440 
01441         FormatterToText*                m_formatter;
01442     };
01443 
01444 
01450     virtual NodeSorter*
01451     borrowNodeSorter() = 0;
01452 
01459     virtual bool
01460     returnNodeSorter(NodeSorter*    theSorter) = 0;
01461 
01462     class BorrowReturnNodeSorter
01463     {
01464     public:
01465 
01466         BorrowReturnNodeSorter(StylesheetExecutionContext&  executionContext) :
01467             m_executionContext(executionContext),
01468             m_sorter(executionContext.borrowNodeSorter())
01469         {
01470             assert(m_sorter != 0);
01471         }
01472 
01473         ~BorrowReturnNodeSorter()
01474         {
01475             assert(m_sorter != 0);
01476 
01477             m_executionContext.returnNodeSorter(m_sorter);
01478         }
01479 
01480         NodeSorter&
01481         operator*() const
01482         {
01483             assert(m_sorter != 0);
01484 
01485             return *m_sorter;
01486         }
01487 
01488         NodeSorter*
01489         get() const
01490         {
01491             assert(m_sorter != 0);
01492 
01493             return m_sorter;
01494         }
01495 
01496         NodeSorter*
01497         operator->() const
01498         {
01499             return get();
01500         }
01501 
01502     private:
01503 
01504         StylesheetExecutionContext&     m_executionContext;
01505 
01506         NodeSorter*                     m_sorter;
01507     };
01508 
01509 
01510     typedef XalanAutoPtr<XalanNumberFormat>     XalanNumberFormatAutoPtr;
01511 
01518     virtual XalanNumberFormatAutoPtr
01519     createXalanNumberFormat() = 0;
01520 
01521 
01522     // Trace interface...
01523 
01529     virtual size_type
01530     getTraceListeners() const = 0;
01531 
01537     virtual void
01538     fireGenerateEvent(const GenerateEvent&  ge) = 0;
01539 
01545     virtual void
01546     fireTraceEvent(const TracerEvent&   te) = 0;
01547 
01553     virtual void
01554     fireSelectEvent(const SelectionEvent&   se) = 0;
01555 
01561     virtual bool
01562     getTraceSelects() const = 0;
01563 
01571     virtual void
01572     traceSelect(
01573             const ElemTemplateElement&  theStylesheetElement,
01574             const NodeRefListBase&      nl,
01575             const XPath*                xpath) = 0;
01576 
01577     enum eCaseOrder { eDefault, eLowerFirst, eUpperFirst };
01578 
01588     virtual int
01589     collationCompare(
01590             const XalanDOMString&   theLHS,
01591             const XalanDOMString&   theRHS,
01592             eCaseOrder              theCaseOrder = eDefault) = 0;
01593 
01604     virtual int
01605     collationCompare(
01606             const XalanDOMString&   theLHS,
01607             const XalanDOMString&   theRHS,
01608             const XalanDOMString&   theLocale,
01609             eCaseOrder              theCaseOrder = eDefault) = 0;
01610 
01620     virtual int
01621     collationCompare(
01622             const XalanDOMChar*     theLHS,
01623             const XalanDOMChar*     theRHS,
01624             eCaseOrder              theCaseOrder = eDefault) = 0;
01625 
01636     virtual int
01637     collationCompare(
01638             const XalanDOMChar*     theLHS,
01639             const XalanDOMChar*     theRHS,
01640             const XalanDOMChar*     theLocale,
01641             eCaseOrder              theCaseOrder = eDefault) = 0;
01642 
01649     virtual bool
01650     getInConstruction(const KeyDeclaration&     keyDeclaration) const = 0;
01651 
01657     virtual void
01658     beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 
01659 
01665     virtual void
01666     endConstruction(const KeyDeclaration& keyDeclaration) = 0;
01667 
01674     virtual PrintWriter*
01675     createPrintWriter(XalanOutputStream*        theTextOutputStream) = 0;
01676 
01685     virtual PrintWriter*
01686     createPrintWriter(
01687             const XalanDOMString&       theFileName,
01688             const XalanDOMString&       theEncoding) = 0;
01689 
01696     virtual PrintWriter*
01697 #if defined(XALAN_NO_NAMESPACES)
01698     createPrintWriter(ostream&          theStream) = 0;
01699 #else
01700     createPrintWriter(std::ostream&     theStream) = 0;
01701 #endif
01702 
01709     virtual CountersTable&
01710     getCountersTable() = 0;
01711 
01717     virtual void
01718     characters(const XalanNode&     node) = 0;
01719 
01725     virtual void
01726     characters(const XObjectPtr&    xobject) = 0;
01727 
01734     virtual void
01735     charactersRaw(const XalanNode&  node) = 0;
01736 
01742     virtual void
01743     charactersRaw(const XObjectPtr&     xobject) = 0;
01744 
01745 
01746     // These interfaces are inherited from XPathExecutionContext...
01747 
01748     virtual void
01749     reset() = 0;
01750 
01751     virtual XalanNode*
01752     getCurrentNode() const = 0;
01753 
01754     virtual void
01755     setCurrentNode(XalanNode*   theCurrentNode) = 0;
01756 
01757     virtual XObjectPtr
01758     createNodeSet(XalanNode&    theNode) = 0;
01759 
01760     virtual bool
01761     isNodeAfter(
01762             const XalanNode&    node1,
01763             const XalanNode&    node2) const = 0;
01764 
01765     virtual const NodeRefListBase&
01766     getContextNodeList() const = 0;
01767 
01768     virtual void    
01769     setContextNodeList(const NodeRefListBase&   theList) = 0;
01770 
01771     virtual size_type
01772     getContextNodeListLength() const = 0;
01773 
01774     virtual size_type
01775     getContextNodeListPosition(const XalanNode&     contextNode) const = 0;
01776 
01777     virtual bool
01778     elementAvailable(
01779             const XalanDOMString&   theNamespace, 
01780             const XalanDOMString&   elementName) const = 0;
01781 
01782     virtual bool
01783     functionAvailable(
01784             const XalanDOMString&   theNamespace, 
01785             const XalanDOMString&   functionName) const = 0;
01786 
01787     virtual const XObjectPtr
01788     extFunction(
01789             const XalanDOMString&           theNamespace,
01790             const XalanDOMString&           functionName,
01791             XalanNode*                      context,
01792             const XObjectArgVectorType&     argVec,
01793             const Locator*                  locator) = 0;
01794 
01795     virtual XalanDocument*
01796     parseXML(
01797             const XalanDOMString&   urlString,
01798             const XalanDOMString&   base) const = 0;
01799 
01800     virtual MutableNodeRefList*
01801     borrowMutableNodeRefList() = 0;
01802 
01803     virtual bool
01804     returnMutableNodeRefList(MutableNodeRefList*    theList) = 0;
01805 
01806     virtual MutableNodeRefList*
01807     createMutableNodeRefList() const = 0;
01808 
01809     virtual XalanDOMString&
01810     getCachedString() = 0;
01811 
01812     virtual bool
01813     releaseCachedString(XalanDOMString&     theString) = 0;
01814 
01815     virtual void
01816     getNodeSetByKey(
01817             XalanNode*              doc,
01818             const XalanDOMString&   name,
01819             const XalanDOMString&   ref,
01820             const PrefixResolver&   resolver,
01821             MutableNodeRefList&     nodelist) = 0;
01822 
01823     virtual const XObjectPtr
01824     getVariable(
01825             const XalanQName&   name,
01826             const Locator*      locator = 0) = 0;
01827 
01828     virtual const PrefixResolver*
01829     getPrefixResolver() const = 0;
01830 
01831     virtual void
01832     setPrefixResolver(const PrefixResolver*     thePrefixResolver) = 0;
01833 
01834     virtual const XalanDOMString*
01835     getNamespaceForPrefix(const XalanDOMString&     prefix) const = 0;
01836 
01837     virtual XalanDOMString
01838     findURIFromDoc(const XalanDocument*     owner) const = 0;
01839 
01840     virtual const XalanDOMString&
01841     getUnparsedEntityURI(
01842             const XalanDOMString&   theName,
01843             const XalanDocument&    theDocument) const = 0;
01844 
01845     virtual bool
01846     shouldStripSourceNode(const XalanNode&  node) = 0;
01847 
01848     virtual bool
01849     getThrowFoundIndex() const = 0;
01850 
01851     virtual void
01852     setThrowFoundIndex(bool     fThrow) = 0;
01853 
01854     virtual XalanDocument*
01855     getSourceDocument(const XalanDOMString&     theURI) const = 0;
01856 
01857     virtual void
01858     setSourceDocument(
01859             const XalanDOMString&   theURI,
01860             XalanDocument*          theDocument) = 0;
01861 
01862 
01863     virtual const XalanDecimalFormatSymbols*
01864     getDecimalFormatSymbols(const XalanQName&   qname) = 0;
01865 
01866     // These interfaces are inherited from ExecutionContext...
01867 
01868     virtual void
01869     error(
01870             const XalanDOMString&   msg,
01871             const XalanNode*        sourceNode = 0,
01872             const XalanNode*        styleNode = 0) const = 0;
01873 
01874     virtual void
01875     error(
01876             const XalanDOMString&   msg,
01877             const XalanNode*        sourceNode,
01878             const Locator*          locator) const = 0;
01879 
01880     virtual void
01881     error(
01882             const char*         msg,
01883             const XalanNode*    sourceNode = 0,
01884             const XalanNode*    styleNode = 0) const = 0;
01885 
01886     virtual void
01887     error(
01888             const char*         msg,
01889             const XalanNode*    sourceNode,
01890             const Locator*      locator) const = 0;
01891 
01892     virtual void
01893     warn(
01894             const XalanDOMString&   msg,
01895             const XalanNode*        sourceNode = 0,
01896             const XalanNode*        styleNode = 0) const = 0;
01897 
01898     virtual void
01899     warn(
01900             const XalanDOMString&   msg,
01901             const XalanNode*        sourceNode,
01902             const Locator*          locator) const = 0;
01903 
01904     virtual void
01905     warn(
01906             const char*         msg,
01907             const XalanNode*    sourceNode = 0,
01908             const XalanNode*    styleNode = 0) const = 0;
01909 
01910     virtual void
01911     warn(
01912             const char*         msg,
01913             const XalanNode*    sourceNode,
01914             const Locator*      locator) const = 0;
01915 
01916     virtual void
01917     message(
01918             const XalanDOMString&   msg,
01919             const XalanNode*        sourceNode = 0,
01920             const XalanNode*        styleNode = 0) const = 0;
01921 
01922     virtual void
01923     message(
01924             const XalanDOMString&   msg,
01925             const XalanNode*    sourceNode,
01926             const Locator*      locator) const = 0;
01927 
01928     virtual void
01929     message(
01930             const char*         msg,
01931             const XalanNode*    sourceNode = 0,
01932             const XalanNode*    styleNode = 0) const = 0;
01933 
01934     virtual void
01935     message(
01936             const char*         msg,
01937             const XalanNode*    sourceNode,
01938             const Locator*      locator) const = 0;
01939 };
01940 
01941 
01942 
01943 #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.4
Copyright © 2000, 2001, 2002 The Apache Software Foundation. All Rights Reserved.