00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALAN_STYLESHEETROOT_HEADER_GUARD) 00017 #define XALAN_STYLESHEETROOT_HEADER_GUARD 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include "XSLTDefinitions.hpp" 00023 00024 00025 00026 #include "Stylesheet.hpp" 00027 00028 00029 00030 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00031 00032 00033 00034 #include <xalanc/PlatformSupport/FormatterListener.hpp> 00035 00036 00037 00038 XALAN_CPP_NAMESPACE_BEGIN 00039 00040 00041 00042 class ElemAttributeSet; 00043 class StylesheetConstructionContext; 00044 class XalanText; 00045 class XSLTResultTarget; 00046 00047 00048 00054 class XALAN_XSLT_EXPORT StylesheetRoot : public Stylesheet 00055 { 00056 public: 00057 00058 #if defined(XALAN_NO_STD_NAMESPACE) 00059 typedef vector<const XalanQName*> XalanQNameVectorType; 00060 typedef vector<ElemAttributeSet*> AttributeSetVectorType; 00061 typedef map<const XalanQName*, 00062 AttributeSetVectorType, 00063 pointer_less<const XalanQName> > AttributeSetMapType; 00064 #else 00065 typedef std::vector<const XalanQName*> XalanQNameVectorType; 00066 typedef std::vector<ElemAttributeSet*> AttributeSetVectorType; 00067 typedef std::map<const XalanQName*, 00068 AttributeSetVectorType, 00069 pointer_less<const XalanQName> > AttributeSetMapType; 00070 #endif 00071 00078 StylesheetRoot( 00079 const XalanDOMString& baseIdentifier, 00080 StylesheetConstructionContext& constructionContext); 00081 00082 virtual 00083 ~StylesheetRoot(); 00084 00088 virtual void 00089 postConstruction(StylesheetConstructionContext& constructionContext); 00090 00098 void 00099 process( 00100 XalanNode* sourceTree, 00101 XSLTResultTarget& outputTarget, 00102 StylesheetExecutionContext& executionContext) const; 00103 00116 FormatterListener* 00117 setupFormatterListener( 00118 XSLTResultTarget& outputTarget, 00119 StylesheetExecutionContext& executionContext) const; 00120 00127 FormatterListener::eFormat 00128 getOutputMethod() const 00129 { 00130 return m_outputMethod; 00131 } 00132 00133 bool 00134 isOutputMethodSet() const 00135 { 00136 return getOutputMethod() == FormatterListener::OUTPUT_METHOD_NONE ? false : true; 00137 } 00138 00145 XalanDOMString 00146 getOutputVersion() const 00147 { 00148 return m_version; 00149 } 00150 00157 bool 00158 getOutputIndent() const 00159 { 00160 return m_indentResult; 00161 } 00162 00169 XalanDOMString 00170 getOutputEncoding() const 00171 { 00172 return m_encoding; 00173 } 00174 00181 XalanDOMString 00182 getOutputMediaType() const 00183 { 00184 return m_mediatype; 00185 } 00186 00193 XalanDOMString 00194 getOutputDoctypeSystem() const 00195 { 00196 return m_doctypeSystem; 00197 } 00198 00205 XalanDOMString 00206 getOutputDoctypePublic() const 00207 { 00208 return m_doctypePublic; 00209 } 00210 00216 bool 00217 getOmitOutputXMLDecl() const 00218 { 00219 return m_omitxmlDecl; 00220 } 00221 00228 XalanDOMString 00229 getOutputStandalone() const 00230 { 00231 return m_standalone; 00232 } 00233 00239 ElemTemplateElement* 00240 getDefaultTextRule() const 00241 { 00242 return m_defaultTextRule; 00243 } 00244 00250 ElemTemplateElement* 00251 getDefaultRule() const 00252 { 00253 return m_defaultRule; 00254 } 00255 00261 ElemTemplateElement* 00262 getDefaultRootRule() const 00263 { 00264 return m_defaultRootRule; 00265 } 00266 00274 void 00275 processOutputSpec( 00276 const XalanDOMChar* name, 00277 const AttributeListType& atts, 00278 StylesheetConstructionContext& constructionContext); 00279 00285 URLStackType& 00286 getImportStack() 00287 { 00288 return m_importStack; 00289 } 00290 00296 const URLStackType& 00297 getImportStack() const 00298 { 00299 return m_importStack; 00300 } 00301 00307 void 00308 setIndentResult(bool bIndent) 00309 { 00310 m_indentResult = bIndent; 00311 } 00312 00319 void 00320 setOutputMethod(FormatterListener::eFormat meth) 00321 { 00322 m_outputMethod = meth; 00323 } 00324 00325 bool 00326 hasCDATASectionElements() const 00327 { 00328 assert(m_hasCDATASectionElems == false && m_cdataSectionElems.empty() == true || 00329 m_hasCDATASectionElems == true && m_cdataSectionElems.empty() == false); 00330 00331 return m_hasCDATASectionElems; 00332 } 00333 00341 bool 00342 isCDATASectionElementName(const XalanQName& theQName) const; 00343 00356 void 00357 getNodeSetByKey( 00358 XalanDocument* doc, 00359 const XalanQName& qname, 00360 const XalanDOMString& ref, 00361 const PrefixResolver& resolver, 00362 MutableNodeRefList& nodelist, 00363 StylesheetExecutionContext& executionContext, 00364 KeyTablesTableType& theKeysTable) const; 00365 00366 unsigned long 00367 getNextElemNumberID() 00368 { 00369 return m_elemNumberNextID++; 00370 } 00371 00372 unsigned long 00373 getElemNumberCount() const 00374 { 00375 return m_elemNumberNextID; 00376 } 00377 00378 bool 00379 hasPreserveOrStripSpaceElements() const 00380 { 00381 return m_whitespaceElements.empty() == false; 00382 } 00383 00384 bool 00385 shouldStripSourceNode(const XalanText& textNode) const; 00386 00387 void 00388 addAttributeSet(ElemAttributeSet& theAttributeSet); 00389 00390 void 00391 executeAttributeSet( 00392 StylesheetExecutionContext& theExecutionContext, 00393 const XalanQName& theQName, 00394 const LocatorType* theLocator) const; 00395 00396 private: 00397 00405 const XalanDOMString& 00406 getEncoding(const XSLTResultTarget& outputTarget) const; 00407 00413 void 00414 initDefaultRule(StylesheetConstructionContext& constructionContext); 00415 00420 XalanDOMString m_version; 00421 00426 bool m_indentResult; 00427 00432 XalanDOMString m_encoding; 00433 00438 XalanDOMString m_mediatype; 00439 00445 XalanDOMString m_doctypeSystem; 00446 00455 XalanDOMString m_doctypePublic; 00456 00460 bool m_omitxmlDecl; 00461 00465 XalanDOMString m_standalone; 00466 00471 XalanDOMString m_resultNameSpaceURL; 00472 00476 FormatterListener::eFormat m_outputMethod; 00477 00482 XalanQNameVectorType m_cdataSectionElems; 00483 00484 bool m_hasCDATASectionElems; 00485 00490 URLStackType m_importStack; 00491 00492 00497 ElemTemplateElement* m_defaultTextRule; 00498 00503 ElemTemplateElement* m_defaultRule; 00504 00509 ElemTemplateElement* m_defaultRootRule; 00510 00514 bool m_needToBuildKeysTable; 00515 00519 bool m_outputEscapeURLs; 00520 00524 int m_indentAmount; 00525 00529 bool m_omitMETATag; 00530 00534 unsigned long m_elemNumberNextID; 00535 00539 AttributeSetMapType m_attributeSetsMap; 00540 00541 00542 // Not implemented... 00543 StylesheetRoot(const StylesheetRoot&); 00544 00545 StylesheetRoot& 00546 operator=(const StylesheetRoot&); 00547 00548 bool 00549 operator==(const StylesheetRoot&) const; 00550 }; 00551 00552 00553 00554 XALAN_CPP_NAMESPACE_END 00555 00556 00557 00558 #endif // XALAN_STYLESHEETROOT_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.8 |
|