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/Include/XalanMap.hpp> 00031 #include <xalanc/Include/STLHelper.hpp> 00032 00033 00034 00035 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00036 00037 00038 00039 #include <xalanc/PlatformSupport/FormatterListener.hpp> 00040 00041 00042 00043 XALAN_CPP_NAMESPACE_BEGIN 00044 00045 00046 00047 class ElemAttributeSet; 00048 class StylesheetConstructionContext; 00049 class XalanText; 00050 class XSLTResultTarget; 00051 00052 00053 typedef XalanVector<ElemAttributeSet*> AttributeSetVectorTypeDecl; 00054 XALAN_USES_MEMORY_MANAGER(AttributeSetVectorTypeDecl) 00055 00061 class XALAN_XSLT_EXPORT StylesheetRoot : public Stylesheet 00062 { 00063 public: 00064 00065 typedef XalanVector<const XalanQName*> XalanQNameVectorType; 00066 00067 typedef AttributeSetVectorTypeDecl AttributeSetVectorType; 00068 00069 typedef XalanMap<const XalanQName*, 00070 AttributeSetVectorType> AttributeSetMapType; 00071 00078 StylesheetRoot( 00079 const XalanDOMString& baseIdentifier, 00080 StylesheetConstructionContext& constructionContext); 00081 00082 virtual 00083 ~StylesheetRoot(); 00084 00085 static StylesheetRoot* 00086 create( 00087 MemoryManagerType& theManager, 00088 const XalanDOMString& baseIdentifier, 00089 StylesheetConstructionContext& constructionContext); 00090 00091 MemoryManagerType& 00092 getMemoryManager() 00093 { 00094 return m_version.getMemoryManager(); 00095 } 00099 virtual void 00100 postConstruction(StylesheetConstructionContext& constructionContext); 00101 00109 void 00110 process( 00111 XalanNode* sourceTree, 00112 XSLTResultTarget& outputTarget, 00113 StylesheetExecutionContext& executionContext) const; 00114 00127 FormatterListener* 00128 setupFormatterListener( 00129 XSLTResultTarget& outputTarget, 00130 StylesheetExecutionContext& executionContext) const; 00131 00138 FormatterListener::eFormat 00139 getOutputMethod() const 00140 { 00141 return m_outputMethod; 00142 } 00143 00144 bool 00145 isOutputMethodSet() const 00146 { 00147 return getOutputMethod() == FormatterListener::OUTPUT_METHOD_NONE ? false : true; 00148 } 00149 00156 XalanDOMString& 00157 getOutputVersion(XalanDOMString& theResult) const 00158 { 00159 theResult.assign(m_version); 00160 00161 return theResult; 00162 } 00163 00170 bool 00171 getOutputIndent() const 00172 { 00173 return m_indentResult == eIndentNoImplicit || 00174 m_indentResult == eIndentNoExplicit ? false : true; 00175 } 00176 00185 bool 00186 getHTMLOutputIndent() const 00187 { 00188 return m_indentResult == eIndentNoExplicit ? false : true; 00189 } 00190 00197 XalanDOMString& 00198 getOutputEncoding(XalanDOMString& theResult) const 00199 { 00200 theResult.assign(m_encoding); 00201 00202 return theResult; 00203 } 00204 00211 XalanDOMString& 00212 getOutputMediaType(XalanDOMString& theResult) const 00213 { 00214 theResult.assign(m_mediatype); 00215 00216 return theResult; 00217 } 00218 00225 XalanDOMString & 00226 getOutputDoctypeSystem(XalanDOMString& theResult) const 00227 { 00228 theResult.assign(m_doctypeSystem); 00229 00230 return theResult; 00231 } 00232 00239 XalanDOMString& 00240 getOutputDoctypePublic(XalanDOMString& theResult) const 00241 { 00242 theResult.assign(m_doctypePublic); 00243 00244 return theResult; 00245 } 00246 00252 bool 00253 getOmitOutputXMLDecl() const 00254 { 00255 return m_omitxmlDecl; 00256 } 00257 00264 XalanDOMString& 00265 getOutputStandalone(XalanDOMString& theResult) const 00266 { 00267 theResult.assign(m_standalone); 00268 00269 return theResult; 00270 } 00271 00277 ElemTemplateElement* 00278 getDefaultTextRule() const 00279 { 00280 return m_defaultTextRule; 00281 } 00282 00288 ElemTemplateElement* 00289 getDefaultRule() const 00290 { 00291 return m_defaultRule; 00292 } 00293 00299 ElemTemplateElement* 00300 getDefaultRootRule() const 00301 { 00302 return m_defaultRootRule; 00303 } 00304 00312 void 00313 processOutputSpec( 00314 const XalanDOMChar* name, 00315 const AttributeListType& atts, 00316 StylesheetConstructionContext& constructionContext); 00317 00323 URLStackType& 00324 getImportStack() 00325 { 00326 return m_importStack; 00327 } 00328 00334 const URLStackType& 00335 getImportStack() const 00336 { 00337 return m_importStack; 00338 } 00339 00345 void 00346 setIndentResult(bool bIndent) 00347 { 00348 m_indentResult = bIndent == true ? eIndentYesExplicit : eIndentNoExplicit; 00349 } 00350 00357 void 00358 setOutputMethod(FormatterListener::eFormat meth) 00359 { 00360 m_outputMethod = meth; 00361 } 00362 00363 bool 00364 hasCDATASectionElements() const 00365 { 00366 assert(m_hasCDATASectionElems == false && m_cdataSectionElems.empty() == true || 00367 m_hasCDATASectionElems == true && m_cdataSectionElems.empty() == false); 00368 00369 return m_hasCDATASectionElems; 00370 } 00371 00379 bool 00380 isCDATASectionElementName(const XalanQName& theQName) const; 00381 00394 void 00395 getNodeSetByKey( 00396 XalanDocument* doc, 00397 const XalanQName& qname, 00398 const XalanDOMString& ref, 00399 const PrefixResolver& resolver, 00400 MutableNodeRefList& nodelist, 00401 StylesheetExecutionContext& executionContext, 00402 KeyTablesTableType& theKeysTable) const; 00403 00404 unsigned long 00405 getNextElemNumberID() 00406 { 00407 return m_elemNumberNextID++; 00408 } 00409 00410 unsigned long 00411 getElemNumberCount() const 00412 { 00413 return m_elemNumberNextID; 00414 } 00415 00416 bool 00417 hasPreserveOrStripSpaceElements() const 00418 { 00419 return m_whitespaceElements.empty() == false; 00420 } 00421 00422 bool 00423 shouldStripSourceNode(const XalanText& textNode) const; 00424 00425 void 00426 addAttributeSet(ElemAttributeSet& theAttributeSet); 00427 00428 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) 00429 00438 const ElemAttributeSet* 00439 getAttributeSet( 00440 StylesheetExecutionContext& theExecutionContext, 00441 const XalanQName& theQName, 00442 size_type matchingIndex, 00443 const LocatorType* theLocator) const; 00444 #else 00445 void 00446 executeAttributeSet( 00447 StylesheetExecutionContext& theExecutionContext, 00448 const XalanQName& theQName, 00449 const LocatorType* theLocator) const; 00450 #endif 00451 00452 00453 private: 00454 00462 const XalanDOMString& 00463 getEncoding(const XSLTResultTarget& outputTarget) const; 00464 00470 void 00471 initDefaultRule(StylesheetConstructionContext& constructionContext); 00472 00477 XalanDOMString m_version; 00478 00479 enum eIndentType { eIndentNoImplicit, eIndentNoExplicit, eIndentYesImplicit, eIndentYesExplicit }; 00480 00485 eIndentType m_indentResult; 00486 00491 XalanDOMString m_encoding; 00492 00497 XalanDOMString m_mediatype; 00498 00504 XalanDOMString m_doctypeSystem; 00505 00514 XalanDOMString m_doctypePublic; 00515 00519 bool m_omitxmlDecl; 00520 00524 XalanDOMString m_standalone; 00525 00530 XalanDOMString m_resultNameSpaceURL; 00531 00535 FormatterListener::eFormat m_outputMethod; 00536 00541 XalanQNameVectorType m_cdataSectionElems; 00542 00543 bool m_hasCDATASectionElems; 00544 00549 URLStackType m_importStack; 00550 00551 00556 ElemTemplateElement* m_defaultTextRule; 00557 00562 ElemTemplateElement* m_defaultRule; 00563 00568 ElemTemplateElement* m_defaultRootRule; 00569 00573 bool m_needToBuildKeysTable; 00574 00578 bool m_outputEscapeURLs; 00579 00583 int m_indentAmount; 00584 00588 bool m_omitMETATag; 00589 00593 unsigned long m_elemNumberNextID; 00594 00598 AttributeSetMapType m_attributeSetsMap; 00599 00600 00601 // Not implemented... 00602 StylesheetRoot(const StylesheetRoot&); 00603 00604 StylesheetRoot& 00605 operator=(const StylesheetRoot&); 00606 00607 bool 00608 operator==(const StylesheetRoot&) const; 00609 }; 00610 00611 00612 00613 XALAN_CPP_NAMESPACE_END 00614 00615 00616 00617 #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.10 |
|