Xalan-C++ API Documentation

The Xalan C++ XSL Transformer Version 1.1

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

XSLTEngineImpl.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 #if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
00058 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD
00059 
00060 
00061 
00062 // Base include file.  Must be first.
00063 #include "XSLTDefinitions.hpp"
00064 
00065 
00066 
00067 // Base class
00068 #include "XSLTProcessor.hpp"
00069 
00070 
00071 
00072 
00073 // Standard library headers
00074 #include <cassert>
00075 #include <ctime>
00076 #include <map>
00077 #include <set>
00078 
00079 
00080 
00081 #include <sax/DocumentHandler.hpp>
00082 
00083 
00084 
00085 #include <XalanDOM/XalanDOMString.hpp>
00086 
00087 
00088 
00089 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00090 #include <XPath/XPathProcessor.hpp>
00091 #endif
00092 
00093 
00094 
00095 #include <Include/XalanAutoPtr.hpp>
00096 
00097 
00098 
00099 #include <PlatformSupport/AttributeListImpl.hpp>
00100 #include <PlatformSupport/DOMStringHelper.hpp>
00101 
00102 
00103 
00104 #include <DOMSupport/PrefixResolver.hpp>
00105 
00106 
00107 
00108 #include <XPath/Function.hpp>
00109 #include <XPath/NameSpace.hpp>
00110 
00111 
00112 
00113 #include "KeyDeclaration.hpp"
00114 #include "OutputContextStack.hpp"
00115 #include "ProblemListenerDefault.hpp"
00116 #include "ResultNamespacesStack.hpp"
00117 #include "StylesheetExecutionContext.hpp"
00118 #include "XSLTProcessorException.hpp"
00119 
00120 
00121 
00122 // Forward definitions
00123 class DOMSupport;
00124 class GenerateEvent;
00125 class PrintWriter;
00126 class ResultTreeFragBase;
00127 class StylesheetConstructionContext;
00128 class StylesheetExecutionContext;
00129 class StylesheetRoot;
00130 class XalanAttr;
00131 class XalanSourceTreeDocument;
00132 class XalanText;
00133 class XLocator;
00134 class XMLParserLiaison;
00135 class XMLURL;
00136 class XObject;
00137 class XPathEnvSupport;
00138 class XPathFactory;
00139 class XPathProcessor;
00140 class XSLTResultTarget;
00141 
00142 
00143 
00155 
00156 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, private DocumentHandler, public PrefixResolver
00157 {
00158 public:
00159 
00160 #if defined(XALAN_NO_NAMESPACES)
00161     typedef map<XalanDOMString,
00162                 int,
00163                 less<XalanDOMString> >      AttributeKeysMapType;
00164     typedef map<XalanDOMString,
00165                 int,
00166                 less<XalanDOMString> >      ElementKeysMapType;
00167     typedef map<const void*,
00168                 clock_t,
00169                 less<const void*> >         DurationsTableMapType;
00170     typedef vector<const Locator*>          LocatorStack;
00171     typedef vector<TraceListener*>          TraceListenerVectorType;
00172     typedef vector<bool>                    BoolVectorType;
00173 #else
00174     typedef std::map<XalanDOMString, int>       AttributeKeysMapType;
00175     typedef std::map<XalanDOMString, int>       ElementKeysMapType;
00176     typedef std::map<const void*, clock_t>      DurationsTableMapType;
00177     typedef std::vector<const Locator*>         LocatorStack;
00178     typedef std::vector<TraceListener*>         TraceListenerVectorType;
00179     typedef std::vector<bool>                   BoolVectorType;
00180 #endif
00181 
00182     typedef XalanAutoPtr<XPathProcessor>                XPathProcessorPtrType;
00183     typedef Function::XObjectArgVectorType              XObjectArgVectorType;
00184     typedef StylesheetExecutionContext::ParamVectorType ParamVectorType;
00185 
00186     // Public members
00187     //---------------------------------------------------------------------
00188 
00201     XSLTEngineImpl(
00202             XMLParserLiaison&   parserLiaison,
00203             XPathEnvSupport&    xpathEnvSupport,
00204             DOMSupport&         domSupport,
00205             XObjectFactory&     xobjectFactory,
00206             XPathFactory&       xpathFactory);
00207 
00208     virtual
00209     ~XSLTEngineImpl();
00210 
00215     static void
00216     initialize();
00217 
00221     static void
00222     terminate();
00223 
00224     // These methods are inherited from XSLTProcessor ...
00225     
00226     virtual void
00227     process(
00228             const XSLTInputSource&          inputSource, 
00229             const XSLTInputSource&          stylesheetSource,
00230             XSLTResultTarget&               outputTarget,
00231             StylesheetConstructionContext&  constructionContext,
00232             StylesheetExecutionContext&     executionContext);
00233 
00234     virtual void
00235     process(
00236             const XSLTInputSource&          inputSource,
00237             XSLTResultTarget&               outputTarget,
00238             StylesheetExecutionContext&     executionContext);
00239 
00240     virtual StylesheetRoot*
00241     processStylesheet(
00242             const XSLTInputSource&          stylesheetSource,
00243             StylesheetConstructionContext&  constructionContext);
00244 
00245     virtual StylesheetRoot*
00246     processStylesheet(
00247             const XalanDOMString&           xsldocURLString,
00248             StylesheetConstructionContext&  constructionContext);
00249 
00250     virtual XalanNode*
00251     getSourceTreeFromInput(const XSLTInputSource&   inputSource);
00252 
00253     virtual void
00254     outputToResultTree(
00255             StylesheetExecutionContext&     executionContext,
00256             const XObject&                  xobj);
00257 
00258     virtual void
00259     resetCurrentState(
00260             XalanNode*  sourceTree,
00261             XalanNode*  xmlNode);
00262 
00263     virtual XalanDOMString
00264     evaluateAttrVal(
00265             XalanNode*              contextNode,
00266             const PrefixResolver&   namespaceContext,
00267             const XalanDOMString&   stringedValue,
00268             XPathExecutionContext&  executionContext);
00269 
00270     virtual void
00271     resolveTopLevelParams(StylesheetExecutionContext&   executionContext);
00272 
00273     virtual XMLParserLiaison&
00274     getXMLParserLiaison() const;
00275 
00276     virtual const XalanDOMString
00277     getUniqueNamespaceValue() const;
00278 
00279     virtual void
00280     getUniqueNamespaceValue(XalanDOMString&     theValue) const;
00281 
00282     virtual void
00283     setStylesheetParam( 
00284                     const XalanDOMString&   key,
00285                     const XalanDOMString&   expression);
00286 
00287     virtual void
00288     setStylesheetParam(
00289             const XalanDOMString&   key,
00290             XObjectPtr              value);
00291 
00292     virtual bool
00293     shouldStripSourceNode(
00294             XPathExecutionContext&  executionContext,
00295             const XalanNode&        node) const;
00296 
00297     virtual FormatterListener*
00298     getFormatterListener() const;
00299 
00300     virtual void
00301     setFormatterListener(FormatterListener* flistener);
00302 
00303     // Trace-related functions...
00304 
00305     virtual unsigned long
00306     getTraceListeners() const;
00307 
00308     virtual void
00309     addTraceListener(TraceListener*     tl);
00310 
00311     virtual void
00312     removeTraceListener(TraceListener*  tl);
00313 
00314     virtual void
00315     fireGenerateEvent(const GenerateEvent&  ge);
00316       
00317     virtual void
00318     fireTraceEvent(const TracerEvent&   te);
00319 
00320     virtual void
00321     fireSelectEvent(const SelectionEvent&   se);
00322 
00323     virtual bool
00324     getTraceSelects() const;
00325 
00326     virtual void
00327     setTraceSelects(bool    b);
00328 
00329     virtual void
00330     traceSelect(
00331             const XalanElement&     theTemplate,
00332             const NodeRefListBase&  nl) const;
00333 
00334     virtual void
00335     setQuietConflictWarnings(bool   b);
00336 
00337     virtual void
00338     setDiagnosticsOutput(PrintWriter*   pw);
00339 
00340 
00341     // Inherited from PrefixResolver...
00342 
00351     virtual const XalanDOMString&
00352     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00353 
00359     virtual const XalanDOMString&
00360     getURI() const;
00361 
00373     XalanDocument*
00374     parseXML(
00375             const XalanDOMString&   urlString,
00376             DocumentHandler*        docHandler,
00377             XalanDocument*          docToRegister);
00378 
00391     Stylesheet*
00392     getStylesheetFromPIURL(
00393             const XalanDOMString&           xslURLString,
00394             XalanNode&                      fragBase,
00395             const XalanDOMString&           xmlBaseIdent,
00396             bool                            isRoot,
00397             StylesheetConstructionContext&  constructionContext);
00398 
00402     void
00403     flushPending();
00404 
00411     void
00412     addResultNamespaceDecl(
00413             const XalanDOMString&   prefix, 
00414             const XalanDOMString&   namespaceVal);
00415 
00424     void
00425     addResultAttribute(
00426             AttributeListImpl&  attList,
00427             const XalanDOMString&   aname,
00428             const XalanDOMString&   value);
00429 
00437     void
00438     addResultAttribute(
00439             const XalanDOMString&   aname,
00440             const XalanDOMString&   value)
00441     {
00442         assert(m_outputContextStack.size() > 0);
00443 
00444         addResultAttribute(getPendingAttributesImpl(),
00445                            aname,
00446                            value);
00447     }
00448 
00473     virtual void
00474     characters(
00475             const XMLCh* const  ch,
00476             const unsigned int  start,
00477             const unsigned int  length);
00478 
00486     virtual void
00487     startElement(
00488             const XMLCh* const  name);
00489 
00500     virtual void
00501     charactersRaw(
00502             const XMLCh* const  ch,
00503             const unsigned int  start,
00504             const unsigned int  length);
00505 
00512     virtual void
00513     comment(
00514             const XMLCh* const  data);
00515 
00522     virtual void
00523     entityReference(
00524             const XMLCh* const  data);
00525 
00548     virtual void
00549     cdata(
00550             const XMLCh* const  ch,
00551             const unsigned int  start,
00552             const unsigned int  length);
00553 
00562     void
00563     cloneToResultTree(
00564             XalanNode&  node, 
00565             bool        isLiteral,
00566             bool        overrideStrip,
00567             bool        shouldCloneAttributes);
00568 
00575     void
00576     outputResultTreeFragment(
00577             StylesheetExecutionContext&     executionContext,
00578             const XObject&                  theTree);
00579 
00585     virtual const StylesheetRoot*
00586     getStylesheetRoot() const;
00587 
00593     virtual void
00594     setStylesheetRoot(const StylesheetRoot*     theStylesheet);
00595 
00601     virtual void
00602     setExecutionContext(StylesheetExecutionContext*     theExecutionContext);
00603 
00610     static const XalanDOMString&
00611     getXSLNameSpaceURL()
00612     {
00613         return s_XSLNameSpaceURL;
00614     }
00615 
00621     static const XalanDOMString&
00622     getXalanXSLNameSpaceURL()
00623     {
00624         return s_XSLT4JNameSpaceURL;
00625     }
00626 
00632     static double
00633     getXSLTVerSupported();
00634 
00640     static const AttributeKeysMapType&
00641     getAttributeKeys()
00642     {
00643         return s_attributeKeys;
00644     }
00645 
00651     static const ElementKeysMapType&
00652     getElementKeys()
00653     {
00654         return s_elementKeys;
00655     }
00656 
00665     static int
00666     getElementToken(const XalanDOMString&   name)
00667     {
00668         AttributeKeysMapType::const_iterator iter=
00669             s_elementKeys.find(name);
00670 
00671         return iter == s_elementKeys.end() ? -2 : (*iter).second;
00672     }
00673 
00682     static int
00683     getAttrTok(const XalanDOMString&    name)
00684     {
00685         AttributeKeysMapType::const_iterator iter=
00686             s_attributeKeys.find(name);
00687 
00688         return iter == s_attributeKeys.end() ? -2 : (*iter).second;
00689     }
00690 
00700     int
00701     getXSLToken(const XalanNode&    node) const;
00702 
00710     bool
00711     isXSLTagOfType(
00712             const XalanNode& node,
00713             int         tagType) const;
00714 
00720     bool
00721     getQuietConflictWarnings() const
00722     {
00723         return m_quietConflictWarnings;
00724     }
00725 
00726     virtual void
00727     message(
00728             const XalanDOMString&   msg,
00729             const XalanNode*        styleNode = 0,
00730             const XalanNode*        sourceNode = 0) const;
00731 
00732     virtual void
00733     message(
00734             const char*         msg,
00735             const XalanNode*    styleNode = 0,
00736             const XalanNode*    sourceNode = 0) const;
00737 
00746     virtual void
00747     warn(
00748             const XalanDOMString&   msg,
00749             const XalanNode*        styleNode = 0,
00750             const XalanNode*        sourceNode = 0) const;
00751 
00760     virtual void
00761     warn(
00762             const char*         msg,
00763             const XalanNode*    styleNode = 0,
00764             const XalanNode*    sourceNode = 0) const;
00765 
00774     virtual void
00775     error(
00776             const XalanDOMString&   msg,
00777             const XalanNode*        styleNode = 0,
00778             const XalanNode*        sourceNode = 0) const;
00779 
00788     virtual void
00789     error(
00790             const char*         msg,
00791             const XalanNode*    styleNode = 0,
00792             const XalanNode*    sourceNode = 0) const;
00793 
00800     void
00801     pushTime(const void*    key) const;
00802 
00809     clock_t
00810     popDuration(const void*     key) const;
00811 
00819     void
00820     displayDuration(
00821             const XalanDOMString&   info,
00822             const void*             key) const;
00823 
00824 
00830     bool doDiagnosticsOutput()
00831     {   return 0 != m_diagnosticsPrintWriter; }
00832 
00838     void
00839     diag(const XalanDOMString&  s) const;
00840 
00846     void
00847     diag(const char*    s) const;
00848 
00856     bool
00857     isCDataResultElem(const XalanDOMString&     elementName) const;
00858     
00866     bool
00867     qnameEqualsResultElemName(
00868             const QName&            qname,
00869             const XalanDOMString&   elementName) const;
00870     
00877     const XalanDOMString&
00878     getResultNamespaceForPrefix(const XalanDOMString&   prefix) const;
00879   
00886     const XalanDOMString&
00887     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const;
00888 
00897     double
00898     evalMatchPatternStr(
00899             const XalanDOMString&   str,
00900             XalanNode*              context,
00901             XPathExecutionContext&  executionContext);
00902 
00910     const XPath*
00911     createMatchPattern(
00912             const XalanDOMString&   str,
00913             const PrefixResolver&   resolver);
00914 
00921     void
00922     returnXPath(const XPath*    xpath);
00923 
00929     void
00930     copyNamespaceAttributes(const XalanNode&    src);
00931 
00939     const XObjectPtr
00940     evalXPathStr(
00941             const XalanDOMString&   str,
00942             XPathExecutionContext&  executionContext);
00943 
00953     const XObjectPtr
00954     evalXPathStr(
00955             const XalanDOMString&   str,
00956             XalanNode*              contextNode,
00957             const PrefixResolver&   prefixResolver,
00958             XPathExecutionContext&  executionContext);
00959 
00969     const XObjectPtr
00970     evalXPathStr(
00971             const XalanDOMString&   str,
00972             XalanNode*              contextNode,
00973             const XalanElement&     prefixResolver,
00974             XPathExecutionContext&  executionContext);
00975 
00987     void
00988     copyAttributeToTarget(
00989             const XalanAttr&        attr,
00990             XalanNode*              contextNode,
00991             const Stylesheet*       stylesheetTree,
00992             AttributeListImpl&      attrList, 
00993             const XalanElement&     namespaceContext);
00994 
01000     XPathFactory&
01001     getXPathFactory()
01002     {
01003         return m_xpathFactory;
01004     }
01005 
01011     XPathProcessor&
01012     getXPathProcessor()
01013     {
01014         return *m_xpathProcessor.get();
01015     }
01016 
01021     virtual void
01022     reset();
01023 
01028     virtual XalanDocument*
01029     getDOMFactory() const;
01030 
01036     XPathEnvSupport&
01037     getXPathEnvSupport()
01038     {
01039         return m_xpathEnvSupport;
01040     }
01041 
01050     void
01051     setProblemListener(ProblemListener*     l)
01052     {
01053         m_problemListener = l;
01054     }
01055 
01064     ProblemListener*
01065     getProblemListener() const
01066     {
01067         return m_problemListener;
01068     }
01069 
01070     /*
01071      * Push a new output context using the provided FormatterListener.
01072      *
01073      * @param A pointer to the FormatterListener instance for the new context.
01074      */
01075     void
01076     pushOutputContext(FormatterListener*    theListener)
01077     {
01078         m_outputContextStack.pushContext(theListener);
01079     }
01080 
01081     /*
01082      * Pop the current output context.
01083      */
01084     void
01085     popOutputContext()
01086     {
01087         m_outputContextStack.popContext();
01088     }
01089 
01090     /*
01091      * See if there is a pending start document event waiting.
01092      * @return true if there is a start document event waiting.
01093      */
01094     bool
01095     getHasPendingStartDocument() const
01096     {
01097         return getHasPendingStartDocumentImpl();
01098     }
01099 
01100     /*
01101      * Set the pending start document event state.
01102      * @param the new value
01103      */
01104     void
01105     setHasPendingStartDocument(bool b)
01106     {
01107         setHasPendingStartDocumentImpl(b);
01108     }
01109 
01110     /*
01111      * See if a pending start document event must be flushed.
01112      * @return true if the event must be flushed.
01113      */
01114     bool
01115     getMustFlushPendingStartDocument() const
01116     {
01117         return getMustFlushPendingStartDocumentImpl();
01118     }
01119 
01120     /*
01121      * Set the pending start document event flush state.
01122      * @param the new value
01123      */
01124     void
01125     setMustFlushPendingStartDocument(bool   b)
01126     {
01127         setMustFlushPendingStartDocumentImpl(b);
01128     }
01129 
01135     const AttributeList&
01136     getPendingAttributes() const
01137     {
01138         return getPendingAttributesImpl();
01139     }
01140 
01146     void
01147     setPendingAttributes(const AttributeList&   pendingAttributes)
01148     {
01149         getPendingAttributesImpl() = pendingAttributes;
01150     }
01151 
01159     void
01160     replacePendingAttribute(
01161             const XalanDOMChar*     theName,
01162             const XalanDOMChar*     theNewType,
01163             const XalanDOMChar*     theNewValue)
01164     {
01165         // Remove the old attribute, then add the new one.  AttributeListImpl::addAttribute()
01166         // does this for us.
01167         getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
01168     }
01169 
01170     bool
01171     isElementPending() const
01172     {
01173         return length(getPendingElementNameImpl()) != 0 ? true : false;
01174     }
01175 
01181     const XalanDOMString&
01182     getPendingElementName() const
01183     {
01184         return getPendingElementNameImpl();
01185     }
01186 
01192     void
01193     setPendingElementName(const XalanDOMString&     elementName)
01194     {
01195         setPendingElementNameImpl(elementName);
01196     }
01197 
01198     void
01199     setPendingElementName(const XalanDOMChar*   elementName)
01200     {
01201         setPendingElementNameImpl(elementName);
01202     }
01203 
01209     const Locator*
01210     getLocatorFromStack() const
01211     {
01212         return m_stylesheetLocatorStack.size() == 0 ? 0 : m_stylesheetLocatorStack.back();
01213     }
01214 
01220     void
01221     pushLocatorOnStack(const Locator*   locator)
01222     {
01223         m_stylesheetLocatorStack.push_back(locator);
01224     }
01225 
01229     void
01230     popLocatorStack()
01231     {
01232         if (m_stylesheetLocatorStack.size() != 0)
01233         {
01234             m_stylesheetLocatorStack.pop_back();
01235         }
01236     }
01237 
01238 
01239     // These methods are inherited from DocumentHandler ...
01240     
01241     virtual void
01242     setDocumentLocator(const Locator* const     locator);
01243 
01244     virtual void
01245     startDocument();
01246 
01247     virtual void
01248     endDocument();
01249     
01250     virtual void
01251     startElement(
01252             const XMLCh* const  name,
01253             AttributeList&      atts);
01254 
01255     virtual void
01256     endElement(
01257             const XMLCh* const  name);
01258 
01259     virtual void characters (
01260         const XMLCh* const  chars,
01261         const unsigned int  length);
01262 
01263     virtual void
01264     ignorableWhitespace(
01265             const XMLCh* const  ch,
01266             const unsigned int  length);
01267 
01268     virtual void
01269     processingInstruction(
01270             const XMLCh* const  target,
01271             const XMLCh* const  data);
01272 
01273     virtual void
01274     resetDocument();
01275 
01276 protected:
01277 
01283     const AttributeListImpl&
01284     getPendingAttributesImpl() const
01285     {
01286         return m_outputContextStack.getPendingAttributes();
01287     }
01288 
01294     AttributeListImpl&
01295     getPendingAttributesImpl()
01296     {
01297         return m_outputContextStack.getPendingAttributes();
01298     }
01299 
01305     void
01306     setPendingAttributesImpl(const AttributeList&   pendingAttributes)
01307     {
01308         getPendingAttributesImpl() = pendingAttributes;
01309     }
01310 
01316     const XalanDOMString&
01317     getPendingElementNameImpl() const
01318     {
01319         return m_outputContextStack.getPendingElementName();
01320     }
01321 
01327     XalanDOMString&
01328     getPendingElementNameImpl()
01329     {
01330         return m_outputContextStack.getPendingElementName();
01331     }
01332 
01338     void
01339     setPendingElementNameImpl(const XalanDOMString&     elementName)
01340     {
01341         m_outputContextStack.getPendingElementName() = elementName;
01342     }
01343 
01349     void
01350     setPendingElementNameImpl(const XalanDOMChar*   elementName)
01351     {
01352         assert(elementName != 0);
01353 
01354         m_outputContextStack.getPendingElementName() = elementName;
01355     }
01356 
01357     /*
01358      * See if there is a pending start document event waiting.
01359      * @return true if there is a start document event waiting.
01360      */
01361     bool
01362     getHasPendingStartDocumentImpl() const
01363     {
01364         return m_outputContextStack.getHasPendingStartDocument();
01365     }
01366 
01367     /*
01368      * Set the pending start document event state.
01369      * @param the new value
01370      */
01371     void
01372     setHasPendingStartDocumentImpl(bool     b)
01373     {
01374         m_outputContextStack.getHasPendingStartDocument() = b;
01375     }
01376 
01377     /*
01378      * See if a pending start document event must be flushed.
01379      * @return true if the event must be flushed.
01380      */
01381     bool
01382     getMustFlushPendingStartDocumentImpl() const
01383     {
01384         return m_outputContextStack.getMustFlushPendingStartDocument();
01385     }
01386 
01387     /*
01388      * Set the pending start document event flush state.
01389      * @param the new value
01390      */
01391     void
01392     setMustFlushPendingStartDocumentImpl(bool   b)
01393     {
01394         m_outputContextStack.getMustFlushPendingStartDocument() = b;
01395     }
01396 
01397     FormatterListener*
01398     getFormatterListenerImpl() const
01399     {
01400         return m_outputContextStack.getFormatterListener();
01401     }
01402 
01403     void
01404     setFormatterListenerImpl(FormatterListener*     flistener)
01405     {
01406         m_outputContextStack.getFormatterListener() = flistener;
01407     }
01408 
01412     bool    m_outputCarriageReturns;
01413 
01417     bool    m_outputLinefeeds;
01418 
01422     bool                                            m_useDOMResultTreeFactory;
01423 
01427     mutable XalanDocument*                          m_domResultTreeFactory;
01428 
01435     XalanDOMString  m_resultNameSpacePrefix;
01436 
01440     XalanDOMString  m_resultNameSpaceURL;
01441 
01442 
01443     /*
01444      * The current input element that is being processed.
01445      */
01446     XalanNode*  m_currentNode;
01447 
01453     static XalanElement*
01454     findElementByAttribute(
01455             XalanElement&           elem,
01456             const XalanDOMString&   targetElementName, 
01457             const XalanDOMString&   targetAttributeName,
01458             const XalanDOMString&   targetAttributeValue);
01459 
01467     void
01468     copyAttributesToAttList(
01469             XalanNode*              contextNode,
01470             const Stylesheet*       stylesheetTree,
01471             const XalanElement&     templateChild,
01472             AttributeListImpl&      attList);
01473 
01474     // Factory for creating xpaths.
01475     XPathFactory&           m_xpathFactory;
01476 
01477     // Factory for creating xobjects
01478     XObjectFactory&         m_xobjectFactory;
01479 
01480     // The query/pattern-matcher object.
01481     XPathProcessorPtrType   m_xpathProcessor;
01482 
01488     BoolVectorType          m_cdataStack;
01489 
01490 private:
01491 
01496     bool
01497     pendingAttributesHasDefaultNS() const; 
01498 
01499     void
01500     addResultNamespace(
01501             const XalanNode&    theNode,
01502             AttributeListImpl&  thePendingAttributes,
01503             bool                fOnlyIfPrefixNotPresent = false);
01504 
01509     LocatorStack  m_stylesheetLocatorStack;
01510 
01517     ProblemListenerDefault  m_defaultProblemListener;
01518 
01519     ProblemListener*    m_problemListener;
01520 
01524     const StylesheetRoot*               m_stylesheetRoot;
01525 
01529     static const XalanDOMString&        s_XSLNameSpaceURL;  //"http://www.w3.org/1999/XSL/Transform"
01530 
01534     static const double                 s_XSLTVerSupported; // 1.0
01535 
01539     static const XalanDOMString&        s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt"
01540 
01544     static const XalanDOMString&        s_uniqueNamespacePrefix;
01545 
01549     static const ElementKeysMapType&    s_XSLT4JElementKeys;
01550 
01554     static const AttributeKeysMapType&  s_attributeKeys;
01555 
01559     static const ElementKeysMapType&    s_elementKeys;
01560 
01564     bool    m_traceSelects;
01565 
01570     bool    m_quietConflictWarnings;
01571 
01572     /*
01573      * A stream to print diagnostics to.
01574      */
01575     PrintWriter*    m_diagnosticsPrintWriter;
01576 
01577     /* For diagnostics */
01578     mutable DurationsTableMapType   m_durationsTable;
01579 
01584     TraceListenerVectorType     m_traceListeners;
01585     
01586     // Common processing for errors and warnings
01587     void
01588     problem(
01589             const XalanDOMString&               msg, 
01590             ProblemListener::eClassification    classification,
01591             const XalanNode*                    styleNode = 0,
01592             const XalanNode*                    sourceNode = 0) const;
01593 
01594 
01595   //==========================================================
01596   // SECTION: Function to do with attribute handling
01597   //==========================================================
01598 
01602     mutable unsigned long   m_uniqueNSValue;    // 0
01603   
01604 
01612     XLocator*
01613     getXLocatorFromNode(const XalanNode*    node) const;
01614 
01622      void
01623      associateXLocatorToNode(
01624             const XalanNode*    node,
01625             XLocator*           xlocator);
01626 
01640     static const bool   s_resolveContentsEarly;
01641 
01642     bool
01643     getResolveContentsEarly() const
01644     {
01645         return s_resolveContentsEarly;
01646     }
01647 
01648     ParamVectorType     m_topLevelParams;
01649 
01650 public:
01651 
01655     void
01656     clearTopLevelParams()
01657     {
01658         m_topLevelParams.clear();
01659     }
01660 
01665     XalanNode*
01666     getSourceNode() const
01667     {
01668         return m_currentNode;
01669     }
01670 
01671 private:
01672 
01673     XMLParserLiaison&   m_parserLiaison;
01674 
01675     XPathEnvSupport&    m_xpathEnvSupport;
01676 
01677     DOMSupport&         m_domSupport;
01678 
01682     StylesheetExecutionContext*     m_executionContext;
01683 
01684     /*
01685      * Stack of current output contexts...
01686      */
01687     OutputContextStack              m_outputContextStack;
01688 
01689     /*
01690      * Stack of current result namespaces...
01691      */
01692     ResultNamespacesStack           m_resultNamespacesStack;
01693 
01694     static void
01695     installFunctions();
01696 
01697     static void
01698     uninstallFunctions();
01699 
01700     static void
01701     initializeAttributeKeysTable(AttributeKeysMapType&  theAttributeKeys);
01702 
01703     static void
01704     initializeElementKeysTable(ElementKeysMapType&  theElementKeys);
01705 
01706     static void
01707     initializeXSLT4JElementKeys(ElementKeysMapType&     theElementKeys);
01708 
01709     static const XalanDOMString     s_emptyString;
01710 };
01711 
01712 
01713 
01714 #endif  // XALAN_XSLTENGINEIMPL_HEADER_GUARD

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.1
Copyright © 2000, 2001 The Apache Software Foundation. All Rights Reserved.