00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680) 00019 #define STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/XSLT/XSLTDefinitions.hpp> 00025 00026 00027 00028 #include <cstddef> 00029 #include <cstdio> 00030 #include <memory> 00031 00032 00033 00034 // Base class header file... 00035 #include <xalanc/XPath/XPathExecutionContext.hpp> 00036 00037 00038 00039 00040 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00041 00042 00043 00044 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) 00045 #include <xalanc/PlatformSupport/XalanNumberFormat.hpp> 00046 #endif 00047 00048 00049 00050 #include <xalanc/Include/XalanMemMgrAutoPtr.hpp> 00051 00052 00053 00054 00055 #include <xalanc/PlatformSupport/AttributeListImpl.hpp> 00056 #include <xalanc/PlatformSupport/FormatterListener.hpp> 00057 #include <xalanc/PlatformSupport/XalanCollationServices.hpp> 00058 00059 00060 00061 #include <xalanc/XSLT/TopLevelArg.hpp> 00062 00063 00064 00065 XALAN_CPP_NAMESPACE_BEGIN 00066 00067 00068 00069 #if defined(XALAN_STRICT_ANSI_HEADERS) 00070 using std::FILE; 00071 #endif 00072 00073 00074 00075 class CountersTable; 00076 class ElemTemplate; 00077 class ElemTemplateElement; 00078 class ElemVariable; 00079 class FormatterListener; 00080 class FormatterToText; 00081 class GenerateEvent; 00082 class PrefixResolver; 00083 class NodeRefListBase; 00084 class NodeSorter; 00085 class PrintWriter; 00086 class XalanQName; 00087 class SelectionEvent; 00088 class Stylesheet; 00089 class StylesheetRoot; 00090 class XalanOutputStream; 00091 class TracerEvent; 00092 class Writer; 00093 class XalanDocument; 00094 class XalanDocumentFragment; 00095 class XalanElement; 00096 class XalanNode; 00097 class XalanNumberFormat; 00098 class XPath; 00099 class XObject; 00100 class XObjectPtr; 00101 class XResultTreeFrag; 00102 00103 00104 00105 // 00106 // An abstract class which provides support for executing stylesheets. 00107 // 00108 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext 00109 { 00110 public: 00111 00112 typedef XalanSize_t tl_size_type; 00113 00114 typedef FormatterListener::size_type fl_size_type; 00115 00116 #if defined(XALAN_NO_STD_NAMESPACE) 00117 typedef ostream StreamType; 00118 #else 00119 typedef std::ostream StreamType; 00120 #endif 00121 00122 explicit 00123 StylesheetExecutionContext( 00124 MemoryManager& theMemoryManager, 00125 XObjectFactory* theXObjectFactory = 0); 00126 00127 virtual 00128 ~StylesheetExecutionContext(); 00129 00130 // These interfaces are new... 00131 00132 /** 00133 * Determine whether conflicts should be reported. 00134 * 00135 * @return true if conflicts should not be warned 00136 */ 00137 virtual bool 00138 getQuietConflictWarnings() const = 0; 00139 00140 /** 00141 * If this function returns true, only text nodes can 00142 * be copied to the result tree. 00143 * 00144 * @return true or false 00145 */ 00146 virtual bool 00147 getCopyTextNodesOnly() const = 0; 00148 00149 /** 00150 * Set the flag that determines if only text nodes 00151 * can be copied to the result tree. 00152 * 00153 * @param copyTextNodesOnly The value of the flag 00154 */ 00155 virtual void 00156 pushCopyTextNodesOnly(bool copyTextNodesOnly) = 0; 00157 00158 /** 00159 * Pop the last flag setting that determines if only text nodes 00160 * can be copied to the result tree. 00161 */ 00162 virtual bool 00163 popCopyTextNodesOnly() = 0; 00164 00165 /* 00166 * A class to manage setting and restoring the flag 00167 * for restricting copying only text nodes to the 00168 * result tree 00169 */ 00170 class SetAndRestoreCopyTextNodesOnly 00171 { 00172 public: 00173 00174 SetAndRestoreCopyTextNodesOnly( 00175 StylesheetExecutionContext& executionContext, 00176 bool fValue) : 00177 m_executionContext(executionContext) 00178 { 00179 executionContext.pushCopyTextNodesOnly(fValue); 00180 } 00181 00182 ~SetAndRestoreCopyTextNodesOnly() 00183 { 00184 m_executionContext.popCopyTextNodesOnly(); 00185 } 00186 00187 private: 00188 00189 // Not implemented... 00190 SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&); 00191 00192 SetAndRestoreCopyTextNodesOnly& 00193 operator=(const SetAndRestoreCopyTextNodesOnly&); 00194 00195 // Data members... 00196 StylesheetExecutionContext& m_executionContext; 00197 00198 }; 00199 00200 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00201 /** 00202 * Set the flag that determines if the current attribute should be executed 00203 * @param processAttribute the value of the flag 00204 */ 00205 virtual void 00206 pushProcessCurrentAttribute(bool processAttribute) = 0; 00207 00208 /** 00209 * Pops the last flag setting that determines if the current attribute should be executed 00210 */ 00211 virtual bool 00212 popProcessCurrentAttribute() = 0; 00213 00214 /** 00215 * Set the flag that determines if an element's attributes should be skipped 00216 * 00217 * @param skipAttributes the value of the flag 00218 */ 00219 virtual void 00220 pushSkipElementAttributes(bool skipAttributes) = 0; 00221 00222 /** 00223 * Get the last flag setting that determines if an element's attributes should be skipped 00224 * @returns the value of the flag 00225 */ 00226 virtual bool 00227 getSkipElementAttributes() const = 0; 00228 00229 /** 00230 * Pops the last flag setting that determines if an element's attributes should be skipped 00231 */ 00232 virtual bool 00233 popSkipElementAttributes() = 0; 00234 00235 /** 00236 * Set flag that determines if the if test was true 00237 * 00238 * @param executeIf the value of the flag 00239 */ 00240 virtual void 00241 pushExecuteIf(bool executeIf) = 0; 00242 00243 /** 00244 * Pop the flag that determines if the if test was true 00245 * 00246 * @param executeIf the value of the flag 00247 */ 00248 virtual bool 00249 popExecuteIf() = 0; 00250 #endif 00251 00252 /** 00253 * Retrieve root document for stylesheet. Note that 00254 * this does not have to be a XalanDocument -- it can 00255 * be any node in a document. 00256 * 00257 * @return root document 00258 */ 00259 virtual XalanNode* 00260 getRootDocument() const = 0; 00261 00262 /** 00263 * Set root document for stylesheet. Note that 00264 * this does not have to be a XalanDocument -- it can 00265 * be any node in a document. 00266 * 00267 * @param theDocument root document 00268 */ 00269 virtual void 00270 setRootDocument(XalanNode* theDocument) = 0; 00271 00272 /** 00273 * Set root stylesheet for stylesheet. 00274 * 00275 * @param theStylesheet root stylesheet 00276 */ 00277 virtual void 00278 setStylesheetRoot(const StylesheetRoot* theStylesheet) = 0; 00279 00280 /** 00281 * Retrieve the current mode. 00282 * 00283 * @return QName for mode 00284 */ 00285 virtual const XalanQName* 00286 getCurrentMode() const = 0; 00287 00288 /** 00289 * Set the current mode. 00290 * 00291 * @param theMode QName for mode 00292 */ 00293 virtual void 00294 pushCurrentMode(const XalanQName* theMode) = 0; 00295 00296 00297 /** 00298 * Pop the current mode 00299 */ 00300 virtual void 00301 popCurrentMode() =0; 00302 00303 /** 00304 * Retrieve the current template 00305 * 00306 * @return The current template instance or null if there is no current template 00307 */ 00308 virtual const ElemTemplate* 00309 getCurrentTemplate() const = 0; 00310 00311 /** 00312 * Set the current template 00313 * 00314 * @param theTemplate The current template instance 00315 */ 00316 virtual void 00317 pushCurrentTemplate(const ElemTemplate* theTemplate) = 0; 00318 00319 virtual void 00320 popCurrentTemplate() = 0; 00321 00322 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00323 /* 00324 * A class to manage pushing and popping the current 00325 * template instance. 00326 */ 00327 class PushAndPopCurrentTemplate 00328 { 00329 public: 00330 00331 PushAndPopCurrentTemplate( 00332 StylesheetExecutionContext& executionContext, 00333 const ElemTemplate* theTemplate) : 00334 m_executionContext(executionContext) 00335 { 00336 executionContext.pushCurrentTemplate(theTemplate); 00337 } 00338 00339 ~PushAndPopCurrentTemplate() 00340 { 00341 m_executionContext.popCurrentTemplate(); 00342 } 00343 00344 private: 00345 00346 // Data members... 00347 StylesheetExecutionContext& m_executionContext; 00348 }; 00349 #endif 00350 00351 /** 00352 * See if there is an element pending. 00353 */ 00354 virtual bool 00355 isElementPending() const = 0; 00356 00357 /** 00358 * Replace the contents of a pending attribute. 00359 * 00360 * @param theName name of attribute 00361 * @param theNewType type of attribute 00362 * @param theNewValue new value of attribute 00363 */ 00364 virtual void 00365 replacePendingAttribute( 00366 const XalanDOMChar* theName, 00367 const XalanDOMChar* theNewType, 00368 const XalanDOMChar* theNewValue) = 0; 00369 00370 /** 00371 * Get the current formatter listener. 00372 * 00373 * @return pointer to formatter listener 00374 */ 00375 virtual FormatterListener* 00376 getFormatterListener() const = 0; 00377 00378 /** 00379 * Set the current formatter listener. 00380 * 00381 * @param flistener pointer to new formatter listener 00382 */ 00383 virtual void 00384 setFormatterListener(FormatterListener* flistener) = 0; 00385 00386 virtual void 00387 pushOutputContext(FormatterListener* flistener = 0) = 0; 00388 00389 virtual void 00390 popOutputContext() = 0; 00391 00392 class OutputContextPushPop 00393 { 00394 public: 00395 00396 /** 00397 * Construct an object to push and pop the current output context. 00398 * 00399 * @param theExecutionContext a reference to the current execution context 00400 * @param theNewListener the new FormatterListener to set. 00401 */ 00402 OutputContextPushPop( 00403 StylesheetExecutionContext& theExecutionContext, 00404 FormatterListener* theNewListener = 0) : 00405 m_executionContext(theExecutionContext) 00406 { 00407 m_executionContext.pushOutputContext(theNewListener); 00408 } 00409 00410 ~OutputContextPushPop() 00411 { 00412 m_executionContext.popOutputContext(); 00413 } 00414 00415 private: 00416 00417 StylesheetExecutionContext& m_executionContext; 00418 }; 00419 00420 /** 00421 * Add a result attribute to the list of pending attributes. 00422 * 00423 * @param aname name of attribute 00424 * @param value value of attribute 00425 */ 00426 virtual void 00427 addResultAttribute( 00428 const XalanDOMString& aname, 00429 const XalanDOMString& value) = 0; 00430 00431 /** 00432 * Add a result attribute to the list of pending attributes. 00433 * 00434 * @param aname name of attribute 00435 * @param value value of attribute 00436 */ 00437 virtual void 00438 addResultAttribute( 00439 const XalanDOMString& aname, 00440 const XalanDOMChar* value) = 0; 00441 00442 /** 00443 * Add namespace attributes for a node to the list of pending attributes. 00444 * 00445 * @param src source node 00446 */ 00447 virtual void 00448 copyNamespaceAttributes(const XalanNode& src) = 0; 00449 00450 /** 00451 * Retrieve the result prefix corresponding to a namespace. 00452 * 00453 * @param theNamespace namespace for prefix 00454 * 00455 * @return A pointer to a string containing the prefix, or 0 if the namespace is not mapped. 00456 */ 00457 virtual const XalanDOMString* 00458 getResultPrefixForNamespace(const XalanDOMString& theNamespace) const = 0; 00459 00460 /** 00461 * Retrieve the result namespace corresponding to a prefix. 00462 * 00463 * @param thePrefix prefix for namespace 00464 * 00465 * @return A pointer to a string containing the namespace, or 0 if the prefix is not mapped. 00466 */ 00467 virtual const XalanDOMString* 00468 getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const = 0; 00469 00470 /** 00471 * Determine whether or not a prefix is in use on the pending element or 00472 * the pending attributes. 00473 * 00474 * @param thePrefix prefix for namespace 00475 * 00476 * @return true if the prefix is in use, false if not. 00477 */ 00478 virtual bool 00479 isPendingResultPrefix(const XalanDOMString& thePrefix) = 0; 00480 00481 00482 /** 00483 * Generate a random namespace prefix guaranteed to be unique. 00484 * 00485 * @param theValue A string for returning the new prefix 00486 */ 00487 virtual void 00488 getUniqueNamespaceValue(XalanDOMString& theValue) const = 0; 00489 00490 /** 00491 * Retrieve the current number of spaces to indent. 00492 * 00493 * @return number of spaces 00494 */ 00495 virtual int 00496 getIndent() const = 0; 00497 00498 /** 00499 * Set the current number of spaces to indent. 00500 * 00501 * @param indentAmount The number of spaces to indent. Use -1 for the default amount. 00502 */ 00503 virtual void 00504 setIndent(int indentAmount) = 0; 00505 00506 /** 00507 * Create and initialize an xpath and return it. This is to be used to 00508 * create an XPath that is only used during execution. 00509 * 00510 * @param str string expression for XPath evaluation 00511 * @param resolver resolver for namespace resolution 00512 * @return pointer to resulting XPath 00513 */ 00514 virtual const XPath* 00515 createMatchPattern( 00516 const XalanDOMString& str, 00517 const PrefixResolver& resolver) = 0; 00518 00519 /** 00520 * Return the XPath created by createMatchPattern(). 00521 * 00522 * @param xpath The XPath to return. 00523 */ 00524 virtual void 00525 returnXPath(const XPath* xpath) = 0; 00526 00527 // A helper class to automatically return an XPath instance. 00528 class XPathGuard 00529 { 00530 public: 00531 00532 XPathGuard( 00533 StylesheetExecutionContext& context, 00534 const XPath* xpath = 0) : 00535 m_context(context), 00536 m_xpath(xpath) 00537 { 00538 } 00539 00540 ~XPathGuard() 00541 { 00542 if (m_xpath != 0) 00543 { 00544 m_context.returnXPath(m_xpath); 00545 } 00546 } 00547 00548 const XPath* 00549 get() const 00550 { 00551 return m_xpath; 00552 } 00553 00554 const XPath* 00555 release() 00556 { 00557 const XPath* const temp = m_xpath; 00558 00559 m_xpath = 0; 00560 00561 return temp; 00562 } 00563 00564 void 00565 reset(const XPath* xpath) 00566 { 00567 if (m_xpath != 0) 00568 { 00569 m_context.returnXPath(m_xpath); 00570 } 00571 00572 m_xpath = xpath; 00573 } 00574 00575 private: 00576 00577 StylesheetExecutionContext& m_context; 00578 00579 const XPath* m_xpath; 00580 }; 00581 00582 typedef XalanVector<TopLevelArg> ParamVectorType; 00583 00584 /** 00585 * Set a list of top level variables in the specified execution context 00586 * stylesheet. 00587 * 00588 * @param topLevelParams list of top level parameters 00589 */ 00590 virtual void 00591 pushTopLevelVariables(const ParamVectorType& topLevelParams) = 0; 00592 00593 /** 00594 * Execute the supplied XPath and and create a 00595 * variable in the current context. 00596 * 00597 * @param str string expression for XPath evaluation 00598 * @param contextNode current node in the source tree 00599 * @param resolver resolver for namespace resolution 00600 * @return a pointer to the XObject result 00601 */ 00602 virtual const XObjectPtr 00603 createVariable( 00604 const XPath& xpath, 00605 XalanNode* contextNode, 00606 const PrefixResolver& resolver) = 0; 00607 00608 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00609 /** 00610 * Create an ResultTreeFragment as a variable and push it 00611 * on to the stack with the current context. 00612 * 00613 * @param templateChild result tree fragment to use. 00614 * @param sourceNode source node 00615 * @return a pointer to the XObject result 00616 */ 00617 virtual const XObjectPtr 00618 createVariable( 00619 const ElemTemplateElement& templateChild, 00620 XalanNode* sourceNode) = 0; 00621 #endif 00622 00623 /** 00624 * Execute an XPath using the provided expression, 00625 * and push the result as a variable in the context of 00626 * the supplied element. 00627 * 00628 * @param name name of variable 00629 * @param element element marker for variable 00630 * @param str string expression for XPath evaluation 00631 * @param contextNode current node in the source tree 00632 * @param resolver resolver for namespace resolution 00633 * @return nothing 00634 */ 00635 virtual void 00636 pushVariable( 00637 const XalanQName& name, 00638 const ElemTemplateElement* element, 00639 const XalanDOMString& str, 00640 XalanNode* contextNode, 00641 const PrefixResolver& resolver) = 0; 00642 00643 /** 00644 * Execute the supplied XPath and push the result as a 00645 * variable in the current context. 00646 * 00647 * @param name name of variable 00648 * @param element element marker for variable 00649 * @param str string expression for XPath evaluation 00650 * @param contextNode current node in the source tree 00651 * @param resolver resolver for namespace resolution 00652 * @return nothing 00653 */ 00654 virtual void 00655 pushVariable( 00656 const XalanQName& name, 00657 const ElemTemplateElement* element, 00658 const XPath& xpath, 00659 XalanNode* contextNode, 00660 const PrefixResolver& resolver) = 0; 00661 00662 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00663 /** 00664 * Create an ResultTreeFragment as a variable and push it 00665 * on to the stack with the current context. 00666 * 00667 * @param name name of variable 00668 * @param element element marker for variable 00669 * @param templateChild result tree fragment to use. 00670 * @param sourceNode source node 00671 */ 00672 virtual void 00673 pushVariable( 00674 const XalanQName& name, 00675 const ElemTemplateElement* element, 00676 const ElemTemplateElement& templateChild, 00677 XalanNode* sourceNode) = 0; 00678 #endif 00679 00680 /** 00681 * Push a named variable onto the variables stack. 00682 * The variable has already been evaluated. 00683 * 00684 * @param name name of variable 00685 * @param val pointer to XObject value 00686 * @param element element marker for variable 00687 */ 00688 virtual void 00689 pushVariable( 00690 const XalanQName& name, 00691 const XObjectPtr val, 00692 const ElemTemplateElement* element) = 0; 00693 00694 /** 00695 * Push a named variable onto the processor variable stack 00696 * The variable will be evaluated when first referenced. 00697 * 00698 * @param name name of variable 00699 * @param var pointer to ElemVariable instance 00700 * @param element element marker for variable 00701 */ 00702 virtual void 00703 pushVariable( 00704 const XalanQName& name, 00705 const ElemVariable* var, 00706 const ElemTemplateElement* element) = 0; 00707 00708 /** 00709 * Push a context marker onto the stack to let us know when to stop 00710 * searching for a var. 00711 */ 00712 virtual void 00713 pushContextMarker() = 0; 00714 00715 /** 00716 * Pop the current context from the current context stack. 00717 */ 00718 virtual void 00719 popContextMarker() = 0; 00720 00721 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00722 /* 00723 * A class to manage pushing and popping an element's stack 00724 * frame context. 00725 */ 00726 class PushAndPopContextMarker 00727 { 00728 public: 00729 00730 PushAndPopContextMarker(StylesheetExecutionContext& executionContext) : 00731 m_executionContext(executionContext) 00732 { 00733 executionContext.pushContextMarker(); 00734 } 00735 00736 PushAndPopContextMarker( 00737 StylesheetExecutionContext& executionContext, 00738 int& currentStackFrameIndex) : 00739 m_executionContext(executionContext) 00740 { 00741 currentStackFrameIndex = executionContext.getCurrentStackFrameIndex(); 00742 00743 executionContext.pushContextMarker(); 00744 } 00745 00746 ~PushAndPopContextMarker() 00747 { 00748 m_executionContext.popContextMarker(); 00749 } 00750 00751 StylesheetExecutionContext& 00752 getExecutionContext() const 00753 { 00754 return m_executionContext; 00755 } 00756 00757 private: 00758 00759 StylesheetExecutionContext& m_executionContext; 00760 }; 00761 #endif 00762 00763 /** 00764 * Resolve the params that were pushed by the caller. 00765 */ 00766 virtual void 00767 resolveTopLevelParams() = 0; 00768 00769 /** 00770 * Reset the vector of top level parameters. 00771 */ 00772 virtual void 00773 clearTopLevelParams() = 0; 00774 00775 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00776 class ResolveAndClearTopLevelParams 00777 { 00778 public: 00779 00780 ResolveAndClearTopLevelParams(StylesheetExecutionContext& executionContext) : 00781 m_executionContext(executionContext) 00782 { 00783 m_executionContext.resolveTopLevelParams(); 00784 } 00785 00786 ~ResolveAndClearTopLevelParams() 00787 { 00788 m_executionContext.clearTopLevelParams(); 00789 } 00790 00791 private: 00792 00793 StylesheetExecutionContext& m_executionContext; 00794 }; 00795 00796 /** 00797 * Given a template, search for the arguments and push them on the stack. 00798 * Also, push default arguments on the stack. 00799 * 00800 * @param xslCallTemplateElement "call-template" element 00801 */ 00802 virtual void 00803 pushParams(const ElemTemplateElement& xslCallTemplateElement) = 0; 00804 00805 #else 00806 00807 /** 00808 * Initiate context to accept a new set of parameters 00809 */ 00810 virtual void beginParams() = 0; 00811 00812 /** 00813 * Indicate parameter set is complete 00814 */ 00815 virtual void endParams() = 0; 00816 00817 /** 00818 * Push a single paramter onto the latest initialized paramter set 00819 * @param qName the name of the parameter 00820 * @param theValue the value of the parameter 00821 */ 00822 virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue) = 0; 00823 #endif 00824 00825 /** 00826 * Given a name, return a string representing the value, but don't look in 00827 * the global space. 00828 * 00829 * @param theName name of variable 00830 * @return An XObjectPtr instance. Call XObjectPtr::null() on the instance 00831 * to determine if the variable was found. If XObjectPtr::null() 00832 * returns true, the variable was not found, and no other operations 00833 * on the XObject instance are permitted. 00834 */ 00835 virtual const XObjectPtr 00836 getParamVariable(const XalanQName& theName) = 0; 00837 00838 /** 00839 * Push a frame marker for an element. 00840 * 00841 * @param elem the element 00842 */ 00843 virtual void 00844 pushElementFrame(const ElemTemplateElement* elem) = 0; 00845 00846 /** 00847 * Pop a frame marker for an element. 00848 * 00849 * @param elem the element 00850 */ 00851 virtual void 00852 popElementFrame() = 0; 00853 00854 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00855 /* 00856 * A class to manage pushing and popping an element's stack 00857 * frame context. 00858 */ 00859 class PushAndPopElementFrame 00860 { 00861 public: 00862 00863 PushAndPopElementFrame( 00864 StylesheetExecutionContext& executionContext, 00865 const ElemTemplateElement* element) : 00866 m_executionContext(executionContext) 00867 { 00868 executionContext.pushElementFrame(element); 00869 } 00870 00871 ~PushAndPopElementFrame() 00872 { 00873 m_executionContext.popElementFrame(); 00874 } 00875 00876 private: 00877 00878 StylesheetExecutionContext& m_executionContext; 00879 }; 00880 #endif 00881 00882 /** 00883 * Get the top of the global stack frame. 00884 * 00885 * @return current value of index 00886 */ 00887 virtual int 00888 getGlobalStackFrameIndex() const = 0; 00889 00890 /** 00891 * Get the top of the stack frame from where a search 00892 * for a variable or param should take place. 00893 * 00894 * @return current value of index 00895 */ 00896 virtual int 00897 getCurrentStackFrameIndex() const = 0; 00898 00899 /** 00900 * Set the top of the stack frame from where a search 00901 * for a variable or param should take place. 00902 * 00903 * @param currentStackFrameIndex new value of index 00904 */ 00905 virtual void 00906 pushCurrentStackFrameIndex(int currentStackFrameIndex = -1) = 0; 00907 00908 /** 00909 * Pop the last stack frame index setting 00910 */ 00911 virtual void 00912 popCurrentStackFrameIndex() = 0; 00913 00914 /* 00915 * A class to manage the state of the variable stacks frame index. 00916 */ 00917 class SetAndRestoreCurrentStackFrameIndex 00918 { 00919 public: 00920 00921 SetAndRestoreCurrentStackFrameIndex( 00922 StylesheetExecutionContext& executionContext, 00923 int newIndex) : 00924 m_executionContext(executionContext), 00925 m_savedIndex(executionContext.getCurrentStackFrameIndex()) 00926 { 00927 executionContext.pushCurrentStackFrameIndex(newIndex); 00928 } 00929 00930 ~SetAndRestoreCurrentStackFrameIndex() 00931 { 00932 m_executionContext.popCurrentStackFrameIndex(); 00933 } 00934 00935 private: 00936 00937 StylesheetExecutionContext& m_executionContext; 00938 00939 const int m_savedIndex; 00940 }; 00941 00942 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00943 /* 00944 * A class to manage stack state during execution. 00945 */ 00946 class ParamsPushPop : public PushAndPopContextMarker 00947 { 00948 public: 00949 00950 ParamsPushPop( 00951 StylesheetExecutionContext& executionContext, 00952 const ElemTemplateElement& xslCallTemplateElement) : 00953 PushAndPopContextMarker(executionContext) 00954 { 00955 doPush(xslCallTemplateElement); 00956 } 00957 00958 ParamsPushPop( 00959 StylesheetExecutionContext& executionContext, 00960 const ElemTemplateElement& xslCallTemplateElement, 00961 int& savedStackFrameIndex) : 00962 PushAndPopContextMarker(executionContext, savedStackFrameIndex) 00963 { 00964 doPush( 00965 xslCallTemplateElement, 00966 savedStackFrameIndex); 00967 } 00968 00969 ~ParamsPushPop() 00970 { 00971 } 00972 00973 private: 00974 00975 void 00976 doPush( 00977 const ElemTemplateElement& xslCallTemplateElement, 00978 int stackFrameIndex); 00979 00980 void 00981 doPush(const ElemTemplateElement& xslCallTemplateElement); 00982 }; 00983 #endif 00984 00985 /** 00986 * Receive notification of the beginning of a document. 00987 * 00988 * <p>The SAX parser will invoke this method only once, before any 00989 * other methods in this interface or in DTDHandler (except for 00990 * setDocumentLocator).</p> 00991 * 00992 * @exception SAXException 00993 */ 00994 virtual void 00995 startDocument() = 0; 00996 00997 /** 00998 * Receive notification of the end of a document. 00999 * 01000 * <p>The SAX parser will invoke this method only once, and it will 01001 * be the last method invoked during the parse. The parser shall 01002 * not invoke this method until it has either abandoned parsing 01003 * (because of an unrecoverable error) or reached the end of 01004 * input.</p> 01005 * 01006 * @exception SAXException 01007 */ 01008 virtual void 01009 endDocument() = 0; 01010 01011 /** 01012 * Receive notification of the beginning of an element. 01013 * 01014 * @param name element type name 01015 */ 01016 virtual void 01017 startElement(const XalanDOMChar* name) = 0; 01018 01019 /** 01020 * Receive notification of the end of an element. 01021 * 01022 * @param name element type name 01023 */ 01024 virtual void 01025 endElement(const XalanDOMChar* name) = 0; 01026 01027 /** 01028 * Receive notification of character data. 01029 * 01030 * @param ch pointer to characters from the XML document 01031 * @param start start position in the array 01032 * @param length number of characters to read from the array 01033 */ 01034 virtual void 01035 characters( 01036 const XalanDOMChar* ch, 01037 fl_size_type start, 01038 fl_size_type length) = 0; 01039 01040 /** 01041 * Receive notification of character data. If available, when the 01042 * disable-output-escaping attribute is used, output raw text without 01043 * escaping. 01044 * 01045 * @param ch pointer to characters from the XML document 01046 * @param start start position in the array 01047 * @param length number of characters to read from the array 01048 */ 01049 virtual void 01050 charactersRaw( 01051 const XalanDOMChar* ch, 01052 fl_size_type start, 01053 fl_size_type length) = 0; 01054 01055 /** 01056 * Called when a Comment is to be constructed. 01057 * 01058 * @param data pointer to comment data 01059 */ 01060 virtual void 01061 comment(const XalanDOMChar* data) = 0; 01062 01063 /** 01064 * Receive notification of a processing instruction. 01065 * 01066 * @param target processing instruction target 01067 * @param data processing instruction data, or null if none was supplied 01068 */ 01069 virtual void 01070 processingInstruction( 01071 const XalanDOMChar* target, 01072 const XalanDOMChar* data) = 0; 01073 01074 /** 01075 * Flush the pending element. 01076 */ 01077 virtual void 01078 flushPending() = 0; 01079 01080 /** 01081 * Clone a node to the result tree 01082 * 01083 * @param node node to clone 01084 * @param locator The Locator, if any 01085 */ 01086 virtual void 01087 cloneToResultTree( 01088 const XalanNode& node, 01089 const Locator* locator) = 0; 01090 01091 /** 01092 * Clone a node to the result tree 01093 * 01094 * @param node node to clone 01095 * @param nodeType the type of the node 01096 * @param overrideStrip false if white space stripping should be done 01097 * @param shouldCloneAttributes true if attributes should be cloned 01098 * @param locator The Locator, if any 01099 */ 01100 virtual void 01101 cloneToResultTree( 01102 const XalanNode& node, 01103 XalanNode::NodeType nodeType, 01104 bool overrideStrip, 01105 bool shouldCloneAttributes, 01106 const Locator* locator) = 0; 01107 01108 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 01109 /** 01110 * Initiate creation of a result tree fragment 01111 * @param sourceNode the source Node 01112 */ 01113 virtual void 01114 beginCreateXResultTreeFrag( 01115 XalanNode* sourceNode) = 0; 01116 01117 /** 01118 * Indicate sthe completion of result tree fragment 01119 * @return a pointer to the result tree fragment 01120 */ 01121 virtual const XObjectPtr 01122 endCreateXResultTreeFrag() = 0; 01123 01124 /** 01125 * Initiate to put execution result in string 01126 * 01127 * @param theResult the string to contain the result 01128 */ 01129 virtual void 01130 beginFormatToText( 01131 XalanDOMString& theResult) = 0; 01132 01133 /** 01134 * Indicates the completion of the result string 01135 * 01136 */ 01137 virtual void 01138 endFormatToText() = 0; 01139 #else 01140 /** 01141 * Create an XObject that represents a Result tree fragment. 01142 * 01143 * @param templateChild result tree fragment to use. 01144 * @param sourceNode source node 01145 * @return XObject instance 01146 */ 01147 virtual const XObjectPtr 01148 createXResultTreeFrag( 01149 const ElemTemplateElement& templateChild, 01150 XalanNode* sourceNode) = 0; 01151 #endif 01152 01153 /** 01154 * Output an object to the result tree by doing the right conversions. 01155 * This is public for access by extensions. 01156 * 01157 * @param obj the XObject to output 01158 * @param locator The Locator, if any 01159 */ 01160 virtual void 01161 outputToResultTree( 01162 const XObject& xobj, 01163 const Locator* locator) = 0; 01164 01165 /** 01166 * Given a result tree fragment, walk the tree and 01167 * output it to the result stream. 01168 * 01169 * @param theTree result tree fragment 01170 * @param locator The Locator, if any 01171 */ 01172 virtual void 01173 outputResultTreeFragment( 01174 const XObject& theTree, 01175 const Locator* locator) = 0; 01176 01177 /** 01178 * Determine the full XSLT Namespace URI. 01179 * 01180 * @return Xalan namespace URI 01181 */ 01182 virtual const XalanDOMString& 01183 getXSLNameSpaceURL() const = 0; 01184 01185 /** 01186 * Special Xalan namespace for built-in extensions. 01187 * 01188 * @return Xalan namespace for extensions 01189 */ 01190 virtual const XalanDOMString& 01191 getXalanXSLNameSpaceURL() const = 0; 01192 01193 /** 01194 * Determine if an element is on the recursion stack. 01195 * 01196 * @return true if element on stack 01197 */ 01198 virtual bool 01199 findOnElementRecursionStack(const ElemTemplateElement* theElement) const = 0; 01200 01201 /** 01202 * Push an element onto the recursion stack. 01203 * 01204 * @param theElement pointer to element to push 01205 */ 01206 virtual void 01207 pushOnElementRecursionStack(const ElemTemplateElement* theElement) = 0; 01208 01209 /** 01210 * Pop an element off the recursion stack. 01211 * 01212 * @return pointer to element popped 01213 */ 01214 virtual const ElemTemplateElement* 01215 popElementRecursionStack() = 0; 01216 01217 /** 01218 * Class for keeping track of elements pushed on the element recursion stack 01219 */ 01220 class ElementRecursionStackPusher 01221 { 01222 public: 01223 01224 /** 01225 * Construct an instance of the recursion stack pusher. 01226 * 01227 * @param executionContext current execution context 01228 * @param element pointer to element to push 01229 */ 01230 ElementRecursionStackPusher( 01231 StylesheetExecutionContext& executionContext, 01232 const ElemTemplateElement* element) : 01233 m_executionContext(executionContext) 01234 { 01235 m_executionContext.pushOnElementRecursionStack(element); 01236 } 01237 01238 ~ElementRecursionStackPusher() 01239 { 01240 m_executionContext.popElementRecursionStack(); 01241 } 01242 01243 private: 01244 01245 StylesheetExecutionContext& m_executionContext; 01246 }; 01247 01248 01249 /** 01250 * This is a hook that XResultTreeFrag instances (which are reference 01251 * counted), can notify the owning StylesheetExecutionContext instance 01252 * when they are dereferenced and can be cleaned up. 01253 * 01254 * @param theXResultTreeFrag The instance that is being returned. 01255 * 01256 * @return true if the XResultTreeFrag instance belongs to the execution context. false if not. 01257 */ 01258 virtual bool 01259 returnXResultTreeFrag(XResultTreeFrag* theXResultTreeFrag) = 0; 01260 01261 01262 enum eDummy 01263 { 01264 eDefaultXMLIndentAmount = 0, 01265 eDefaultHTMLIndentAmount = 0 01266 }; 01267 01268 /** 01269 * Enums to determine whether or not run-time escaping of URLs has been set. 01270 */ 01271 enum eEscapeURLs 01272 { 01273 eEscapeURLsDefault, // Use the value in the stylesheet 01274 eEscapeURLsNo, // Don't escape URLs 01275 eEscapeURLsYes // Escape URLs 01276 }; 01277 01278 /** 01279 * Get the value for run-time escaping of URLs. This can 01280 * override the property specified by the stylesheet. The 01281 * default behavior is to honor the property in the stylesheet. 01282 * 01283 * @return The value of the enum 01284 */ 01285 virtual eEscapeURLs 01286 getEscapeURLs() const = 0; 01287 01288 /** 01289 * Set the value for run-time escaping of URLs. This can 01290 * override the property specified by the stylesheet. The 01291 * default behavior is to honor the property in the stylesheet. 01292 * 01293 * @param value The value of the enum 01294 */ 01295 virtual void 01296 setEscapeURLs(eEscapeURLs value) = 0; 01297 01298 01299 /** 01300 * Enums to determine whether or not run-time omission of the META tag has been set. 01301 */ 01302 enum eOmitMETATag 01303 { 01304 eOmitMETATagDefault, // Use the value in the stylesheet 01305 eOmitMETATagNo, // Don't omit the META tag 01306 eOmitMETATagYes // Omit the META tag 01307 }; 01308 01309 /** 01310 * Get the value for run-time omission of URLs. This can 01311 * override the property specified by the stylesheet. The 01312 * default behavior is to honor the property in the stylesheet. 01313 * 01314 * @return The value of the enum 01315 */ 01316 virtual eOmitMETATag 01317 getOmitMETATag() const = 0; 01318 01319 /** 01320 * Get the value for run-time omission of URLs. This can 01321 * override the property specified by the stylesheet. The 01322 * default behavior is to honor the property in the stylesheet. 01323 * 01324 * @param value The value of the enum 01325 */ 01326 virtual void 01327 setOmitMETATag(eOmitMETATag value) = 0; 01328 01329 /** 01330 * Create a new FormatterToXML instance. The execution context 01331 * owns the instance and will delete it when reset. 01332 * 01333 * @param writer character output stream to use 01334 * @param version version of the output method 01335 * @param doIndent true if output is to be indented 01336 * @param indent number of spaces to indent at each nesting level 01337 * @param encoding character encoding for the writer 01338 * @param mediaType media type (MIME content type) of the data 01339 * @param doctypeSystem system identifier to be used in the document 01340 * type declaration 01341 * @param doctypePublic public identifier to be used in the document 01342 * type declaration 01343 * @param xmlDecl true if the XSLT processor should output an XML 01344 * declaration 01345 * @param standalone true if the XSLT processor should output a 01346 * standalone document declaration 01347 * @return a pointer to the new instance. 01348 */ 01349 01350 virtual FormatterListener* 01351 createFormatterToXML( 01352 Writer& writer, 01353 const XalanDOMString& version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01354 bool doIndent = false, 01355 int indent = eDefaultXMLIndentAmount, 01356 const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01357 const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01358 const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01359 const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01360 bool xmlDecl = true, 01361 const XalanDOMString& standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr())) = 0; 01362 01363 /** 01364 * Create a new FormatterToHTML instance. The execution context 01365 * owns the instance and will delete it when reset. 01366 * 01367 * @param writer character output stream to use 01368 * @param encoding character encoding for the writer 01369 * @param mediaType media type (MIME content type) of the data 01370 * @param doctypeSystem system identifier to be used in the document 01371 * type declaration 01372 * @param doctypePublic public identifier to be used in the document 01373 * type declaration 01374 * @param doIndent true if output is to be indented 01375 * @param indent number of spaces to indent at each nesting level 01376 * @param escapeURLs Whether or not to escape URLs according to the recommendation. The default is true. 01377 * @param omitMetaTag Whether or not to output a META TAG according to the recommendation. The default is false. 01378 * @return a pointer to the new instance. 01379 */ 01380 virtual FormatterListener* 01381 createFormatterToHTML( 01382 Writer& writer, 01383 const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01384 const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01385 const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01386 const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()), 01387 bool doIndent = true, 01388 int indent = eDefaultHTMLIndentAmount, 01389 bool escapeURLs = true, 01390 bool omitMetaTag = false) = 0; 01391 01392 /** 01393 * FormatterToText instance constructor. 01394 * 01395 * @param writer writer for output 01396 * @param encoding character encoding for the writer 01397 */ 01398 virtual FormatterListener* 01399 createFormatterToText( 01400 Writer& writer, 01401 const XalanDOMString& encoding) = 0; 01402 01403 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 01404 class BorrowReturnFormatterToText 01405 { 01406 public: 01407 01408 BorrowReturnFormatterToText( 01409 StylesheetExecutionContext& executionContext, 01410 Writer& writer, 01411 bool normalizeLinefeed = true, 01412 bool handleIgnorableWhitespace = true); 01413 01414 ~BorrowReturnFormatterToText() 01415 { 01416 assert(m_formatter != 0); 01417 01418 m_executionContext.returnFormatterToText(m_formatter); 01419 } 01420 01421 FormatterToText& 01422 operator*() const 01423 { 01424 assert(m_formatter != 0); 01425 01426 return *m_formatter; 01427 } 01428 01429 FormatterToText* 01430 get() const 01431 { 01432 assert(m_formatter != 0); 01433 01434 return m_formatter; 01435 } 01436 01437 FormatterToText* 01438 operator->() const 01439 { 01440 return get(); 01441 } 01442 01443 private: 01444 01445 StylesheetExecutionContext& m_executionContext; 01446 01447 FormatterToText* m_formatter; 01448 }; 01449 01450 01451 friend class BorrowReturnFormatterToText; 01452 #endif 01453 01454 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 01455 /** 01456 * Get node sorter instance 01457 */ 01458 virtual NodeSorter* 01459 getNodeSorter() = 0; 01460 01461 #else 01462 /** 01463 * Borrow a cached NodeSorter instance. 01464 * 01465 * @return A pointer to the instance. 01466 */ 01467 virtual NodeSorter* 01468 borrowNodeSorter() = 0; 01469 01470 /** 01471 * Return a previously borrowed NodeSorter instance. 01472 * 01473 * @param theSorter A pointer the to previously borrowed instance. 01474 * @return true if the instance was previously borrowed, false if not. 01475 */ 01476 virtual bool 01477 returnNodeSorter(NodeSorter* theSorter) = 0; 01478 01479 class BorrowReturnNodeSorter 01480 { 01481 public: 01482 01483 BorrowReturnNodeSorter(StylesheetExecutionContext& executionContext) : 01484 m_executionContext(executionContext), 01485 m_sorter(executionContext.borrowNodeSorter()) 01486 { 01487 assert(m_sorter != 0); 01488 } 01489 01490 ~BorrowReturnNodeSorter() 01491 { 01492 assert(m_sorter != 0); 01493 01494 m_executionContext.returnNodeSorter(m_sorter); 01495 } 01496 01497 NodeSorter& 01498 operator*() const 01499 { 01500 assert(m_sorter != 0); 01501 01502 return *m_sorter; 01503 } 01504 01505 NodeSorter* 01506 get() const 01507 { 01508 assert(m_sorter != 0); 01509 01510 return m_sorter; 01511 } 01512 01513 NodeSorter* 01514 operator->() const 01515 { 01516 return get(); 01517 } 01518 01519 private: 01520 01521 StylesheetExecutionContext& m_executionContext; 01522 01523 NodeSorter* m_sorter; 01524 }; 01525 #endif 01526 01527 typedef XalanMemMgrAutoPtr<XalanNumberFormat> XalanNumberFormatAutoPtr; 01528 01529 /** 01530 * Create a new XalanNumberFormat instance. 01531 * 01532 * @return an XalanNumberFormatAutoPtr that owns a new 01533 * XalanNumberFormat instance. 01534 */ 01535 virtual XalanNumberFormatAutoPtr 01536 createXalanNumberFormat() = 0; 01537 01538 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 01539 /* 01540 * A class to manage the attribute sets that have been executed 01541 * by an element 01542 */ 01543 struct UseAttributeSetIndexes 01544 { 01545 UseAttributeSetIndexes() : 01546 attributeSetNameIndex(0), 01547 matchingAttributeSetIndex(0) {} 01548 01549 size_type attributeSetNameIndex; 01550 size_type matchingAttributeSetIndex; 01551 01552 01553 }; 01554 01555 virtual void 01556 createUseAttributeSetIndexesOnStack() = 0; 01557 01558 virtual UseAttributeSetIndexes& 01559 getUseAttributeSetIndexes() = 0; 01560 01561 virtual void 01562 popUseAttributeSetIndexesFromStack() = 0; 01563 01564 /** 01565 * Push the element that will invoke 01566 * non children elements (i.e templates, attribute-sets) 01567 * 01568 * @param invokers the element that will invoke non children elements 01569 */ 01570 virtual void 01571 pushInvoker(const ElemTemplateElement * invoker) = 0; 01572 01573 /** 01574 * Pop the element that invoked non children elements 01575 */ 01576 virtual void 01577 popInvoker() = 0; 01578 01579 /** 01580 * Get the lastest element that has invoked 01581 * a non-child element 01582 */ 01583 virtual const ElemTemplateElement* 01584 getInvoker() const = 0; 01585 #endif 01586 01587 /** 01588 * Determine the number of trace listeners. 01589 * 01590 * @return number of listeners 01591 */ 01592 virtual tl_size_type 01593 getTraceListeners() const = 0; 01594 01595 /** 01596 * Fire a generate event. 01597 * 01598 * @param ge generate event to fire 01599 */ 01600 virtual void 01601 fireGenerateEvent(const GenerateEvent& ge) = 0; 01602 01603 /** 01604 * Fire a trace event. 01605 * 01606 * @param te trace event to fire 01607 */ 01608 virtual void 01609 fireTraceEvent(const TracerEvent& te) = 0; 01610 01611 /** 01612 * Fire a selection event. 01613 * 01614 * @param se selection event to fire 01615 */ 01616 virtual void 01617 fireSelectEvent(const SelectionEvent& se) = 0; 01618 01619 /** 01620 * If this is set to true, simple traces of template calls are made. 01621 * 01622 * @return true if traces made 01623 */ 01624 virtual bool 01625 getTraceSelects() const = 0; 01626 01627 /** 01628 * Compose a diagnostic trace of the current selection 01629 * 01630 * @param theStylesheetElement The executing stylesheet element 01631 * @param nl The list of selected nodes 01632 * @param xpath A pointer to the XPath which generated the list of nodes, if any. 01633 */ 01634 virtual void 01635 traceSelect( 01636 const ElemTemplateElement& theStylesheetElement, 01637 const NodeRefListBase& nl, 01638 const XPath* xpath) = 0; 01639 01640 /** 01641 * Compare two strings using the collation of the 01642 * current locale. 01643 * 01644 * @param theLHS a string to compare 01645 * @param theRHS a string to compare 01646 * @param theCaseOrder the case order for the comparison 01647 * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS 01648 */ 01649 virtual int 01650 collationCompare( 01651 const XalanDOMString& theLHS, 01652 const XalanDOMString& theRHS, 01653 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) = 0; 01654 01655 /** 01656 * Compare two strings using the collation of the 01657 * supplied locale. 01658 * 01659 * @param theLHS a string to compare 01660 * @param theRHS a string to compare 01661 * @param theLocal a string that specifies the locale 01662 * @param theCaseOrder the case order for the comparison 01663 * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS 01664 */ 01665 virtual int 01666 collationCompare( 01667 const XalanDOMString& theLHS, 01668 const XalanDOMString& theRHS, 01669 const XalanDOMString& theLocale, 01670 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) = 0; 01671 01672 /** 01673 * Compare two strings using the collation of the 01674 * current locale. 01675 * 01676 * @param theLHS a string to compare 01677 * @param theRHS a string to compare 01678 * @param theCaseOrder the case order for the comparison 01679 * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS 01680 */ 01681 virtual int 01682 collationCompare( 01683 const XalanDOMChar* theLHS, 01684 const XalanDOMChar* theRHS, 01685 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) = 0; 01686 01687 /** 01688 * Compare two strings using the collation of the 01689 * current locale. 01690 * 01691 * @param theLHS a string to compare 01692 * @param theRHS a string to compare 01693 * @param theLocal a string that specifies the locale 01694 * @param theCaseOrder the case order for the comparison 01695 * @return < 0 if theLHS is before theRHS, 0 if they are equal, or > 0 if theLHS is after theRHS 01696 */ 01697 virtual int 01698 collationCompare( 01699 const XalanDOMChar* theLHS, 01700 const XalanDOMChar* theRHS, 01701 const XalanDOMChar* theLocale, 01702 XalanCollationServices::eCaseOrder theCaseOrder = XalanCollationServices::eDefault) = 0; 01703 01704 /** 01705 * Create a PrintWriter for the provided stream. 01706 * 01707 * @param theTextOutputStream The output stream for the PrintWriter. 01708 * @return The new instance. 01709 */ 01710 virtual PrintWriter* 01711 createPrintWriter(XalanOutputStream* theTextOutputStream) = 0; 01712 01713 /** 01714 * Create a PrintWriter. Create an appropriate output stream 01715 * using the provided file name and encoding. 01716 * 01717 * @param theFileName The file name for the output stream 01718 * @param theEncoding The encoding for the output stream 01719 * @return The new instance. 01720 */ 01721 virtual PrintWriter* 01722 createPrintWriter( 01723 const XalanDOMString& theFileName, 01724 const XalanDOMString& theEncoding) = 0; 01725 01726 /** 01727 * Create a PrintWriter using the provided ostream instance. 01728 * 01729 * @param theStream The output stream for the PrintWriter. 01730 * @return The new instance. 01731 */ 01732 virtual PrintWriter* 01733 createPrintWriter(StreamType& theStream) = 0; 01734 01735 /** 01736 * Create a PrintWriter using the provided FILE instance. 01737 * 01738 * @param theStream The output stream for the PrintWriter. 01739 * @return The new instance. 01740 */ 01741 virtual PrintWriter* 01742 createPrintWriter(FILE* theStream) = 0; 01743 01744 /** 01745 * Get the counters table, which is a table of cached 01746 * results that is used by ElemNumber. 01747 * 01748 * @return A reference to the counters table. 01749 */ 01750 virtual CountersTable& 01751 getCountersTable() = 0; 01752 01753 /** 01754 * Send character data from a node to the result tree. 01755 * 01756 * @param node The node to send. 01757 */ 01758 virtual void 01759 characters(const XalanNode& node) = 0; 01760 01761 /** 01762 * Send character data from an XObject to the result tree. 01763 * 01764 * @param node The xobject to send. 01765 */ 01766 virtual void 01767 characters(const XObjectPtr& xobject) = 0; 01768 01769 /** 01770 * Send raw character data from a node to the result tree. 01771 * 01772 * @param node The node to send. 01773 * @param length number of characters to read from the array 01774 */ 01775 virtual void 01776 charactersRaw(const XalanNode& node) = 0; 01777 01778 /** 01779 * Send raw character data from an XObject to the result tree. 01780 * 01781 * @param node The xobject to send. 01782 */ 01783 virtual void 01784 charactersRaw(const XObjectPtr& xobject) = 0; 01785 01786 01787 // These interfaces are inherited from XPathExecutionContext... 01788 01789 virtual void 01790 reset() = 0; 01791 01792 virtual XalanNode* 01793 getCurrentNode() const = 0; 01794 01795 virtual void 01796 pushCurrentNode(XalanNode* theCurrentNode) = 0; 01797 01798 virtual void 01799 popCurrentNode() = 0; 01800 01801 virtual bool 01802 isNodeAfter( 01803 const XalanNode& node1, 01804 const XalanNode& node2) const = 0; 01805 01806 virtual void 01807 pushContextNodeList(const NodeRefListBase& theList) = 0; 01808 01809 virtual void 01810 popContextNodeList() = 0; 01811 01812 virtual const NodeRefListBase& 01813 getContextNodeList() const = 0; 01814 01815 virtual size_type 01816 getContextNodeListLength() const = 0; 01817 01818 virtual size_type 01819 getContextNodeListPosition(const XalanNode& contextNode) const = 0; 01820 01821 /** 01822 * Determine if an external element is available. 01823 * 01824 * @param theQName The QName of the element 01825 * 01826 * @return whether the given element is available or not 01827 */ 01828 virtual bool 01829 elementAvailable(const XalanQName& theQName) const = 0; 01830 01831 /** 01832 * Determine if an external element is available by resolving 01833 * a string to a QName. 01834 * 01835 * @param theName The name of the element 01836 * @param locator A Locator instance for error reporting 01837 * 01838 * @return whether the given element is available or not 01839 */ 01840 virtual bool 01841 elementAvailable( 01842 const XalanDOMString& theName, 01843 const Locator* locator) const = 0; 01844 01845 /** 01846 * Determine if a function is available. 01847 * 01848 * @param theQName The QName of the function 01849 * 01850 * @return whether the function is available or not 01851 */ 01852 virtual bool 01853 functionAvailable(const XalanQName& theQName) const = 0; 01854 01855 /** 01856 * Determine if a function is available. 01857 * 01858 * @param theName The name of the function 01859 * @param locator A Locator instance for error reporting 01860 * 01861 * @return whether the function is available or not 01862 */ 01863 virtual bool 01864 functionAvailable( 01865 const XalanDOMString& theName, 01866 const Locator* locator) const = 0; 01867 01868 virtual const XObjectPtr 01869 extFunction( 01870 const XalanDOMString& theNamespace, 01871 const XalanDOMString& functionName, 01872 XalanNode* context, 01873 const XObjectArgVectorType& argVec, 01874 const Locator* locator) = 0; 01875 01876 virtual XalanDocument* 01877 parseXML( 01878 MemoryManager& theManager, 01879 const XalanDOMString& urlString, 01880 const XalanDOMString& base, 01881 ErrorHandler* theErrorHandler = 0) const = 0; 01882 01883 virtual MutableNodeRefList* 01884 borrowMutableNodeRefList() = 0; 01885 01886 virtual bool 01887 returnMutableNodeRefList(MutableNodeRefList* theList) = 0; 01888 01889 virtual MutableNodeRefList* 01890 createMutableNodeRefList(MemoryManager& theManager) const = 0; 01891 01892 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 01893 01894 virtual MutableNodeRefList& 01895 createAndPushMutableNodeRefList() = 0; 01896 01897 virtual void 01898 releaseAndPopMutableNodeRefList() = 0; 01899 01900 virtual void 01901 pushXObjectPtr(const XObjectPtr& xobjectPtr) = 0; 01902 01903 virtual void 01904 popXObjectPtr() = 0; 01905 01906 virtual void 01907 createAndPushNodesToTransformList(const NodeRefListBase* nodeList) = 0; 01908 01909 virtual XalanNode* 01910 getNextNodeToTransform() = 0; 01911 01912 virtual void 01913 popNodesToTransformList() = 0; 01914 01915 /** 01916 * Get a string that is cached on a stack 01917 * @returns a cached string 01918 */ 01919 virtual XalanDOMString& 01920 getAndPushCachedString() = 0; 01921 01922 /** 01923 * Gets the last string that was cached on the stack 01924 * @returns the last string to be cached 01925 */ 01926 virtual XalanDOMString& 01927 getLastCachedString() = 0; 01928 01929 /** 01930 * Gets the last string to be cached on the stack and 01931 * pops it from the stack. The reference is valid until 01932 * the next request is made for a cached string 01933 * 01934 * @returns the last string to be cached 01935 */ 01936 virtual XalanDOMString& 01937 getAndPopCachedString() = 0; 01938 #endif 01939 01940 virtual XalanDOMString& 01941 getCachedString() = 0; 01942 01943 virtual bool 01944 releaseCachedString(XalanDOMString& theString) = 0; 01945 01946 01947 virtual void 01948 getNodeSetByKey( 01949 XalanNode* context, 01950 const XalanQName& qname, 01951 const XalanDOMString& ref, 01952 const Locator* locator, 01953 MutableNodeRefList& nodelist) = 0; 01954 01955 virtual void 01956 getNodeSetByKey( 01957 XalanNode* context, 01958 const XalanDOMString& name, 01959 const XalanDOMString& ref, 01960 const Locator* locator, 01961 MutableNodeRefList& nodelist) = 0; 01962 01963 virtual const XObjectPtr 01964 getVariable( 01965 const XalanQName& name, 01966 const Locator* locator = 0) = 0; 01967 01968 virtual const PrefixResolver* 01969 getPrefixResolver() const = 0; 01970 01971 virtual void 01972 setPrefixResolver(const PrefixResolver* thePrefixResolver) = 0; 01973 01974 virtual const XalanDOMString* 01975 getNamespaceForPrefix(const XalanDOMString& prefix) const = 0; 01976 01977 virtual const XalanDOMString& 01978 findURIFromDoc(const XalanDocument* owner) const = 0; 01979 01980 virtual const XalanDOMString& 01981 getUnparsedEntityURI( 01982 const XalanDOMString& theName, 01983 const XalanDocument& theDocument) const = 0; 01984 01985 virtual bool 01986 shouldStripSourceNode(const XalanText& node) = 0; 01987 01988 virtual XalanDocument* 01989 getSourceDocument(const XalanDOMString& theURI) const = 0; 01990 01991 virtual void 01992 setSourceDocument( 01993 const XalanDOMString& theURI, 01994 XalanDocument* theDocument) = 0; 01995 01996 virtual void 01997 formatNumber( 01998 double number, 01999 const XalanDOMString& pattern, 02000 XalanDOMString& theResult, 02001 const XalanNode* context = 0, 02002 const Locator* locator = 0) = 0; 02003 02004 virtual void 02005 formatNumber( 02006 double number, 02007 const XalanDOMString& pattern, 02008 const XalanDOMString& dfsName, 02009 XalanDOMString& theResult, 02010 const XalanNode* context = 0, 02011 const Locator* locator = 0) = 0; 02012 02013 // These interfaces are inherited from ExecutionContext... 02014 02015 virtual void 02016 problem( 02017 eSource source, 02018 eClassification classification, 02019 const XalanDOMString& msg, 02020 const Locator* locator, 02021 const XalanNode* sourceNode) = 0; 02022 02023 virtual void 02024 problem( 02025 eSource source, 02026 eClassification classification, 02027 const XalanDOMString& msg, 02028 const XalanNode* sourceNode) = 0; 02029 02030 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 02031 protected: 02032 /** 02033 * Borrow a cached FormatterToText instance. 02034 * 02035 * @return A pointer to the instance. 02036 */ 02037 virtual FormatterToText* 02038 borrowFormatterToText() = 0; 02039 02040 /** 02041 * Return a previously borrowed FormatterToText instance. 02042 * 02043 * @param theFormatter A pointer the to previously borrowed instance. 02044 * @return true if the instance was previously borrowed, false if not. 02045 */ 02046 virtual bool 02047 returnFormatterToText(FormatterToText* theFormatter) = 0; 02048 #endif 02049 }; 02050 02051 02052 02053 XALAN_CPP_NAMESPACE_END 02054 02055 02056 02057 #endif // STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|