00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2002 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 * 00057 * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a> 00058 */ 00059 #if !defined(STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680) 00060 #define STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680 00061 00062 00063 00064 // Base include file. Must be first. 00065 #include <XSLT/XSLTDefinitions.hpp> 00066 00067 00068 00069 #include <cstddef> 00070 #include <memory> 00071 00072 00073 00074 // Base class header file... 00075 #include <XPath/XPathExecutionContext.hpp> 00076 00077 00078 00079 #include <XalanDOM/XalanDOMString.hpp> 00080 00081 00082 00083 // Base class header file... 00084 #include <PlatformSupport/ExecutionContext.hpp> 00085 00086 00087 00088 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) 00089 #include <PlatformSupport/XalanNumberFormat.hpp> 00090 #endif 00091 00092 00093 00094 #include <Include/XalanAutoPtr.hpp> 00095 00096 00097 00098 #include <PlatformSupport/AttributeListImpl.hpp> 00099 00100 00101 00102 #include <XSLT/KeyTable.hpp> 00103 #include <XSLT/TopLevelArg.hpp> 00104 00105 00106 00107 XALAN_CPP_NAMESPACE_BEGIN 00108 00109 00110 00111 class CountersTable; 00112 class ElemTemplate; 00113 class ElemTemplateElement; 00114 class ElemVariable; 00115 class FormatterListener; 00116 class FormatterToDOM; 00117 class FormatterToHTML; 00118 class FormatterToText; 00119 class FormatterToXML; 00120 class GenerateEvent; 00121 class KeyTable; 00122 class PrefixResolver; 00123 class NodeRefListBase; 00124 class NodeSorter; 00125 class PrintWriter; 00126 class XalanQName; 00127 class SelectionEvent; 00128 class Stylesheet; 00129 class StylesheetRoot; 00130 class XalanOutputStream; 00131 class TracerEvent; 00132 class Writer; 00133 class XalanDocument; 00134 class XalanDocumentFragment; 00135 class XalanElement; 00136 class XalanNode; 00137 class XalanNumberFormat; 00138 class XPath; 00139 class XObject; 00140 class XObjectPtr; 00141 class XResultTreeFrag; 00142 00143 00144 00145 // 00146 // An abstract class which provides support for executing stylesheets. 00147 // 00148 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext 00149 { 00150 public: 00151 00152 #if defined(XALAN_NO_STD_NAMESPACE) 00153 typedef ostream StreamType; 00154 #else 00155 typedef std::ostream StreamType; 00156 #endif 00157 00158 typedef size_t size_type; 00159 00160 explicit 00161 StylesheetExecutionContext(XObjectFactory* theXObjectFactory = 0); 00162 00163 virtual 00164 ~StylesheetExecutionContext(); 00165 00166 // These interfaces are new... 00167 00175 virtual void 00176 error( 00177 const XalanDOMString& msg, 00178 const ElemTemplateElement& styleNode, 00179 const XalanNode* sourceNode = 0) const = 0; 00180 00188 virtual void 00189 error( 00190 const char* msg, 00191 const ElemTemplateElement& styleNode, 00192 const XalanNode* sourceNode = 0) const = 0; 00193 00201 virtual void 00202 warn( 00203 const XalanDOMString& msg, 00204 const ElemTemplateElement& styleNode, 00205 const XalanNode* sourceNode = 0) const = 0; 00206 00214 virtual void 00215 warn( 00216 const char* msg, 00217 const ElemTemplateElement& styleNode, 00218 const XalanNode* sourceNode = 0) const = 0; 00219 00227 virtual void 00228 message( 00229 const XalanDOMString& msg, 00230 const ElemTemplateElement& styleNode, 00231 const XalanNode* sourceNode = 0) const = 0; 00232 00233 00241 virtual void 00242 message( 00243 const char* msg, 00244 const ElemTemplateElement& styleNode, 00245 const XalanNode* sourceNode = 0) const = 0; 00246 00252 virtual bool 00253 getQuietConflictWarnings() const = 0; 00254 00261 virtual bool 00262 getCopyTextNodesOnly() const = 0; 00263 00270 virtual void 00271 setCopyTextNodesOnly(bool fValue) = 0; 00272 00273 /* 00274 * A class to manage setting and restoring the flag 00275 * for restricting copying only text nodes to the 00276 * result tree 00277 */ 00278 class SetAndRestoreCopyTextNodesOnly 00279 { 00280 public: 00281 00282 SetAndRestoreCopyTextNodesOnly( 00283 StylesheetExecutionContext& executionContext, 00284 bool fValue) : 00285 m_executionContext(executionContext), 00286 m_fValue(executionContext.getCopyTextNodesOnly()) 00287 { 00288 executionContext.setCopyTextNodesOnly(fValue); 00289 } 00290 00291 ~SetAndRestoreCopyTextNodesOnly() 00292 { 00293 m_executionContext.setCopyTextNodesOnly(m_fValue); 00294 } 00295 00296 private: 00297 00298 // Not implemented... 00299 SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&); 00300 00301 SetAndRestoreCopyTextNodesOnly& 00302 operator=(const SetAndRestoreCopyTextNodesOnly&); 00303 00304 // Data members... 00305 StylesheetExecutionContext& m_executionContext; 00306 00307 const bool m_fValue; 00308 }; 00309 00317 virtual XalanNode* 00318 getRootDocument() const = 0; 00319 00327 virtual void 00328 setRootDocument(XalanNode* theDocument) = 0; 00329 00335 virtual XalanDocument* 00336 createDocument() const = 0; 00337 00343 virtual void 00344 setStylesheetRoot(const StylesheetRoot* theStylesheet) = 0; 00345 00351 virtual const XalanQName* 00352 getCurrentMode() const = 0; 00353 00359 virtual void 00360 setCurrentMode(const XalanQName* theMode) = 0; 00361 00367 virtual const ElemTemplate* 00368 getCurrentTemplate() const = 0; 00369 00375 virtual void 00376 setCurrentTemplate(const ElemTemplate* theTemplate) = 0; 00377 00378 /* 00379 * A class to manage setting and restoring the current 00380 * template instance. 00381 */ 00382 class SetAndRestoreCurrentTemplate 00383 { 00384 public: 00385 00386 SetAndRestoreCurrentTemplate( 00387 StylesheetExecutionContext& executionContext, 00388 const ElemTemplate* theTemplate) : 00389 m_executionContext(executionContext), 00390 m_template(executionContext.getCurrentTemplate()) 00391 { 00392 executionContext.setCurrentTemplate(theTemplate); 00393 } 00394 00395 ~SetAndRestoreCurrentTemplate() 00396 { 00397 m_executionContext.setCurrentTemplate(m_template); 00398 } 00399 00400 private: 00401 00402 // Not implemented... 00403 SetAndRestoreCurrentTemplate(const SetAndRestoreCurrentTemplate&); 00404 00405 SetAndRestoreCurrentTemplate& 00406 operator=(const SetAndRestoreCurrentTemplate&); 00407 00408 // Data members... 00409 StylesheetExecutionContext& m_executionContext; 00410 00411 const ElemTemplate* const m_template; 00412 }; 00413 00419 virtual bool 00420 doDiagnosticsOutput() const = 0; 00421 00427 virtual void 00428 diag(const XalanDOMString& theString) = 0; 00429 00436 virtual void 00437 pushTime(const void* theKey) = 0; 00438 00445 virtual void 00446 displayDuration( 00447 const XalanDOMString& theMessage, 00448 const void* theKey) = 0; 00449 00453 virtual bool 00454 isElementPending() const = 0; 00455 00463 virtual void 00464 replacePendingAttribute( 00465 const XalanDOMChar* theName, 00466 const XalanDOMChar* theNewType, 00467 const XalanDOMChar* theNewValue) = 0; 00468 00474 virtual FormatterListener* 00475 getFormatterListener() const = 0; 00476 00482 virtual void 00483 setFormatterListener(FormatterListener* flistener) = 0; 00484 00485 virtual void 00486 pushOutputContext(FormatterListener* flistener = 0) = 0; 00487 00488 virtual void 00489 popOutputContext() = 0; 00490 00491 class OutputContextPushPop 00492 { 00493 public: 00494 00501 OutputContextPushPop( 00502 StylesheetExecutionContext& theExecutionContext, 00503 FormatterListener* theNewListener = 0) : 00504 m_executionContext(theExecutionContext) 00505 { 00506 m_executionContext.pushOutputContext(theNewListener); 00507 } 00508 00509 ~OutputContextPushPop() 00510 { 00511 m_executionContext.popOutputContext(); 00512 } 00513 00514 private: 00515 00516 StylesheetExecutionContext& m_executionContext; 00517 }; 00518 00525 virtual void 00526 addResultAttribute( 00527 const XalanDOMString& aname, 00528 const XalanDOMString& value) = 0; 00529 00536 virtual void 00537 addResultAttribute( 00538 const XalanDOMString& aname, 00539 const XalanDOMChar* value) = 0; 00540 00546 virtual void 00547 copyNamespaceAttributes(const XalanNode& src) = 0; 00548 00556 virtual const XalanDOMString* 00557 getResultPrefixForNamespace(const XalanDOMString& theNamespace) const = 0; 00558 00566 virtual const XalanDOMString* 00567 getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const = 0; 00568 00577 virtual bool 00578 isPendingResultPrefix(const XalanDOMString& thePrefix) = 0; 00579 00585 virtual XalanDOMString 00586 getUniqueNamespaceValue() const = 0; 00587 00593 virtual void 00594 getUniqueNamespaceValue(XalanDOMString& theValue) const = 0; 00595 00601 virtual int 00602 getIndent() const = 0; 00603 00609 virtual void 00610 setIndent(int indentAmount) = 0; 00611 00612 // $$$ ToDo: Remove this one!!!! 00622 // virtual const XObjectPtr 00623 // executeXPath( 00624 // const XalanDOMString& str, 00625 // XalanNode* contextNode, 00626 // const XalanElement& resolver) = 0; 00627 00636 virtual const XPath* 00637 createMatchPattern( 00638 const XalanDOMString& str, 00639 const PrefixResolver& resolver) = 0; 00640 00646 virtual void 00647 returnXPath(const XPath* xpath) = 0; 00648 00649 // A helper class to automatically return an XPath instance. 00650 class XPathGuard 00651 { 00652 public: 00653 00654 XPathGuard( 00655 StylesheetExecutionContext& context, 00656 const XPath* xpath = 0) : 00657 m_context(context), 00658 m_xpath(xpath) 00659 { 00660 } 00661 00662 ~XPathGuard() 00663 { 00664 if (m_xpath != 0) 00665 { 00666 m_context.returnXPath(m_xpath); 00667 } 00668 } 00669 00670 const XPath* 00671 get() const 00672 { 00673 return m_xpath; 00674 } 00675 00676 const XPath* 00677 release() 00678 { 00679 const XPath* const temp = m_xpath; 00680 00681 m_xpath = 0; 00682 00683 return temp; 00684 } 00685 00686 void 00687 reset(const XPath* xpath) 00688 { 00689 if (m_xpath != 0) 00690 { 00691 m_context.returnXPath(m_xpath); 00692 } 00693 00694 m_xpath = xpath; 00695 } 00696 00697 private: 00698 00699 StylesheetExecutionContext& m_context; 00700 00701 const XPath* m_xpath; 00702 }; 00703 00704 #if defined(XALAN_NO_STD_NAMESPACE) 00705 typedef vector<TopLevelArg> ParamVectorType; 00706 #else 00707 typedef std::vector<TopLevelArg> ParamVectorType; 00708 #endif 00709 00716 virtual void 00717 pushTopLevelVariables(const ParamVectorType& topLevelParams) = 0; 00718 00728 virtual const XObjectPtr 00729 createVariable( 00730 const XPath& xpath, 00731 XalanNode* contextNode, 00732 const PrefixResolver& resolver) = 0; 00733 00742 virtual const XObjectPtr 00743 createVariable( 00744 const ElemTemplateElement& templateChild, 00745 XalanNode* sourceNode) = 0; 00746 00759 virtual void 00760 pushVariable( 00761 const XalanQName& name, 00762 const ElemTemplateElement* element, 00763 const XalanDOMString& str, 00764 XalanNode* contextNode, 00765 const PrefixResolver& resolver) = 0; 00766 00778 virtual void 00779 pushVariable( 00780 const XalanQName& name, 00781 const ElemTemplateElement* element, 00782 const XPath& xpath, 00783 XalanNode* contextNode, 00784 const PrefixResolver& resolver) = 0; 00785 00795 virtual void 00796 pushVariable( 00797 const XalanQName& name, 00798 const ElemTemplateElement* element, 00799 const ElemTemplateElement& templateChild, 00800 XalanNode* sourceNode) = 0; 00801 00810 virtual void 00811 pushVariable( 00812 const XalanQName& name, 00813 const XObjectPtr val, 00814 const ElemTemplateElement* element) = 0; 00815 00824 virtual void 00825 pushVariable( 00826 const XalanQName& name, 00827 const ElemVariable* var, 00828 const ElemTemplateElement* element) = 0; 00829 00834 virtual void 00835 pushContextMarker() = 0; 00836 00840 virtual void 00841 popContextMarker() = 0; 00842 00843 /* 00844 * A class to manage pushing and popping an element's stack 00845 * frame context. 00846 */ 00847 class PushAndPopContextMarker 00848 { 00849 public: 00850 00851 PushAndPopContextMarker(StylesheetExecutionContext& executionContext) : 00852 m_executionContext(executionContext) 00853 { 00854 executionContext.pushContextMarker(); 00855 } 00856 00857 ~PushAndPopContextMarker() 00858 { 00859 m_executionContext.popContextMarker(); 00860 } 00861 00862 private: 00863 00864 StylesheetExecutionContext& m_executionContext; 00865 }; 00866 00870 virtual void 00871 resolveTopLevelParams() = 0; 00872 00876 virtual void 00877 clearTopLevelParams() = 0; 00878 00879 class ResolveAndClearTopLevelParams 00880 { 00881 public: 00882 00883 ResolveAndClearTopLevelParams(StylesheetExecutionContext& executionContext) : 00884 m_executionContext(executionContext) 00885 { 00886 m_executionContext.resolveTopLevelParams(); 00887 } 00888 00889 ~ResolveAndClearTopLevelParams() 00890 { 00891 m_executionContext.clearTopLevelParams(); 00892 } 00893 00894 private: 00895 00896 StylesheetExecutionContext& m_executionContext; 00897 }; 00898 00907 virtual void 00908 pushParams( 00909 const ElemTemplateElement& xslCallTemplateElement, 00910 XalanNode* sourceNode, 00911 const ElemTemplateElement* targetTemplate) = 0; 00912 00920 virtual const XObjectPtr 00921 getParamVariable(const XalanQName& theName) = 0; 00922 00928 virtual void 00929 pushElementFrame(const ElemTemplateElement* elem) = 0; 00930 00936 virtual void 00937 popElementFrame(const ElemTemplateElement* elem) = 0; 00938 00939 /* 00940 * A class to manage pushing and popping an element's stack 00941 * frame context. 00942 */ 00943 class PushAndPopElementFrame 00944 { 00945 public: 00946 00947 PushAndPopElementFrame( 00948 StylesheetExecutionContext& executionContext, 00949 const ElemTemplateElement* element) : 00950 m_executionContext(executionContext), 00951 m_element(element) 00952 { 00953 executionContext.pushElementFrame(element); 00954 } 00955 00956 ~PushAndPopElementFrame() 00957 { 00958 m_executionContext.popElementFrame(m_element); 00959 } 00960 00961 private: 00962 00963 StylesheetExecutionContext& m_executionContext; 00964 00965 const ElemTemplateElement* m_element; 00966 }; 00967 00973 virtual int 00974 getGlobalStackFrameIndex() const = 0; 00975 00982 virtual int 00983 getCurrentStackFrameIndex() const = 0; 00984 00991 virtual void 00992 setCurrentStackFrameIndex(int currentStackFrameIndex = -1) = 0; 00993 00994 /* 00995 * A class to manage the state of the variable stacks frame index. 00996 */ 00997 class SetAndRestoreCurrentStackFrameIndex 00998 { 00999 public: 01000 01001 SetAndRestoreCurrentStackFrameIndex( 01002 StylesheetExecutionContext& executionContext, 01003 int newIndex) : 01004 m_executionContext(executionContext), 01005 m_savedIndex(executionContext.getCurrentStackFrameIndex()) 01006 { 01007 executionContext.setCurrentStackFrameIndex(newIndex); 01008 } 01009 01010 ~SetAndRestoreCurrentStackFrameIndex() 01011 { 01012 m_executionContext.setCurrentStackFrameIndex(m_savedIndex); 01013 } 01014 01015 int 01016 getStackFrameIndex() const 01017 { 01018 return m_savedIndex; 01019 } 01020 01021 private: 01022 01023 StylesheetExecutionContext& m_executionContext; 01024 01025 const int m_savedIndex; 01026 }; 01027 01028 /* 01029 * A class to manage stack state during execution. 01030 */ 01031 class ParamsPushPop 01032 { 01033 public: 01034 01035 ParamsPushPop( 01036 StylesheetExecutionContext& executionContext, 01037 const ElemTemplateElement& xslCallTemplateElement, 01038 XalanNode* sourceNode, 01039 const ElemTemplateElement* targetTemplate); 01040 01041 ~ParamsPushPop(); 01042 01043 int 01044 getStackFrameIndex() const 01045 { 01046 return m_savedStackFrameIndex; 01047 } 01048 01049 private: 01050 01051 StylesheetExecutionContext& m_executionContext; 01052 01053 const int m_savedStackFrameIndex; 01054 }; 01055 01065 virtual void 01066 startDocument() = 0; 01067 01079 virtual void 01080 endDocument() = 0; 01081 01087 virtual void 01088 startElement(const XalanDOMChar* name) = 0; 01089 01095 virtual void 01096 endElement(const XalanDOMChar* name) = 0; 01097 01105 virtual void 01106 characters( 01107 const XalanDOMChar* ch, 01108 XalanDOMString::size_type start, 01109 XalanDOMString::size_type length) = 0; 01110 01120 virtual void 01121 charactersRaw( 01122 const XalanDOMChar* ch, 01123 XalanDOMString::size_type start, 01124 XalanDOMString::size_type length) = 0; 01125 01131 virtual void 01132 comment(const XalanDOMChar* data) = 0; 01133 01140 virtual void 01141 processingInstruction( 01142 const XalanDOMChar* target, 01143 const XalanDOMChar* data) = 0; 01144 01148 virtual void 01149 flushPending() = 0; 01150 01157 virtual void 01158 cloneToResultTree( 01159 const XalanNode& node, 01160 const ElemTemplateElement* styleNode) = 0; 01161 01172 virtual void 01173 cloneToResultTree( 01174 const XalanNode& node, 01175 XalanNode::NodeType nodeType, 01176 bool isLiteral, 01177 bool overrideStrip, 01178 bool shouldCloneAttributes, 01179 const ElemTemplateElement* styleNode) = 0; 01180 01188 virtual const XObjectPtr 01189 createXResultTreeFrag( 01190 const ElemTemplateElement& templateChild, 01191 XalanNode* sourceNode) = 0; 01192 01200 virtual void 01201 outputToResultTree( 01202 const XObject& xobj, 01203 const ElemTemplateElement* styleNode) = 0; 01204 01212 virtual void 01213 outputResultTreeFragment( 01214 const XObject& theTree, 01215 const ElemTemplateElement* styleNode) = 0; 01216 01222 virtual const XalanDOMString& 01223 getXSLNameSpaceURL() const = 0; 01224 01230 virtual const XalanDOMString& 01231 getXalanXSLNameSpaceURL() const = 0; 01232 01238 virtual bool 01239 findOnElementRecursionStack(const ElemTemplateElement* theElement) const = 0; 01240 01246 virtual void 01247 pushOnElementRecursionStack(const ElemTemplateElement* theElement) = 0; 01248 01254 virtual const ElemTemplateElement* 01255 popElementRecursionStack() = 0; 01256 01260 class ElementRecursionStackPusher 01261 { 01262 public: 01263 01270 ElementRecursionStackPusher( 01271 StylesheetExecutionContext& executionContext, 01272 const ElemTemplateElement* element) : 01273 m_executionContext(executionContext) 01274 { 01275 m_executionContext.pushOnElementRecursionStack(element); 01276 } 01277 01278 ~ElementRecursionStackPusher() 01279 { 01280 m_executionContext.popElementRecursionStack(); 01281 } 01282 01283 private: 01284 01285 StylesheetExecutionContext& m_executionContext; 01286 }; 01287 01288 01298 virtual bool 01299 returnXResultTreeFrag(XResultTreeFrag* theXResultTreeFrag) = 0; 01300 01301 01302 enum eDummy 01303 { 01304 eDefaultXMLIndentAmount = 0, 01305 eDefaultHTMLIndentAmount = 0 01306 }; 01307 01311 enum eEscapeURLs 01312 { 01313 eEscapeURLsDefault, // Use the value in the stylesheet 01314 eEscapeURLsNo, // Don't escape URLs 01315 eEscapeURLsYes // Escape URLs 01316 }; 01317 01325 virtual eEscapeURLs 01326 getEscapeURLs() const = 0; 01327 01335 virtual void 01336 setEscapeURLs(eEscapeURLs value) = 0; 01337 01338 01342 enum eOmitMETATag 01343 { 01344 eOmitMETATagDefault, // Use the value in the stylesheet 01345 eOmitMETATagNo, // Don't omit the META tag 01346 eOmitMETATagYes // Omit the META tag 01347 }; 01348 01356 virtual eOmitMETATag 01357 getOmitMETATag() const = 0; 01358 01366 virtual void 01367 setOmitMETATag(eOmitMETATag value) = 0; 01368 01389 virtual FormatterToXML* 01390 createFormatterToXML( 01391 Writer& writer, 01392 const XalanDOMString& version = XalanDOMString(), 01393 bool doIndent = false, 01394 int indent = eDefaultXMLIndentAmount, 01395 const XalanDOMString& encoding = XalanDOMString(), 01396 const XalanDOMString& mediaType = XalanDOMString(), 01397 const XalanDOMString& doctypeSystem = XalanDOMString(), 01398 const XalanDOMString& doctypePublic = XalanDOMString(), 01399 bool xmlDecl = true, 01400 const XalanDOMString& standalone = XalanDOMString()) = 0; 01401 01419 virtual FormatterToHTML* 01420 createFormatterToHTML( 01421 Writer& writer, 01422 const XalanDOMString& encoding = XalanDOMString(), 01423 const XalanDOMString& mediaType = XalanDOMString(), 01424 const XalanDOMString& doctypeSystem = XalanDOMString(), 01425 const XalanDOMString& doctypePublic = XalanDOMString(), 01426 bool doIndent = true, 01427 int indent = eDefaultHTMLIndentAmount, 01428 bool escapeURLs = true, 01429 bool omitMetaTag = false) = 0; 01430 01439 virtual FormatterToDOM* 01440 createFormatterToDOM( 01441 XalanDocument* doc, 01442 XalanDocumentFragment* docFrag, 01443 XalanElement* currentElement) = 0; 01444 01453 virtual FormatterToDOM* 01454 createFormatterToDOM( 01455 XalanDocument* doc, 01456 XalanElement* elem) = 0; 01457 01464 virtual FormatterToText* 01465 createFormatterToText( 01466 Writer& writer, 01467 const XalanDOMString& encoding) = 0; 01468 01474 virtual FormatterToText* 01475 borrowFormatterToText() = 0; 01476 01483 virtual bool 01484 returnFormatterToText(FormatterToText* theFormatter) = 0; 01485 01486 class BorrowReturnFormatterToText 01487 { 01488 public: 01489 01490 BorrowReturnFormatterToText( 01491 StylesheetExecutionContext& executionContext, 01492 Writer& writer, 01493 bool normalizeLinefeed = true, 01494 bool handleIgnorableWhitespace = true); 01495 01496 ~BorrowReturnFormatterToText() 01497 { 01498 assert(m_formatter != 0); 01499 01500 m_executionContext.returnFormatterToText(m_formatter); 01501 } 01502 01503 FormatterToText& 01504 operator*() const 01505 { 01506 assert(m_formatter != 0); 01507 01508 return *m_formatter; 01509 } 01510 01511 FormatterToText* 01512 get() const 01513 { 01514 assert(m_formatter != 0); 01515 01516 return m_formatter; 01517 } 01518 01519 FormatterToText* 01520 operator->() const 01521 { 01522 return get(); 01523 } 01524 01525 private: 01526 01527 StylesheetExecutionContext& m_executionContext; 01528 01529 FormatterToText* m_formatter; 01530 }; 01531 01532 01538 virtual NodeSorter* 01539 borrowNodeSorter() = 0; 01540 01547 virtual bool 01548 returnNodeSorter(NodeSorter* theSorter) = 0; 01549 01550 class BorrowReturnNodeSorter 01551 { 01552 public: 01553 01554 BorrowReturnNodeSorter(StylesheetExecutionContext& executionContext) : 01555 m_executionContext(executionContext), 01556 m_sorter(executionContext.borrowNodeSorter()) 01557 { 01558 assert(m_sorter != 0); 01559 } 01560 01561 ~BorrowReturnNodeSorter() 01562 { 01563 assert(m_sorter != 0); 01564 01565 m_executionContext.returnNodeSorter(m_sorter); 01566 } 01567 01568 NodeSorter& 01569 operator*() const 01570 { 01571 assert(m_sorter != 0); 01572 01573 return *m_sorter; 01574 } 01575 01576 NodeSorter* 01577 get() const 01578 { 01579 assert(m_sorter != 0); 01580 01581 return m_sorter; 01582 } 01583 01584 NodeSorter* 01585 operator->() const 01586 { 01587 return get(); 01588 } 01589 01590 private: 01591 01592 StylesheetExecutionContext& m_executionContext; 01593 01594 NodeSorter* m_sorter; 01595 }; 01596 01597 01598 typedef XalanAutoPtr<XalanNumberFormat> XalanNumberFormatAutoPtr; 01599 01606 virtual XalanNumberFormatAutoPtr 01607 createXalanNumberFormat() = 0; 01608 01609 01610 // Trace interface... 01611 01617 virtual size_type 01618 getTraceListeners() const = 0; 01619 01625 virtual void 01626 fireGenerateEvent(const GenerateEvent& ge) = 0; 01627 01633 virtual void 01634 fireTraceEvent(const TracerEvent& te) = 0; 01635 01641 virtual void 01642 fireSelectEvent(const SelectionEvent& se) = 0; 01643 01649 virtual bool 01650 getTraceSelects() const = 0; 01651 01659 virtual void 01660 traceSelect( 01661 const ElemTemplateElement& theStylesheetElement, 01662 const NodeRefListBase& nl, 01663 const XPath* xpath) = 0; 01664 01665 enum eCaseOrder { eDefault, eLowerFirst, eUpperFirst }; 01666 01676 virtual int 01677 collationCompare( 01678 const XalanDOMString& theLHS, 01679 const XalanDOMString& theRHS, 01680 eCaseOrder theCaseOrder = eDefault) = 0; 01681 01692 virtual int 01693 collationCompare( 01694 const XalanDOMString& theLHS, 01695 const XalanDOMString& theRHS, 01696 const XalanDOMString& theLocale, 01697 eCaseOrder theCaseOrder = eDefault) = 0; 01698 01708 virtual int 01709 collationCompare( 01710 const XalanDOMChar* theLHS, 01711 const XalanDOMChar* theRHS, 01712 eCaseOrder theCaseOrder = eDefault) = 0; 01713 01724 virtual int 01725 collationCompare( 01726 const XalanDOMChar* theLHS, 01727 const XalanDOMChar* theRHS, 01728 const XalanDOMChar* theLocale, 01729 eCaseOrder theCaseOrder = eDefault) = 0; 01730 01737 virtual bool 01738 getInConstruction(const KeyDeclaration& keyDeclaration) const = 0; 01739 01745 virtual void 01746 beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 01747 01753 virtual void 01754 endConstruction(const KeyDeclaration& keyDeclaration) = 0; 01755 01762 virtual PrintWriter* 01763 createPrintWriter(XalanOutputStream* theTextOutputStream) = 0; 01764 01773 virtual PrintWriter* 01774 createPrintWriter( 01775 const XalanDOMString& theFileName, 01776 const XalanDOMString& theEncoding) = 0; 01777 01784 virtual PrintWriter* 01785 createPrintWriter(StreamType& theStream) = 0; 01786 01793 virtual CountersTable& 01794 getCountersTable() = 0; 01795 01801 virtual void 01802 characters(const XalanNode& node) = 0; 01803 01809 virtual void 01810 characters(const XObjectPtr& xobject) = 0; 01811 01818 virtual void 01819 charactersRaw(const XalanNode& node) = 0; 01820 01826 virtual void 01827 charactersRaw(const XObjectPtr& xobject) = 0; 01828 01829 01830 // These interfaces are inherited from XPathExecutionContext... 01831 01832 virtual void 01833 reset() = 0; 01834 01835 virtual XalanNode* 01836 getCurrentNode() const = 0; 01837 01838 virtual void 01839 setCurrentNode(XalanNode* theCurrentNode) = 0; 01840 01841 virtual bool 01842 isNodeAfter( 01843 const XalanNode& node1, 01844 const XalanNode& node2) const = 0; 01845 01846 virtual const NodeRefListBase& 01847 getContextNodeList() const = 0; 01848 01849 virtual void 01850 setContextNodeList(const NodeRefListBase& theList) = 0; 01851 01852 virtual size_type 01853 getContextNodeListLength() const = 0; 01854 01855 virtual size_type 01856 getContextNodeListPosition(const XalanNode& contextNode) const = 0; 01857 01865 virtual bool 01866 elementAvailable(const XalanQName& theQName) const = 0; 01867 01877 virtual bool 01878 elementAvailable( 01879 const XalanDOMString& theName, 01880 const LocatorType* locator) const = 0; 01881 01889 virtual bool 01890 functionAvailable(const XalanQName& theQName) const = 0; 01891 01900 virtual bool 01901 functionAvailable( 01902 const XalanDOMString& theName, 01903 const LocatorType* locator) const = 0; 01904 01905 virtual const XObjectPtr 01906 extFunction( 01907 const XalanDOMString& theNamespace, 01908 const XalanDOMString& functionName, 01909 XalanNode* context, 01910 const XObjectArgVectorType& argVec, 01911 const LocatorType* locator) = 0; 01912 01913 virtual XalanDocument* 01914 parseXML( 01915 const XalanDOMString& urlString, 01916 const XalanDOMString& base) const = 0; 01917 01918 virtual MutableNodeRefList* 01919 borrowMutableNodeRefList() = 0; 01920 01921 virtual bool 01922 returnMutableNodeRefList(MutableNodeRefList* theList) = 0; 01923 01924 virtual MutableNodeRefList* 01925 createMutableNodeRefList() const = 0; 01926 01927 virtual XalanDOMString& 01928 getCachedString() = 0; 01929 01930 virtual bool 01931 releaseCachedString(XalanDOMString& theString) = 0; 01932 01933 virtual void 01934 getNodeSetByKey( 01935 XalanDocument* doc, 01936 const XalanQName& qname, 01937 const XalanDOMString& ref, 01938 MutableNodeRefList& nodelist) = 0; 01939 01940 virtual void 01941 getNodeSetByKey( 01942 XalanDocument* doc, 01943 const XalanDOMString& name, 01944 const XalanDOMString& ref, 01945 const LocatorType* locator, 01946 MutableNodeRefList& nodelist) = 0; 01947 01948 virtual const XObjectPtr 01949 getVariable( 01950 const XalanQName& name, 01951 const LocatorType* locator = 0) = 0; 01952 01953 virtual const PrefixResolver* 01954 getPrefixResolver() const = 0; 01955 01956 virtual void 01957 setPrefixResolver(const PrefixResolver* thePrefixResolver) = 0; 01958 01959 virtual const XalanDOMString* 01960 getNamespaceForPrefix(const XalanDOMString& prefix) const = 0; 01961 01962 virtual XalanDOMString 01963 findURIFromDoc(const XalanDocument* owner) const = 0; 01964 01965 virtual const XalanDOMString& 01966 getUnparsedEntityURI( 01967 const XalanDOMString& theName, 01968 const XalanDocument& theDocument) const = 0; 01969 01970 virtual bool 01971 shouldStripSourceNode(const XalanNode& node) = 0; 01972 01973 virtual bool 01974 getThrowFoundIndex() const = 0; 01975 01976 virtual void 01977 setThrowFoundIndex(bool fThrow) = 0; 01978 01979 virtual XalanDocument* 01980 getSourceDocument(const XalanDOMString& theURI) const = 0; 01981 01982 virtual void 01983 setSourceDocument( 01984 const XalanDOMString& theURI, 01985 XalanDocument* theDocument) = 0; 01986 01987 01988 virtual const XalanDecimalFormatSymbols* 01989 getDecimalFormatSymbols(const XalanQName& qname) = 0; 01990 01991 // These interfaces are inherited from ExecutionContext... 01992 01993 virtual void 01994 error( 01995 const XalanDOMString& msg, 01996 const XalanNode* sourceNode, 01997 const LocatorType* locator) const = 0; 01998 01999 virtual void 02000 error( 02001 const char* msg, 02002 const XalanNode* sourceNode, 02003 const LocatorType* locator) const = 0; 02004 02005 virtual void 02006 warn( 02007 const XalanDOMString& msg, 02008 const XalanNode* sourceNode = 0, 02009 const LocatorType* locator = 0) const = 0; 02010 02011 virtual void 02012 warn( 02013 const char* msg, 02014 const XalanNode* sourceNode = 0, 02015 const LocatorType* locator = 0) const = 0; 02016 02017 virtual void 02018 message( 02019 const XalanDOMString& msg, 02020 const XalanNode* sourceNode = 0, 02021 const LocatorType* locator = 0) const = 0; 02022 02023 virtual void 02024 message( 02025 const char* msg, 02026 const XalanNode* sourceNode = 0, 02027 const LocatorType* locator = 0) const = 0; 02028 }; 02029 02030 02031 02032 XALAN_CPP_NAMESPACE_END 02033 02034 02035 02036 #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.5 |
|