Xalan-C++ API Documentation

The Xalan-C++ XSL Transformer Version 1.0

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 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_NO_IOSFWD)
00070 #include <ostream>
00071 #else
00072 #include <iosfwd>
00073 #endif
00074 
00075 #include <memory>
00076 
00077 
00078 
00079 // Base class header file...
00080 #include <XPath/XPathExecutionContext.hpp>
00081 
00082 
00083 
00084 #include <XalanDOM/XalanDOMString.hpp>
00085 
00086 
00087 
00088 // Base class header file...
00089 #include <PlatformSupport/ExecutionContext.hpp>
00090 
00091 
00092 
00093 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00094 #include <PlatformSupport/XalanNumberFormat.hpp>
00095 #endif
00096 
00097 
00098 
00099 #include <PlatformSupport/AttributeListImpl.hpp>
00100 #include <PlatformSupport/XalanAutoPtr.hpp>
00101 
00102 
00103 
00104 #include <XSLT/TopLevelArg.hpp>
00105 
00106 
00107 
00108 #include "KeyTable.hpp"
00109 
00110 
00111 
00112 class ElemTemplateElement;
00113 class FormatterListener;
00114 class FormatterToDOM;
00115 class FormatterToHTML;
00116 class FormatterToText;
00117 class FormatterToXML;
00118 class GenerateEvent;
00119 class KeyTable;
00120 class PrefixResolver;
00121 class NodeRefListBase;
00122 class PrintWriter;
00123 class QName;
00124 class SelectionEvent;
00125 class Stylesheet;
00126 class StylesheetRoot;
00127 class XalanOutputStream;
00128 class TracerEvent;
00129 class Writer;
00130 class XalanDocument;
00131 class XalanDocumentFragment;
00132 class XalanElement;
00133 class XalanNode;
00134 class XalanNumberFormat;
00135 class XPath;
00136 class XObject;
00137 
00138 
00139 
00140 //
00141 // An abstract class which provides support for executing stylesheets.
00142 //
00143 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext
00144 {
00145 public:
00146 
00147     explicit
00148     StylesheetExecutionContext();
00149 
00150     virtual
00151     ~StylesheetExecutionContext();
00152 
00153     // These interfaces are new...
00154 
00160     virtual bool
00161     getQuietConflictWarnings() const = 0;
00162 
00170     virtual XalanNode*
00171     getRootDocument() const = 0;
00172 
00180     virtual void
00181     setRootDocument(XalanNode*  theDocument) = 0;
00182 
00188     virtual XalanDocument*
00189     createDocument() const = 0;
00190 
00196     virtual void
00197     setStylesheetRoot(const StylesheetRoot*     theStylesheet) = 0;
00198 
00205     virtual void
00206     resetCurrentState(
00207             XalanNode*  sourceTree,
00208             XalanNode*  xmlNode) = 0;
00209 
00215     virtual bool
00216     doDiagnosticsOutput() const = 0;
00217 
00223     virtual void
00224     diag(const XalanDOMString&  theString) = 0;
00225 
00232     virtual void
00233     pushTime(const void*    theKey) = 0;
00234 
00241     virtual void
00242     displayDuration(
00243             const XalanDOMString&   theMessage,
00244             const void*             theKey) = 0;
00245 
00251     virtual XalanDOMString
00252     getPendingElementName() const = 0;
00253 
00259     virtual void
00260     setPendingElementName(const XalanDOMString&     elementName) = 0;
00261 
00267     virtual const AttributeList&
00268     getPendingAttributes() const = 0;
00269 
00275     virtual void
00276     setPendingAttributes(const AttributeList&   pendingAttributes) = 0;
00277 
00286     virtual void
00287     replacePendingAttribute(
00288             const XalanDOMChar*     theName,
00289             const XalanDOMChar*     theNewType,
00290             const XalanDOMChar*     theNewValue) = 0;
00291 
00297     virtual FormatterListener*
00298     getFormatterListener() const = 0;
00299 
00305     virtual void
00306     setFormatterListener(FormatterListener*     flistener) = 0;
00307 
00308     /*
00309      * See if there is a pending start document event waiting.
00310      * @return true if there is a start document event waiting.
00311      */
00312     virtual bool
00313     getHasPendingStartDocument() const = 0;
00314 
00319     virtual void
00320     setHasPendingStartDocument(bool b) = 0;
00321 
00326     virtual bool
00327     getMustFlushPendingStartDocument() const = 0;
00328 
00333     virtual void
00334     setMustFlushPendingStartDocument(bool   b) = 0;
00335 
00336     // This next group of classes are used to save and restore
00337     // the execution state in an automated, and exception-safe
00338     // manner.
00339 
00340     class HasPendingStartDocumentSetAndRestore
00341     {
00342     public:
00343 
00350         HasPendingStartDocumentSetAndRestore(
00351             StylesheetExecutionContext&     theExecutionContext,
00352             bool                            theNewState) :
00353                 m_executionContext(theExecutionContext),
00354                 m_savedState(theExecutionContext.getHasPendingStartDocument())
00355         {
00356             theExecutionContext.setHasPendingStartDocument(theNewState);
00357         }
00358 
00359         ~HasPendingStartDocumentSetAndRestore()
00360         {
00361             m_executionContext.setHasPendingStartDocument(m_savedState);
00362         }
00363 
00364     private:
00365 
00366         StylesheetExecutionContext&     m_executionContext;
00367 
00368         const bool                      m_savedState;
00369     };
00370 
00371     class MustFlushPendingStartDocumentSetAndRestore
00372     {
00373     public:
00374 
00381         MustFlushPendingStartDocumentSetAndRestore(
00382             StylesheetExecutionContext&     theExecutionContext,
00383             bool                            theNewState) :
00384                 m_executionContext(theExecutionContext),
00385                 m_savedState(theExecutionContext.getMustFlushPendingStartDocument())
00386         {
00387             theExecutionContext.setMustFlushPendingStartDocument(theNewState);
00388         }
00389 
00390         ~MustFlushPendingStartDocumentSetAndRestore()
00391         {
00392             m_executionContext.setMustFlushPendingStartDocument(m_savedState);
00393         }
00394 
00395     private:
00396 
00397         StylesheetExecutionContext&     m_executionContext;
00398 
00399         const bool                      m_savedState;
00400     };
00401 
00402     class FormatterListenerSetAndRestore
00403     {
00404     public:
00405 
00412         FormatterListenerSetAndRestore(
00413             StylesheetExecutionContext&     theExecutionContext,
00414             FormatterListener*              theNewListener = 0) :
00415                 m_executionContext(theExecutionContext),
00416                 m_savedListener(theExecutionContext.getFormatterListener())
00417         {
00418             theExecutionContext.setFormatterListener(theNewListener);
00419         }
00420 
00421         ~FormatterListenerSetAndRestore()
00422         {
00423             m_executionContext.setFormatterListener(m_savedListener);
00424         }
00425 
00426     private:
00427 
00428         StylesheetExecutionContext&     m_executionContext;
00429 
00430         FormatterListener* const        m_savedListener;
00431     };
00432 
00433     class PendingElementNameSetAndRestore
00434     {
00435     public:
00436 
00443         PendingElementNameSetAndRestore(
00444             StylesheetExecutionContext&     theExecutionContext,
00445             const XalanDOMString&           theNewPendingElementName = XalanDOMString()) :
00446                 m_executionContext(theExecutionContext),
00447                 m_savedPendingElementName(theExecutionContext.getPendingElementName())
00448         {
00449             theExecutionContext.setPendingElementName(theNewPendingElementName);
00450         }
00451 
00452         ~PendingElementNameSetAndRestore()
00453         {
00454             m_executionContext.setPendingElementName(m_savedPendingElementName);
00455         }
00456 
00457     private:
00458 
00459         StylesheetExecutionContext&     m_executionContext;
00460 
00461         const DOMString                 m_savedPendingElementName;
00462     };
00463 
00464     class PendingAttributesSetAndRestore
00465     {
00466     public:
00467 
00474         PendingAttributesSetAndRestore(
00475             StylesheetExecutionContext&     theExecutionContext,
00476             const AttributeListImpl&        theNewPendingAttributes = AttributeListImpl()) :
00477                 m_executionContext(theExecutionContext),
00478                 m_savedPendingAttributes(theExecutionContext.getPendingAttributes())
00479         {
00480             theExecutionContext.setPendingAttributes(theNewPendingAttributes);
00481         }
00482 
00483         ~PendingAttributesSetAndRestore()
00484         {
00485             m_executionContext.setPendingAttributes(m_savedPendingAttributes);
00486         }
00487 
00488     private:
00489 
00490         StylesheetExecutionContext&     m_executionContext;
00491 
00492         const AttributeListImpl         m_savedPendingAttributes;
00493     };
00494 
00495     class ExecutionStateSetAndRestore
00496     {
00497     public:
00498 
00507         ExecutionStateSetAndRestore(
00508             StylesheetExecutionContext&     theExecutionContext,
00509             FormatterListener*              theNewListener = 0,
00510             bool                            hasPendingStartDocument = false,
00511             bool                            mustFlushPendingStartDocument = false,
00512             const XalanDOMString&           theNewPendingElementName = XalanDOMString(),
00513             const AttributeListImpl&        theNewPendingAttributes = AttributeListImpl()) :
00514                 m_hasPendingSetAndRestore(theExecutionContext,
00515                                           hasPendingStartDocument),
00516                 m_flushPendingSetAndRestore(theExecutionContext,
00517                                             mustFlushPendingStartDocument),
00518                 m_formatterListenerSetAndRestore(theExecutionContext,
00519                                                  theNewListener),
00520                 m_pendingElementNameSetAndRestore(theExecutionContext,
00521                                                   theNewPendingElementName),
00522                 m_pendingAttributesSetAndRestore(theExecutionContext,
00523                                                  theNewPendingAttributes)
00524         {
00525         }
00526 
00527         ~ExecutionStateSetAndRestore()
00528         {
00529         }
00530 
00531     private:
00532 
00533         const HasPendingStartDocumentSetAndRestore          m_hasPendingSetAndRestore;
00534 
00535         const MustFlushPendingStartDocumentSetAndRestore    m_flushPendingSetAndRestore;
00536 
00537         const FormatterListenerSetAndRestore                m_formatterListenerSetAndRestore;
00538 
00539         const PendingElementNameSetAndRestore               m_pendingElementNameSetAndRestore;
00540 
00541         const PendingAttributesSetAndRestore                m_pendingAttributesSetAndRestore;
00542     };
00543 
00550     virtual void
00551     addResultAttribute(
00552             const XalanDOMString&   aname,
00553             const XalanDOMString&   value) = 0;
00554 
00562     virtual void
00563     copyNamespaceAttributes(
00564             const XalanNode&    src,
00565             bool                srcIsStylesheetTree) = 0;
00566 
00572     virtual const XalanDOMString&
00573     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const = 0;
00574 
00580     virtual const XalanDOMString&
00581     getResultNamespaceForPrefix(const XalanDOMString&   thePrefix) const = 0;
00582 
00588     virtual XalanDOMString
00589     getUniqueNameSpaceValue() const = 0;
00590 
00596     virtual int
00597     getIndent() const = 0;
00598 
00599     // $$$ ToDo: Remove this one!!!!
00609     virtual const XObject*
00610     executeXPath(
00611             const XalanDOMString&   str,
00612             XalanNode*              contextNode,
00613             const XalanElement&     resolver) = 0;
00614 
00623     virtual const XPath*
00624     createMatchPattern(
00625             const XalanDOMString&   str,
00626             const PrefixResolver&   resolver) = 0;
00627 
00633     virtual void
00634     returnXPath(const XPath*    xpath) = 0;
00635 
00636     // A helper class to automatically return an XPath instance.
00637     class XPathGuard
00638     {
00639     public:
00640 
00641         XPathGuard(
00642                 StylesheetExecutionContext&     context,
00643                 const XPath*                    xpath = 0) :
00644             m_context(context),
00645             m_xpath(xpath)
00646         {
00647         }
00648 
00649         ~XPathGuard()
00650         {
00651             if (m_xpath != 0)
00652             {
00653                 m_context.returnXPath(m_xpath);
00654             }
00655         }
00656 
00657         const XPath*
00658         get() const
00659         {
00660             return m_xpath;
00661         }
00662 
00663         const XPath*
00664         release()
00665         {
00666             const XPath* const  temp = m_xpath;
00667 
00668             m_xpath = 0;
00669 
00670             return temp;
00671         }
00672 
00673         void
00674         reset(const XPath*  xpath)
00675         {
00676             if (m_xpath != 0)
00677             {
00678                 m_context.returnXPath(m_xpath);
00679             }
00680 
00681             m_xpath = xpath;
00682         }
00683 
00684     private:
00685 
00686         StylesheetExecutionContext&     m_context;
00687 
00688         const XPath*                    m_xpath;
00689     };
00690 
00699     virtual const XalanDOMString
00700     evaluateAttrVal(
00701             XalanNode*              contextNode,
00702             const PrefixResolver&   namespaceContext,
00703             const XalanDOMString&   stringedValue) = 0;
00704 
00705 #if defined(XALAN_NO_NAMESPACES)
00706     typedef vector<TopLevelArg>         ParamVectorType;
00707 #else
00708     typedef std::vector<TopLevelArg>    ParamVectorType;
00709 #endif
00710 
00717     virtual void
00718     pushTopLevelVariables(const ParamVectorType&    topLevelParams) = 0;
00719 
00730     virtual const XObject*
00731     createVariable(
00732             const ElemTemplateElement*  element,
00733             const XPath&                xpath,
00734             XalanNode*                  contextNode,
00735             const PrefixResolver&       resolver) = 0;
00736 
00748     virtual const XObject*
00749     createVariable(
00750             const ElemTemplateElement*  element,
00751             const ElemTemplateElement&  templateChild,
00752             XalanNode*                  sourceTree,
00753             XalanNode*                  sourceNode,
00754             const QName&                mode) = 0;
00755 
00768     virtual void
00769     pushVariable(
00770             const QName&                name,
00771             const ElemTemplateElement*  element,
00772             const XalanDOMString&       str,
00773             XalanNode*                  contextNode,
00774             const PrefixResolver&       resolver) = 0;
00775 
00787     virtual void
00788     pushVariable(
00789             const QName&                name,
00790             const ElemTemplateElement*  element,
00791             const XPath&                xpath,
00792             XalanNode*                  contextNode,
00793             const PrefixResolver&       resolver) = 0;
00794 
00805     virtual void
00806     pushVariable(
00807             const QName&                name,
00808             const ElemTemplateElement*  element,
00809             const ElemTemplateElement&  templateChild,
00810             XalanNode*                  sourceTree,
00811             XalanNode*                  sourceNode) = 0;
00812 
00820     virtual void
00821     pushVariable(
00822             const QName&                name,
00823             const XObject*              var,
00824             const ElemTemplateElement*  element) = 0;
00825 
00830     virtual void
00831     pushContextMarker() = 0;
00832 
00836     virtual void
00837     popContextMarker() = 0;
00838 
00842     virtual void
00843     resolveTopLevelParams() = 0;
00844 
00848     virtual void
00849     clearTopLevelParams() = 0;
00850 
00861     virtual void
00862     pushParams(
00863             const ElemTemplateElement&  xslCallTemplateElement,
00864             XalanNode*                  sourceTree, 
00865             XalanNode*                  sourceNode,
00866             const QName&                mode,
00867             const ElemTemplateElement*  targetTemplate) = 0;
00868 
00876     virtual const XObject*
00877     getParamVariable(const QName&   theName) const = 0;
00878 
00884     virtual void
00885     pushElementFrame(const ElemTemplateElement*     elem) = 0;
00886 
00892     virtual void
00893     popElementFrame(const ElemTemplateElement*  elem) = 0;
00894 
00895     /*
00896      * A class to manage pushing and popping an element's stack
00897      * frame context.
00898      */
00899     class PushAndPopElementFrame
00900     {
00901     public:
00902 
00903         PushAndPopElementFrame(
00904             StylesheetExecutionContext&     executionContext,
00905             const ElemTemplateElement*      element) :
00906             m_executionContext(executionContext),
00907             m_element(element)
00908         {
00909             executionContext.pushElementFrame(element);
00910         }
00911 
00912         ~PushAndPopElementFrame()
00913         {
00914             m_executionContext.popElementFrame(m_element);
00915         }
00916 
00917     private:
00918 
00919         StylesheetExecutionContext&     m_executionContext;
00920 
00921         const ElemTemplateElement*      m_element;
00922     };
00923 
00930     virtual int
00931     getCurrentStackFrameIndex() const = 0;
00932 
00939     virtual void
00940     setCurrentStackFrameIndex(int   currentStackFrameIndex = -1) = 0;
00941 
00942     /*
00943      * A class to manage the state of the variable stacks frame index.
00944      */
00945     class SetAndRestoreCurrentStackFrameIndex
00946     {
00947     public:
00948 
00949         SetAndRestoreCurrentStackFrameIndex(
00950             StylesheetExecutionContext&     executionContext,
00951             int                             newIndex) :
00952             m_executionContext(executionContext),
00953             m_savedIndex(executionContext.getCurrentStackFrameIndex())
00954         {
00955             executionContext.setCurrentStackFrameIndex(newIndex);
00956         }
00957 
00958         ~SetAndRestoreCurrentStackFrameIndex()
00959         {
00960             m_executionContext.setCurrentStackFrameIndex(m_savedIndex);
00961         }
00962 
00963         int
00964         getStackFrameIndex() const
00965         {
00966             return m_savedIndex;
00967         }
00968 
00969     private:
00970 
00971         StylesheetExecutionContext&     m_executionContext;
00972 
00973         const int                       m_savedIndex;
00974     };
00975 
00976     /*
00977      * A class to manage stack state during execution.
00978      */
00979     class ParamsPushPop
00980     {
00981     public:
00982 
00983         ParamsPushPop(
00984             StylesheetExecutionContext&     executionContext,
00985             const ElemTemplateElement*      contextElement,
00986             const ElemTemplateElement&      xslCallTemplateElement,
00987             XalanNode*                      sourceTree, 
00988             XalanNode*                      sourceNode,
00989             const QName&                    mode,
00990             const ElemTemplateElement*      targetTemplate);
00991 
00992         ~ParamsPushPop();
00993 
00994         int
00995         getStackFrameIndex() const
00996         {
00997             return m_savedStackFrameIndex;
00998         }
00999 
01000     private:
01001 
01002         StylesheetExecutionContext&     m_executionContext;
01003     
01004         const int                       m_savedStackFrameIndex;
01005     };
01006 
01016     virtual void
01017     startDocument() = 0;
01018 
01030     virtual void
01031     endDocument() = 0;
01032 
01049     virtual void
01050     startElement(const XalanDOMChar*    name) = 0;
01051 
01066     virtual void
01067     endElement(const XalanDOMChar*  name) = 0;
01068 
01091     virtual void
01092     characters(
01093             const XalanDOMChar*     ch,
01094             unsigned int            start,
01095             unsigned int            length) = 0;
01096 
01107     virtual void
01108     charactersRaw(
01109             const XalanDOMChar*     ch,
01110             unsigned int            start,
01111             unsigned int            length) = 0;
01112 
01119     virtual void
01120     comment(const XalanDOMChar*     data) = 0;
01121 
01137     virtual void
01138     processingInstruction(
01139             const XalanDOMChar*     target,
01140             const XalanDOMChar*     data) = 0;
01141 
01145     virtual void
01146     flushPending() = 0;
01147 
01156     virtual void
01157     cloneToResultTree(
01158             XalanNode&  node, 
01159             bool        isLiteral,
01160             bool        overrideStrip,
01161             bool        shouldCloneAttributes) = 0;
01162 
01171     virtual const XObject*
01172     createXResultTreeFrag(
01173             const ElemTemplateElement&  templateChild,
01174             XalanNode*                  sourceTree,
01175             XalanNode*                  sourceNode) = 0;
01176 
01186     virtual const XObject*
01187     createXResultTreeFrag(
01188             const ElemTemplateElement&  templateChild,
01189             XalanNode*                  sourceTree,
01190             XalanNode*                  sourceNode,
01191             const QName&                mode) = 0;
01192 
01201     virtual bool
01202     destroyXObject(const XObject*   theXObject) const = 0;
01203 
01210     virtual void
01211     outputToResultTree(const XObject&   xobj) = 0;
01212 
01219     virtual void
01220     outputResultTreeFragment(const XObject&     theTree) = 0;
01221 
01227     virtual const XalanDOMString&
01228     getXSLNameSpaceURL() const = 0;
01229 
01235     virtual const XalanDOMString&
01236     getXalanXSLNameSpaceURL() const = 0;
01237 
01243     virtual bool
01244     findOnElementRecursionStack(const ElemTemplateElement*  theElement) const = 0;
01245 
01251     virtual void
01252     pushOnElementRecursionStack(const ElemTemplateElement*  theElement) = 0;
01253 
01259     virtual const ElemTemplateElement*
01260     popElementRecursionStack() = 0;
01261 
01265     class ElementRecursionStackPusher
01266     {
01267     public:
01268 
01275         ElementRecursionStackPusher(
01276                     StylesheetExecutionContext&     executionContext,
01277                     const ElemTemplateElement*      element) :
01278             m_executionContext(executionContext)
01279         {
01280             m_executionContext.pushOnElementRecursionStack(element);
01281         }
01282 
01283         ~ElementRecursionStackPusher()
01284         {
01285             m_executionContext.popElementRecursionStack();
01286         }
01287 
01288     private:
01289 
01290         StylesheetExecutionContext&         m_executionContext;
01291     };
01292 
01293 
01314     virtual FormatterToXML*
01315     createFormatterToXML(
01316             Writer&                 writer,
01317             const XalanDOMString&   version = XalanDOMString(),
01318             bool                    doIndent = false,
01319             int                     indent = 0,
01320             const XalanDOMString&   encoding = XalanDOMString(),
01321             const XalanDOMString&   mediaType = XalanDOMString(),
01322             const XalanDOMString&   doctypeSystem = XalanDOMString(),
01323             const XalanDOMString&   doctypePublic = XalanDOMString(),
01324             bool                    xmlDecl = true,
01325             const XalanDOMString&   standalone = XalanDOMString()) = 0;
01326 
01327     enum eDummy
01328     {
01329         eDefaultHTMLIndentAmount = 4
01330     };
01331 
01352     virtual FormatterToHTML*
01353     createFormatterToHTML(
01354             Writer&                 writer,
01355             const XalanDOMString&   encoding = XalanDOMString(),
01356             const XalanDOMString&   mediaType = XalanDOMString(),
01357             const XalanDOMString&   doctypeSystem = XalanDOMString(),
01358             const XalanDOMString&   doctypePublic = XalanDOMString(),
01359             bool                    doIndent = true,
01360             int                     indent = 4,
01361             const XalanDOMString&   version = XalanDOMString(),
01362             const XalanDOMString&   standalone = XalanDOMString(),
01363             bool                    xmlDecl = false) = 0;
01364 
01373     virtual FormatterToDOM*
01374     createFormatterToDOM(
01375             XalanDocument*          doc,
01376             XalanDocumentFragment*  docFrag,
01377             XalanElement*           currentElement) = 0;
01378 
01387     virtual FormatterToDOM*
01388     createFormatterToDOM(
01389             XalanDocument*  doc,
01390             XalanElement*   elem) = 0;
01391 
01397     virtual FormatterToText*
01398     createFormatterToText(Writer&   writer) = 0;
01399 
01400 
01401     typedef XalanAutoPtr<XalanNumberFormat>     XalanNumberFormatAutoPtr;
01402 
01409     virtual XalanNumberFormatAutoPtr
01410     createXalanNumberFormat() = 0;
01411 
01412 
01413     // Trace interface...
01414 
01420     virtual unsigned long
01421     getTraceListeners() const = 0;
01422 
01428     virtual void
01429     fireGenerateEvent(const GenerateEvent&  ge) = 0;
01430 
01436     virtual void
01437     fireTraceEvent(const TracerEvent&   te) = 0;
01438 
01444     virtual void
01445     fireSelectEvent(const SelectionEvent&   se) = 0;
01446 
01452     virtual bool
01453     getTraceSelects() const = 0;
01454 
01461     virtual void
01462     traceSelect(
01463             const XalanElement&     theTemplate,
01464             const NodeRefListBase&  nl) const = 0;
01465 
01474     virtual int
01475     collationCompare(
01476             const XalanDOMString&   theLHS,
01477             const XalanDOMString&   theRHS) const = 0;
01478 
01487     virtual int
01488     collationCompare(
01489             const XalanDOMChar*     theLHS,
01490             const XalanDOMChar*     theRHS) const = 0;
01491 
01498     virtual bool
01499     getInConstruction(const KeyDeclaration&     keyDeclaration) const = 0;
01500 
01506     virtual void
01507     beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 
01508     
01514     virtual void
01515     endConstruction(const KeyDeclaration& keyDeclaration) = 0;
01516 
01523     virtual PrintWriter*
01524     createPrintWriter(XalanOutputStream*        theTextOutputStream) = 0;
01525 
01534     virtual PrintWriter*
01535     createPrintWriter(
01536             const XalanDOMString&       theFileName,
01537             const XalanDOMString&       theEncoding) = 0;
01538 
01545     virtual PrintWriter*
01546 #if defined(XALAN_NO_NAMESPACES)
01547     createPrintWriter(ostream&          theStream) = 0;
01548 #else
01549     createPrintWriter(std::ostream&     theStream) = 0;
01550 #endif
01551 
01552     // These interfaces are inherited from XPathExecutionContext...
01553 
01554     virtual void
01555     reset() = 0;
01556 
01557     virtual XalanNode*
01558     getCurrentNode() const = 0;
01559 
01560     virtual void
01561     setCurrentNode(XalanNode*   theCurrentNode) = 0;
01562 
01563     virtual XObjectFactory&
01564     getXObjectFactory() const = 0;
01565 
01566     virtual XObject*
01567     createNodeSet(XalanNode&    theNode) = 0;
01568 
01569     virtual bool
01570     isIgnorableWhitespace(const XalanText&  node) const = 0;
01571 
01572     virtual XalanDOMString
01573     getNamespaceOfNode(const XalanNode&     n) const = 0;
01574 
01575     virtual XalanDOMString
01576     getNameOfNode(const XalanNode&  n) const = 0;
01577 
01578     virtual XalanDOMString
01579     getLocalNameOfNode(const XalanNode&     n) const = 0;
01580 
01581     virtual XalanNode*
01582     getParentOfNode(const XalanNode&    n) const = 0;
01583 
01584     virtual bool
01585     isNodeAfter(
01586             const XalanNode&    node1,
01587             const XalanNode&    node2) const = 0;
01588 
01589     virtual XalanDOMString
01590     getNodeData(const XalanNode&    n) const = 0;
01591 
01592     virtual XalanElement*
01593     getElementByID(
01594             const XalanDOMString&       id,
01595             const XalanDocument&        doc) const = 0;
01596 
01597     virtual const NodeRefListBase&
01598     getContextNodeList() const = 0;
01599 
01600     virtual void    
01601     setContextNodeList(const NodeRefListBase&   theList) = 0;
01602 
01603     virtual unsigned int
01604     getContextNodeListLength() const = 0;
01605 
01606     virtual unsigned int
01607     getContextNodeListPosition(const XalanNode&     contextNode) const = 0;
01608 
01609     virtual bool
01610     elementAvailable(
01611             const XalanDOMString&   theNamespace, 
01612             const XalanDOMString&   elementName) const = 0;
01613 
01614     virtual bool
01615     functionAvailable(
01616             const XalanDOMString&   theNamespace, 
01617             const XalanDOMString&   functionName) const = 0;
01618 
01619     virtual XObjectArgVectorType&
01620     pushArgVector() = 0;
01621 
01622     virtual void
01623     popArgVector() = 0;
01624 
01625     virtual const XObject*
01626     extFunction(
01627             const XalanDOMString&           theNamespace,
01628             const XalanDOMString&           functionName,
01629             XalanNode*                      context,
01630             const XObjectArgVectorType&     argVec) = 0;
01631 
01632     virtual XLocator*
01633     getXLocatorFromNode(const XalanNode*    node) const = 0;
01634 
01635     virtual void
01636     associateXLocatorToNode(
01637             const XalanNode*    node,
01638             XLocator*           xlocator) = 0;
01639 
01640     virtual XalanDocument*
01641     parseXML(
01642             const XalanDOMString&   urlString,
01643             const XalanDOMString&   base) const = 0;
01644 
01645     virtual MutableNodeRefList*
01646     borrowMutableNodeRefList() = 0;
01647 
01648     virtual bool
01649     returnMutableNodeRefList(MutableNodeRefList*    theList) = 0;
01650 
01651     virtual MutableNodeRefList*
01652     createMutableNodeRefList() const = 0;
01653 
01654     virtual bool
01655     getProcessNamespaces() const = 0;
01656 
01657     virtual void
01658     getNodeSetByKey(
01659             XalanNode*              doc,
01660             const XalanDOMString&   name,
01661             const XalanDOMString&   ref,
01662             const PrefixResolver&   resolver,
01663             MutableNodeRefList&     nodelist) = 0;
01664 
01665     virtual const XObject*
01666     getVariable(const QName&    name) const = 0;
01667 
01668     virtual const PrefixResolver*
01669     getPrefixResolver() const = 0;
01670 
01671     virtual void
01672     setPrefixResolver(const PrefixResolver*     thePrefixResolver) = 0;
01673 
01674     virtual XalanDOMString
01675     getNamespaceForPrefix(const XalanDOMString&     prefix) const = 0;
01676 
01677     virtual XalanDOMString
01678     findURIFromDoc(const XalanDocument*     owner) const = 0;
01679 
01680     virtual XalanDocument*
01681     getDOMFactory() const = 0;
01682 
01683     virtual XalanDOMString
01684     getUnparsedEntityURI(
01685             const XalanDOMString&   theName,
01686             const XalanDocument&    theDocument) const = 0;
01687 
01688     virtual bool
01689     shouldStripSourceNode(const XalanNode&  node) = 0;
01690 
01691     virtual bool
01692     getThrowFoundIndex() const = 0;
01693 
01694     virtual void
01695     setThrowFoundIndex(bool     fThrow) = 0;
01696 
01697     virtual void
01698     setCurrentPattern(const XalanDOMString&     thePattern) = 0;
01699 
01700     virtual XalanDOMString
01701     getCurrentPattern() const = 0;
01702 
01703     virtual XalanDocument*
01704     getSourceDocument(const XalanDOMString&     theURI) const = 0;
01705 
01706     virtual void
01707     setSourceDocument(
01708             const XalanDOMString&   theURI,
01709             XalanDocument*          theDocument) = 0;
01710 
01711 
01712     virtual const XalanDecimalFormatSymbols*
01713     getDecimalFormatSymbols(const XalanDOMString&   name) = 0;
01714 
01715 
01716     // These interfaces are inherited from ExecutionContext...
01717 
01718     virtual void
01719     error(
01720             const XalanDOMString&   msg,
01721             const XalanNode*        sourceNode = 0,
01722             const XalanNode*        styleNode = 0) const = 0;
01723 
01724     virtual void
01725     warn(
01726             const XalanDOMString&   msg,
01727             const XalanNode*        sourceNode = 0,
01728             const XalanNode*        styleNode = 0) const = 0;
01729 
01730     virtual void
01731     message(
01732             const XalanDOMString&   msg,
01733             const XalanNode*        sourceNode = 0,
01734             const XalanNode*        styleNode = 0) const = 0;
01735 };
01736 
01737 
01738 
01739 #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++ XSL Transformer Version 1.0
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.