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 #include <PlatformSupport/PrefixResolver.hpp> 00102 00103 00104 00105 #include <XPath/Function.hpp> 00106 #include <XPath/NameSpace.hpp> 00107 00108 00109 00110 #include "KeyDeclaration.hpp" 00111 #include "OutputContextStack.hpp" 00112 #include "ProblemListenerDefault.hpp" 00113 #include "ResultNamespacesStack.hpp" 00114 #include "StylesheetExecutionContext.hpp" 00115 #include "XSLTProcessorException.hpp" 00116 00117 00118 00119 // Forward declarations... 00120 class DOMSupport; 00121 class GenerateEvent; 00122 class InputSource; 00123 class PrintWriter; 00124 class ResultTreeFragBase; 00125 class StylesheetConstructionContext; 00126 class StylesheetExecutionContext; 00127 class StylesheetRoot; 00128 class XalanAttr; 00129 class XalanSourceTreeDocument; 00130 class XalanText; 00131 class XLocator; 00132 class XMLParserLiaison; 00133 class XMLURL; 00134 class XObject; 00135 class XPathEnvSupport; 00136 class XPathFactory; 00137 class XPathProcessor; 00138 class XSLTResultTarget; 00139 00140 00141 00153 00154 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, private DocumentHandler, public PrefixResolver 00155 { 00156 public: 00157 00158 #if defined(XALAN_NO_NAMESPACES) 00159 typedef map<XalanDOMString, 00160 int, 00161 less<XalanDOMString> > AttributeKeysMapType; 00162 typedef map<XalanDOMString, 00163 int, 00164 less<XalanDOMString> > ElementKeysMapType; 00165 typedef map<const void*, 00166 clock_t, 00167 less<const void*> > DurationsTableMapType; 00168 typedef vector<const Locator*> LocatorStack; 00169 typedef vector<TraceListener*> TraceListenerVectorType; 00170 typedef vector<bool> BoolVectorType; 00171 #else 00172 typedef std::map<XalanDOMString, int> AttributeKeysMapType; 00173 typedef std::map<XalanDOMString, int> ElementKeysMapType; 00174 typedef std::map<const void*, clock_t> DurationsTableMapType; 00175 typedef std::vector<const Locator*> LocatorStack; 00176 typedef std::vector<TraceListener*> TraceListenerVectorType; 00177 typedef std::vector<bool> BoolVectorType; 00178 #endif 00179 00180 typedef XalanAutoPtr<XPathProcessor> XPathProcessorPtrType; 00181 typedef Function::XObjectArgVectorType XObjectArgVectorType; 00182 typedef StylesheetExecutionContext::ParamVectorType ParamVectorType; 00183 00184 // Public members 00185 //--------------------------------------------------------------------- 00186 00199 XSLTEngineImpl( 00200 XMLParserLiaison& parserLiaison, 00201 XPathEnvSupport& xpathEnvSupport, 00202 DOMSupport& domSupport, 00203 XObjectFactory& xobjectFactory, 00204 XPathFactory& xpathFactory); 00205 00206 virtual 00207 ~XSLTEngineImpl(); 00208 00213 static void 00214 initialize(); 00215 00219 static void 00220 terminate(); 00221 00222 // These methods are inherited from XSLTProcessor ... 00223 00224 virtual void 00225 process( 00226 const XSLTInputSource& inputSource, 00227 const XSLTInputSource& stylesheetSource, 00228 XSLTResultTarget& outputTarget, 00229 StylesheetConstructionContext& constructionContext, 00230 StylesheetExecutionContext& executionContext); 00231 00232 virtual void 00233 process( 00234 const XSLTInputSource& inputSource, 00235 XSLTResultTarget& outputTarget, 00236 StylesheetExecutionContext& executionContext); 00237 00238 virtual StylesheetRoot* 00239 processStylesheet( 00240 const XSLTInputSource& stylesheetSource, 00241 StylesheetConstructionContext& constructionContext); 00242 00243 virtual StylesheetRoot* 00244 processStylesheet( 00245 const XalanDOMString& xsldocURLString, 00246 StylesheetConstructionContext& constructionContext); 00247 00248 virtual XalanNode* 00249 getSourceTreeFromInput(const XSLTInputSource& inputSource); 00250 00251 virtual void 00252 outputToResultTree( 00253 StylesheetExecutionContext& executionContext, 00254 const XObject& xobj); 00255 00256 virtual void 00257 resolveTopLevelParams(StylesheetExecutionContext& executionContext); 00258 00259 virtual XMLParserLiaison& 00260 getXMLParserLiaison() const; 00261 00262 virtual const XalanDOMString 00263 getUniqueNamespaceValue(); 00264 00265 virtual void 00266 getUniqueNamespaceValue(XalanDOMString& theValue); 00267 00268 virtual void 00269 setStylesheetParam( 00270 const XalanDOMString& key, 00271 const XalanDOMString& expression); 00272 00273 virtual void 00274 setStylesheetParam( 00275 const XalanDOMString& key, 00276 XObjectPtr value); 00277 00278 virtual bool 00279 shouldStripSourceNode( 00280 XPathExecutionContext& executionContext, 00281 const XalanNode& node) const; 00282 00283 virtual FormatterListener* 00284 getFormatterListener() const; 00285 00286 virtual void 00287 setFormatterListener(FormatterListener* flistener); 00288 00289 // Trace-related functions... 00290 00291 virtual unsigned long 00292 getTraceListeners() const; 00293 00294 virtual void 00295 addTraceListener(TraceListener* tl); 00296 00297 virtual void 00298 removeTraceListener(TraceListener* tl); 00299 00300 virtual void 00301 fireGenerateEvent(const GenerateEvent& ge); 00302 00303 virtual void 00304 fireTraceEvent(const TracerEvent& te); 00305 00306 virtual void 00307 fireSelectEvent(const SelectionEvent& se); 00308 00309 virtual bool 00310 getTraceSelects() const; 00311 00312 virtual void 00313 setTraceSelects(bool b); 00314 00315 virtual void 00316 traceSelect( 00317 const XalanElement& theTemplate, 00318 const NodeRefListBase& nl) const; 00319 00320 virtual void 00321 setQuietConflictWarnings(bool b); 00322 00323 virtual void 00324 setDiagnosticsOutput(PrintWriter* pw); 00325 00326 00327 // Inherited from PrefixResolver... 00328 00337 virtual const XalanDOMString* 00338 getNamespaceForPrefix(const XalanDOMString& prefix) const; 00339 00345 virtual const XalanDOMString& 00346 getURI() const; 00347 00359 XalanDocument* 00360 parseXML( 00361 const XalanDOMString& urlString, 00362 DocumentHandler* docHandler, 00363 XalanDocument* docToRegister); 00364 00376 XalanDocument* 00377 parseXML( 00378 const InputSource& inputSource, 00379 DocumentHandler* docHandler, 00380 XalanDocument* docToRegister); 00381 00394 Stylesheet* 00395 getStylesheetFromPIURL( 00396 const XalanDOMString& xslURLString, 00397 XalanNode& fragBase, 00398 const XalanDOMString& xmlBaseIdent, 00399 bool isRoot, 00400 StylesheetConstructionContext& constructionContext); 00401 00405 void 00406 flushPending(); 00407 00414 void 00415 addResultNamespaceDecl( 00416 const XalanDOMString& prefix, 00417 const XalanDOMString& namespaceVal); 00418 00427 void 00428 addResultAttribute( 00429 AttributeListImpl& attList, 00430 const XalanDOMString& aname, 00431 const XalanDOMString& value); 00432 00440 void 00441 addResultAttribute( 00442 const XalanDOMString& aname, 00443 const XalanDOMString& value) 00444 { 00445 assert(m_outputContextStack.size() > 0); 00446 00447 addResultAttribute(getPendingAttributesImpl(), 00448 aname, 00449 value); 00450 } 00451 00476 virtual void 00477 characters( 00478 const XMLCh* const ch, 00479 const unsigned int start, 00480 const unsigned int length); 00481 00487 void 00488 characters(const XalanNode& node); 00489 00495 virtual void 00496 characters(const XObjectPtr& xobject); 00497 00505 virtual void 00506 startElement(const XMLCh* const name); 00507 00518 virtual void 00519 charactersRaw( 00520 const XMLCh* const ch, 00521 const unsigned int start, 00522 const unsigned int length); 00523 00529 virtual void 00530 charactersRaw(const XalanNode& node); 00531 00537 virtual void 00538 charactersRaw(const XObjectPtr& xobject); 00539 00546 virtual void 00547 comment( 00548 const XMLCh* const data); 00549 00556 virtual void 00557 entityReference( 00558 const XMLCh* const data); 00559 00582 virtual void 00583 cdata( 00584 const XMLCh* const ch, 00585 const unsigned int start, 00586 const unsigned int length); 00587 00597 void 00598 cloneToResultTree( 00599 XalanNode& node, 00600 XalanNode::NodeType nodeType, 00601 bool isLiteral, 00602 bool overrideStrip, 00603 bool shouldCloneAttributes); 00604 00611 void 00612 outputResultTreeFragment( 00613 StylesheetExecutionContext& executionContext, 00614 const XObject& theTree); 00615 00621 virtual const StylesheetRoot* 00622 getStylesheetRoot() const; 00623 00629 virtual void 00630 setStylesheetRoot(const StylesheetRoot* theStylesheet); 00631 00637 virtual void 00638 setExecutionContext(StylesheetExecutionContext* theExecutionContext); 00639 00646 static const XalanDOMString& 00647 getXSLNameSpaceURL() 00648 { 00649 return s_XSLNameSpaceURL; 00650 } 00651 00657 static const XalanDOMString& 00658 getXalanXSLNameSpaceURL() 00659 { 00660 return s_XSLT4JNameSpaceURL; 00661 } 00662 00668 static double 00669 getXSLTVerSupported(); 00670 00676 static const AttributeKeysMapType& 00677 getAttributeKeys() 00678 { 00679 return s_attributeKeys; 00680 } 00681 00687 static const ElementKeysMapType& 00688 getElementKeys() 00689 { 00690 return s_elementKeys; 00691 } 00692 00701 static int 00702 getElementToken(const XalanDOMString& name) 00703 { 00704 AttributeKeysMapType::const_iterator iter= 00705 s_elementKeys.find(name); 00706 00707 return iter == s_elementKeys.end() ? -2 : (*iter).second; 00708 } 00709 00718 static int 00719 getAttrTok(const XalanDOMString& name) 00720 { 00721 AttributeKeysMapType::const_iterator iter= 00722 s_attributeKeys.find(name); 00723 00724 return iter == s_attributeKeys.end() ? -2 : (*iter).second; 00725 } 00726 00736 int 00737 getXSLToken(const XalanNode& node) const; 00738 00744 bool 00745 getQuietConflictWarnings() const 00746 { 00747 return m_quietConflictWarnings; 00748 } 00749 00750 virtual void 00751 message( 00752 const XalanDOMString& msg, 00753 const XalanNode* sourceNode = 0, 00754 const XalanNode* styleNode = 0) const; 00755 00756 virtual void 00757 message( 00758 const XalanDOMString& msg, 00759 const XalanNode* sourceNode, 00760 const ElemTemplateElement* styleNode) const; 00761 00769 virtual void 00770 message( 00771 const char* msg, 00772 const XalanNode* sourceNode = 0, 00773 const XalanNode* styleNode = 0) const; 00774 00775 virtual void 00776 warn( 00777 const XalanDOMString& msg, 00778 const XalanNode* sourceNode = 0, 00779 const XalanNode* styleNode = 0) const; 00780 00781 virtual void 00782 warn( 00783 const XalanDOMString& msg, 00784 const XalanNode* sourceNode, 00785 const ElemTemplateElement* styleNode) const; 00786 00794 virtual void 00795 warn( 00796 const char* msg, 00797 const XalanNode* sourceNode = 0, 00798 const XalanNode* styleNode = 0) const; 00799 00800 virtual void 00801 error( 00802 const XalanDOMString& msg, 00803 const XalanNode* sourceNode = 0, 00804 const XalanNode* styleNode = 0) const; 00805 00806 virtual void 00807 error( 00808 const XalanDOMString& msg, 00809 const XalanNode* sourceNode, 00810 const ElemTemplateElement* styleNode) const; 00811 00819 virtual void 00820 error( 00821 const char* msg, 00822 const XalanNode* sourceNode = 0, 00823 const XalanNode* styleNode = 0) const; 00824 00831 void 00832 pushTime(const void* key); 00833 00840 clock_t 00841 popDuration(const void* key); 00842 00850 void 00851 displayDuration( 00852 const XalanDOMString& info, 00853 const void* key); 00854 00855 00861 bool doDiagnosticsOutput() 00862 { 00863 return 0 != m_diagnosticsPrintWriter ? true : false; 00864 } 00865 00871 void 00872 diag(const XalanDOMString& s) const; 00873 00879 void 00880 diag(const char* s) const; 00881 00889 bool 00890 isCDataResultElem(const XalanDOMString& elementName) const; 00891 00898 const XalanDOMString* 00899 getResultNamespaceForPrefix(const XalanDOMString& prefix) const; 00900 00907 const XalanDOMString* 00908 getResultPrefixForNamespace(const XalanDOMString& theNamespace) const; 00909 00918 bool 00919 isPendingResultPrefix(const XalanDOMString& thePrefix) const; 00920 00929 double 00930 evalMatchPatternStr( 00931 const XalanDOMString& str, 00932 XalanNode* context, 00933 XPathExecutionContext& executionContext); 00934 00942 const XPath* 00943 createMatchPattern( 00944 const XalanDOMString& str, 00945 const PrefixResolver& resolver); 00946 00953 void 00954 returnXPath(const XPath* xpath); 00955 00961 void 00962 copyNamespaceAttributes(const XalanNode& src); 00963 00971 const XObjectPtr 00972 evalXPathStr( 00973 const XalanDOMString& str, 00974 XPathExecutionContext& executionContext); 00975 00985 const XObjectPtr 00986 evalXPathStr( 00987 const XalanDOMString& str, 00988 XalanNode* contextNode, 00989 const PrefixResolver& prefixResolver, 00990 XPathExecutionContext& executionContext); 00991 01001 const XObjectPtr 01002 evalXPathStr( 01003 const XalanDOMString& str, 01004 XalanNode* contextNode, 01005 const XalanElement& prefixResolver, 01006 XPathExecutionContext& executionContext); 01007 01015 void 01016 copyAttributeToTarget( 01017 const XalanDOMString& attrName, 01018 const XalanDOMString& attrValue, 01019 AttributeListImpl& attrList); 01020 01026 XPathFactory& 01027 getXPathFactory() 01028 { 01029 return m_xpathFactory; 01030 } 01031 01037 XPathProcessor& 01038 getXPathProcessor() 01039 { 01040 return *m_xpathProcessor.get(); 01041 } 01042 01047 virtual void 01048 reset(); 01049 01054 virtual XalanDocument* 01055 getDOMFactory() const; 01056 01062 XPathEnvSupport& 01063 getXPathEnvSupport() 01064 { 01065 return m_xpathEnvSupport; 01066 } 01067 01076 void 01077 setProblemListener(ProblemListener* l) 01078 { 01079 m_problemListener = l; 01080 } 01081 01090 ProblemListener* 01091 getProblemListener() const 01092 { 01093 return m_problemListener; 01094 } 01095 01096 /* 01097 * Push a new output context using the provided FormatterListener. 01098 * 01099 * @param A pointer to the FormatterListener instance for the new context. 01100 */ 01101 void 01102 pushOutputContext(FormatterListener* theListener) 01103 { 01104 m_outputContextStack.pushContext(theListener); 01105 } 01106 01107 /* 01108 * Pop the current output context. 01109 */ 01110 void 01111 popOutputContext() 01112 { 01113 m_outputContextStack.popContext(); 01114 } 01115 01116 /* 01117 * See if there is a pending start document event waiting. 01118 * @return true if there is a start document event waiting. 01119 */ 01120 bool 01121 getHasPendingStartDocument() const 01122 { 01123 return getHasPendingStartDocumentImpl(); 01124 } 01125 01126 /* 01127 * Set the pending start document event state. 01128 * @param the new value 01129 */ 01130 void 01131 setHasPendingStartDocument(bool b) 01132 { 01133 setHasPendingStartDocumentImpl(b); 01134 } 01135 01136 /* 01137 * See if a pending start document event must be flushed. 01138 * @return true if the event must be flushed. 01139 */ 01140 bool 01141 getMustFlushPendingStartDocument() const 01142 { 01143 return getMustFlushPendingStartDocumentImpl(); 01144 } 01145 01146 /* 01147 * Set the pending start document event flush state. 01148 * @param the new value 01149 */ 01150 void 01151 setMustFlushPendingStartDocument(bool b) 01152 { 01153 setMustFlushPendingStartDocumentImpl(b); 01154 } 01155 01161 const AttributeList& 01162 getPendingAttributes() const 01163 { 01164 return getPendingAttributesImpl(); 01165 } 01166 01172 void 01173 setPendingAttributes(const AttributeList& pendingAttributes) 01174 { 01175 getPendingAttributesImpl() = pendingAttributes; 01176 } 01177 01185 void 01186 replacePendingAttribute( 01187 const XalanDOMChar* theName, 01188 const XalanDOMChar* theNewType, 01189 const XalanDOMChar* theNewValue) 01190 { 01191 // Remove the old attribute, then add the new one. AttributeListImpl::addAttribute() 01192 // does this for us. 01193 getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue); 01194 } 01195 01196 bool 01197 isElementPending() const 01198 { 01199 return length(getPendingElementNameImpl()) != 0 ? true : false; 01200 } 01201 01207 const XalanDOMString& 01208 getPendingElementName() const 01209 { 01210 return getPendingElementNameImpl(); 01211 } 01212 01218 void 01219 setPendingElementName(const XalanDOMString& elementName) 01220 { 01221 setPendingElementNameImpl(elementName); 01222 } 01223 01224 void 01225 setPendingElementName(const XalanDOMChar* elementName) 01226 { 01227 setPendingElementNameImpl(elementName); 01228 } 01229 01235 const Locator* 01236 getLocatorFromStack() const 01237 { 01238 return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back(); 01239 } 01240 01246 void 01247 pushLocatorOnStack(const Locator* locator) 01248 { 01249 m_stylesheetLocatorStack.push_back(locator); 01250 } 01251 01255 void 01256 popLocatorStack() 01257 { 01258 if (m_stylesheetLocatorStack.empty() == false) 01259 { 01260 m_stylesheetLocatorStack.pop_back(); 01261 } 01262 } 01263 01264 01265 // These methods are inherited from DocumentHandler ... 01266 01267 virtual void 01268 setDocumentLocator(const Locator* const locator); 01269 01270 virtual void 01271 startDocument(); 01272 01273 virtual void 01274 endDocument(); 01275 01276 virtual void 01277 startElement( 01278 const XMLCh* const name, 01279 AttributeList& atts); 01280 01281 virtual void 01282 endElement( 01283 const XMLCh* const name); 01284 01285 virtual void characters ( 01286 const XMLCh* const chars, 01287 const unsigned int length); 01288 01289 virtual void 01290 ignorableWhitespace( 01291 const XMLCh* const ch, 01292 const unsigned int length); 01293 01294 virtual void 01295 processingInstruction( 01296 const XMLCh* const target, 01297 const XMLCh* const data); 01298 01299 virtual void 01300 resetDocument(); 01301 01302 protected: 01303 01309 const AttributeListImpl& 01310 getPendingAttributesImpl() const 01311 { 01312 return m_outputContextStack.getPendingAttributes(); 01313 } 01314 01320 AttributeListImpl& 01321 getPendingAttributesImpl() 01322 { 01323 return m_outputContextStack.getPendingAttributes(); 01324 } 01325 01331 void 01332 setPendingAttributesImpl(const AttributeList& pendingAttributes) 01333 { 01334 getPendingAttributesImpl() = pendingAttributes; 01335 } 01336 01342 const XalanDOMString& 01343 getPendingElementNameImpl() const 01344 { 01345 return m_outputContextStack.getPendingElementName(); 01346 } 01347 01353 XalanDOMString& 01354 getPendingElementNameImpl() 01355 { 01356 return m_outputContextStack.getPendingElementName(); 01357 } 01358 01364 void 01365 setPendingElementNameImpl(const XalanDOMString& elementName) 01366 { 01367 m_outputContextStack.getPendingElementName() = elementName; 01368 } 01369 01375 void 01376 setPendingElementNameImpl(const XalanDOMChar* elementName) 01377 { 01378 assert(elementName != 0); 01379 01380 m_outputContextStack.getPendingElementName() = elementName; 01381 } 01382 01383 /* 01384 * See if there is a pending start document event waiting. 01385 * @return true if there is a start document event waiting. 01386 */ 01387 bool 01388 getHasPendingStartDocumentImpl() const 01389 { 01390 return m_outputContextStack.getHasPendingStartDocument(); 01391 } 01392 01393 /* 01394 * Set the pending start document event state. 01395 * @param the new value 01396 */ 01397 void 01398 setHasPendingStartDocumentImpl(bool b) 01399 { 01400 m_outputContextStack.getHasPendingStartDocument() = b; 01401 } 01402 01403 /* 01404 * See if a pending start document event must be flushed. 01405 * @return true if the event must be flushed. 01406 */ 01407 bool 01408 getMustFlushPendingStartDocumentImpl() const 01409 { 01410 return m_outputContextStack.getMustFlushPendingStartDocument(); 01411 } 01412 01413 /* 01414 * Set the pending start document event flush state. 01415 * @param the new value 01416 */ 01417 void 01418 setMustFlushPendingStartDocumentImpl(bool b) 01419 { 01420 m_outputContextStack.getMustFlushPendingStartDocument() = b; 01421 } 01422 01423 FormatterListener* 01424 getFormatterListenerImpl() const 01425 { 01426 return m_outputContextStack.getFormatterListener(); 01427 } 01428 01429 void 01430 setFormatterListenerImpl(FormatterListener* flistener) 01431 { 01432 m_outputContextStack.getFormatterListener() = flistener; 01433 } 01434 01438 bool m_useDOMResultTreeFactory; 01439 01443 mutable XalanDocument* m_domResultTreeFactory; 01444 01451 XalanDOMString m_resultNameSpacePrefix; 01452 01456 XalanDOMString m_resultNameSpaceURL; 01457 01458 01463 void 01464 copyAttributesToAttList( 01465 const Stylesheet* stylesheetTree, 01466 const XalanNode& node, 01467 AttributeListImpl& attList); 01468 01469 // Factory for creating xpaths. 01470 XPathFactory& m_xpathFactory; 01471 01472 // Factory for creating xobjects 01473 XObjectFactory& m_xobjectFactory; 01474 01475 // The query/pattern-matcher object. 01476 const XPathProcessorPtrType m_xpathProcessor; 01477 01482 BoolVectorType m_cdataStack; 01483 01484 private: 01485 01490 bool 01491 pendingAttributesHasDefaultNS() const; 01492 01493 void 01494 addResultNamespace( 01495 const XalanNode& theNode, 01496 AttributeListImpl& thePendingAttributes, 01497 bool fOnlyIfPrefixNotPresent = false); 01498 01503 LocatorStack m_stylesheetLocatorStack; 01504 01511 ProblemListenerDefault m_defaultProblemListener; 01512 01513 ProblemListener* m_problemListener; 01514 01518 const StylesheetRoot* m_stylesheetRoot; 01519 01523 static const XalanDOMString& s_XSLNameSpaceURL; //"http://www.w3.org/1999/XSL/Transform" 01524 01528 static const double s_XSLTVerSupported; // 1.0 01529 01533 static const XalanDOMString& s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt" 01534 01538 static const XalanDOMString& s_uniqueNamespacePrefix; 01539 01543 static const ElementKeysMapType& s_XSLT4JElementKeys; 01544 01548 static const AttributeKeysMapType& s_attributeKeys; 01549 01553 static const ElementKeysMapType& s_elementKeys; 01554 01558 bool m_traceSelects; 01559 01564 bool m_quietConflictWarnings; 01565 01566 /* 01567 * A stream to print diagnostics to. 01568 */ 01569 PrintWriter* m_diagnosticsPrintWriter; 01570 01571 /* For diagnostics */ 01572 DurationsTableMapType m_durationsTable; 01573 01578 TraceListenerVectorType m_traceListeners; 01579 01580 // Common processing for errors and warnings 01581 void 01582 problem( 01583 const XalanDOMString& msg, 01584 ProblemListener::eClassification classification, 01585 const XalanNode* sourceNode, 01586 const XalanNode* styleNode) const; 01587 01588 void 01589 problem( 01590 const XalanDOMString& msg, 01591 ProblemListener::eClassification classification, 01592 const XalanNode* sourceNode, 01593 const ElemTemplateElement* styleNode) const; 01594 01595 //========================================================== 01596 // SECTION: Function to do with attribute handling 01597 //========================================================== 01598 01602 unsigned long m_uniqueNSValue; 01603 01604 ParamVectorType m_topLevelParams; 01605 01606 public: 01607 01611 void 01612 clearTopLevelParams() 01613 { 01614 m_topLevelParams.clear(); 01615 } 01616 01617 private: 01618 01619 bool 01620 generateCDATASection() const 01621 { 01622 return 0 != m_cdataStack.size() && 01623 m_cdataStack.back() == true; 01624 } 01625 01626 void 01627 doFlushPending() 01628 { 01629 setMustFlushPendingStartDocument(true); 01630 01631 flushPending(); 01632 } 01633 01634 void 01635 fireCharacterGenerateEvent( 01636 const XalanNode& theNode, 01637 bool isCDATA); 01638 01639 void 01640 fireCharacterGenerateEvent( 01641 const XObjectPtr& theXObject, 01642 bool isCDATA); 01643 01644 void 01645 fireCharacterGenerateEvent( 01646 const XalanDOMString& theString, 01647 bool isCDATA); 01648 01649 void 01650 fireCharacterGenerateEvent( 01651 const XMLCh* ch, 01652 unsigned int start, 01653 unsigned int length, 01654 bool isCDATA); 01655 01656 01657 XMLParserLiaison& m_parserLiaison; 01658 01659 XPathEnvSupport& m_xpathEnvSupport; 01660 01661 DOMSupport& m_domSupport; 01662 01666 StylesheetExecutionContext* m_executionContext; 01667 01668 /* 01669 * Stack of current output contexts... 01670 */ 01671 OutputContextStack m_outputContextStack; 01672 01673 /* 01674 * Stack of current result namespaces... 01675 */ 01676 ResultNamespacesStack m_resultNamespacesStack; 01677 01678 /* 01679 * Dummy AttributeListImpl 01680 */ 01681 AttributeListImpl m_dummyAttributesList; 01682 01683 static void 01684 installFunctions(); 01685 01686 static void 01687 uninstallFunctions(); 01688 01689 static void 01690 initializeAttributeKeysTable(AttributeKeysMapType& theAttributeKeys); 01691 01692 static void 01693 initializeElementKeysTable(ElementKeysMapType& theElementKeys); 01694 01695 static void 01696 initializeXSLT4JElementKeys(ElementKeysMapType& theElementKeys); 01697 01698 static const XalanDOMString s_emptyString; 01699 }; 01700 01701 01702 01703 #endif // XALAN_XSLTENGINEIMPL_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSL Transformer Version 1.1 |
|