00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 2000 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 * $ Id: $ 00058 * 00059 */ 00060 00061 #if !defined(XALAN_NAMESPACESHANDLER_HEADER_GUARD) 00062 #define XALAN_NAMESPACESHANDLER_HEADER_GUARD 00063 00064 00065 00066 // Base include file. Must be first. 00067 #include <XSLT/XSLTDefinitions.hpp> 00068 00069 00070 00071 #include <map> 00072 #include <set> 00073 #include <vector> 00074 00075 00076 00077 #include <XalanDOM/XalanDOMString.hpp> 00078 00079 00080 00081 #include <XPath/NameSpace.hpp> 00082 00083 00084 00085 class StylesheetConstructionContext; 00086 class StylesheetExecutionContext; 00087 00088 00089 00090 class XALAN_XSLT_EXPORT NamespacesHandler 00091 { 00092 public: 00093 00097 static void 00098 initialize(); 00099 00103 static void 00104 terminate(); 00105 00106 00107 /* Some static strings for various namespace URIs... 00108 * 00109 */ 00110 static const XalanDOMString& s_ApacheXSLTNamespaceURI; 00111 00112 static const XalanDOMString& s_LotusXSLTNamespaceURI; 00113 00114 static const XalanDOMString& s_LotusXSLTNamespaceURIWithSeparator; 00115 00116 00117 class NameSpaceExtended : public NameSpace 00118 { 00119 public: 00120 00121 NameSpaceExtended( 00122 const XalanDOMString& prefix = XalanDOMString(), 00123 const XalanDOMString& uri = XalanDOMString()) : 00124 NameSpace(prefix, uri), 00125 m_resultAttributeName() 00126 { 00127 } 00128 00129 NameSpaceExtended(const NameSpace& theNamespace) : 00130 NameSpace(theNamespace), 00131 m_resultAttributeName() 00132 { 00133 } 00134 00140 const XalanDOMString& 00141 getResultAttributeName() const 00142 { 00143 return m_resultAttributeName; 00144 } 00145 00151 void 00152 setResultAttributeName(const XalanDOMString& name) 00153 { 00154 m_resultAttributeName = name; 00155 } 00156 00157 private: 00158 00159 XalanDOMString m_resultAttributeName; 00160 }; 00161 00162 #if defined(XALAN_NO_NAMESPACES) 00163 typedef map<XalanDOMString, 00164 XalanDOMString, 00165 less<XalanDOMString> > ExcludedResultPrefixesMapType; 00166 00167 typedef map<XalanDOMString, 00168 NameSpaceExtended, 00169 less<XalanDOMString> > NamespacesMapType; 00170 00171 typedef map<XalanDOMString, 00172 XalanDOMString, 00173 less<XalanDOMString> > NamespaceAliasesMapType; 00174 00175 typedef vector<NameSpace> NamespaceVectorType; 00176 typedef vector<NamespaceVectorType> NamespacesStackType; 00177 00178 typedef set<XalanDOMString, 00179 less<XalanDOMString> > ExtensionNamespaceURISetType; 00180 #else 00181 typedef std::map<XalanDOMString, XalanDOMString> ExcludedResultPrefixesMapType; 00182 00183 typedef std::map<XalanDOMString, 00184 NameSpaceExtended> NamespacesMapType; 00185 00186 typedef std::map<XalanDOMString, XalanDOMString> NamespaceAliasesMapType; 00187 00188 typedef std::vector<NameSpace> NamespaceVectorType; 00189 typedef std::vector<NamespaceVectorType> NamespacesStackType; 00190 00191 typedef std::set<XalanDOMString> ExtensionNamespaceURISetType; 00192 #endif 00193 00197 explicit 00198 NamespacesHandler(); 00199 00208 NamespacesHandler( 00209 const NamespacesHandler& stylesheetNamespacesHandler, 00210 const NamespacesStackType& theCurrentNamespaces, 00211 const XalanDOMString& theXSLTNamespaceURI); 00212 00213 NamespacesHandler(const NamespacesHandler& theSource); 00214 00215 ~NamespacesHandler(); 00216 00224 void 00225 processExcludeResultPrefixes( 00226 const XalanDOMChar* theValue, 00227 const NamespacesStackType& theCurrentNamespaces, 00228 StylesheetConstructionContext& theConstructionContext); 00229 00237 void 00238 processExtensionElementPrefixes( 00239 const XalanDOMChar* theValue, 00240 const NamespacesStackType& theCurrentNamespaces, 00241 StylesheetConstructionContext& theConstructionContext); 00242 00249 void 00250 postConstruction( 00251 const XalanDOMString& theElementName = XalanDOMString(), 00252 const NamespacesHandler* parentNamespacesHandler = 0); 00253 00254 NamespacesHandler& 00255 operator=(const NamespacesHandler& theRHS); 00256 00265 bool 00266 shouldExcludeResultNamespaceNode( 00267 const XalanDOMString& theXSLTNamespaceURI, 00268 const XalanDOMString& thePrefix, 00269 const XalanDOMString& theURI) const; 00270 00278 bool 00279 hasExcludedPrefix(const XalanDOMString& thePrefix) const 00280 { 00281 return m_excludedResultPrefixes.count(thePrefix) != 0 ? true : false; 00282 } 00283 00289 void 00290 addExtensionNamespaceURI(const XalanDOMString& theURI) 00291 { 00292 m_extensionNamespaceURIs.insert(theURI); 00293 } 00294 00301 const XalanDOMString& 00302 getNamespace(const XalanDOMString& thePrefix) const; 00303 00310 const XalanDOMString& 00311 getNamespaceAlias(const XalanDOMString& theStylesheetNamespace) const; 00312 00319 void 00320 setNamespaceAlias( 00321 const XalanDOMString& theStylesheetNamespace, 00322 const XalanDOMString& theResultNamespace) 00323 { 00324 m_namespaceAliases[theStylesheetNamespace] = theResultNamespace; 00325 } 00326 00332 void 00333 copyNamespaceAliases(const NamespacesHandler& parentNamespacesHandler); 00334 00340 void 00341 outputResultNamespaces(StylesheetExecutionContext& theExecutionContext) const; 00342 00346 void 00347 clear(); 00348 00354 void 00355 swap(NamespacesHandler& theOther); 00356 00357 private: 00358 00362 void 00363 createResultAttributeNames(); 00364 00370 void 00371 processExcludeResultPrefixes(const XalanDOMString& theElementPrefix); 00372 00376 void 00377 processNamespaceAliases(); 00378 00384 void 00385 copyNamespaceAliases(const NamespaceAliasesMapType& theNamespaceAliases); 00386 00392 void 00393 copyExtensionNamespaceURIs(const ExtensionNamespaceURISetType& theExtensionNamespaceURIs); 00394 00400 void 00401 copyExcludeResultPrefixes(const ExcludedResultPrefixesMapType& theExcludeResultPrefixes); 00402 00412 bool 00413 shouldExcludeResultNamespaceNode( 00414 const XalanDOMString& theXSLTNamespaceURI, 00415 const NamespacesHandler& parentNamespacesHandler, 00416 const NameSpace& theNamespace) const; 00417 00418 // Not implemented... 00419 bool 00420 operator==(const NamespacesHandler&) const; 00421 00422 // Data members... 00423 ExcludedResultPrefixesMapType m_excludedResultPrefixes; 00424 00425 NamespacesMapType m_namespaceDeclarations; 00426 00427 ExtensionNamespaceURISetType m_extensionNamespaceURIs; 00428 00429 NamespaceAliasesMapType m_namespaceAliases; 00430 00431 const static XalanDOMString s_dummyEmptyString; 00432 }; 00433 00434 00435 00436 #endif // XALAN_NAMESPACESHANDLER_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSL Transformer Version 1.0 |
|