Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.7

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

StylesheetRoot.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 1999-2004 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 #if !defined(XALAN_STYLESHEETROOT_HEADER_GUARD)
00058 #define XALAN_STYLESHEETROOT_HEADER_GUARD 
00059 
00060 
00061 
00062 // Base include file.  Must be first.
00063 #include "XSLTDefinitions.hpp"
00064 
00065 
00066 
00067 #include "Stylesheet.hpp"
00068 
00069 
00070 
00071 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00072 
00073 
00074 
00075 #include <xalanc/PlatformSupport/FormatterListener.hpp>
00076 
00077 
00078 
00079 XALAN_CPP_NAMESPACE_BEGIN
00080 
00081 
00082 
00083 class ElemAttributeSet;
00084 class StylesheetConstructionContext;
00085 class XalanText;
00086 class XSLTResultTarget;
00087 
00088 
00089 
00095 class XALAN_XSLT_EXPORT StylesheetRoot : public Stylesheet
00096 {
00097 public:
00098 
00099 #if defined(XALAN_NO_STD_NAMESPACE)
00100     typedef vector<const XalanQName*>       XalanQNameVectorType;
00101     typedef vector<const XPath*>            XPathVectorType;
00102     typedef vector<ElemAttributeSet*>       AttributeSetVectorType;
00103     typedef map<const XalanQName*,
00104                 AttributeSetVectorType,
00105                 pointer_less<const XalanQName> >    AttributeSetMapType;
00106 #else
00107     typedef std::vector<const XalanQName*>  XalanQNameVectorType;
00108     typedef std::vector<const XPath*>       XPathVectorType;
00109     typedef std::vector<ElemAttributeSet*>  AttributeSetVectorType;
00110     typedef std::map<const XalanQName*,
00111                      AttributeSetVectorType,
00112                      pointer_less<const XalanQName> >   AttributeSetMapType;
00113 #endif
00114 
00121     StylesheetRoot(
00122         const XalanDOMString&           baseIdentifier,
00123         StylesheetConstructionContext&  constructionContext);    
00124 
00125     virtual 
00126     ~StylesheetRoot();
00127 
00131     virtual void
00132     postConstruction(StylesheetConstructionContext&     constructionContext);
00133 
00141     void
00142     process(
00143             XalanNode*                      sourceTree,
00144             XSLTResultTarget&               outputTarget,
00145             StylesheetExecutionContext&     executionContext) const;
00146 
00159     FormatterListener*
00160     setupFormatterListener(
00161             XSLTResultTarget&               outputTarget,
00162             StylesheetExecutionContext&     executionContext) const;
00163 
00170     FormatterListener::eFormat
00171     getOutputMethod() const
00172     {
00173         return m_outputMethod;
00174     }
00175 
00176     bool
00177     isOutputMethodSet() const
00178     {
00179         return getOutputMethod() == FormatterListener::OUTPUT_METHOD_NONE ? false : true;
00180     }
00181 
00188     XalanDOMString
00189     getOutputVersion() const
00190     { 
00191         return m_version;
00192     }
00193 
00200     bool 
00201     getOutputIndent() const
00202     {
00203         return m_indentResult;
00204     }
00205 
00212     XalanDOMString 
00213     getOutputEncoding() const
00214     {
00215         return m_encoding;
00216     }
00217 
00224     XalanDOMString 
00225     getOutputMediaType() const
00226     {
00227         return m_mediatype;
00228     }
00229 
00236     XalanDOMString 
00237     getOutputDoctypeSystem() const
00238     {
00239         return m_doctypeSystem;
00240     }
00241 
00248     XalanDOMString 
00249     getOutputDoctypePublic() const
00250     {
00251         return m_doctypePublic;
00252     }
00253 
00259     bool
00260     getOmitOutputXMLDecl() const
00261     {
00262         return m_omitxmlDecl;
00263     }
00264 
00271     XalanDOMString
00272     getOutputStandalone() const
00273     {
00274         return m_standalone;
00275     }
00276 
00282     ElemTemplateElement*
00283     getDefaultTextRule() const
00284     {
00285         return m_defaultTextRule;
00286     }
00287 
00293     ElemTemplateElement*
00294     getDefaultRule() const
00295     {
00296         return m_defaultRule;
00297     }
00298 
00304     ElemTemplateElement*
00305     getDefaultRootRule() const
00306     {
00307         return m_defaultRootRule;
00308     }
00309 
00317     void 
00318     processOutputSpec(
00319             const XalanDOMChar*             name, 
00320             const AttributeListType&        atts,
00321             StylesheetConstructionContext&  constructionContext);
00322 
00328     URLStackType&
00329     getImportStack()
00330     {
00331         return m_importStack;
00332     }
00333 
00339     const URLStackType&
00340     getImportStack() const
00341     {
00342         return m_importStack;
00343     }
00344 
00350     void
00351     setIndentResult(bool bIndent)
00352     {
00353         m_indentResult = bIndent;
00354     }
00355 
00362     void
00363     setOutputMethod(FormatterListener::eFormat  meth)
00364     {
00365         m_outputMethod = meth;
00366     }
00367 
00368     bool
00369     hasCDATASectionElements() const
00370     {
00371         assert(m_hasCDATASectionElems == false && m_cdataSectionElems.empty() == true ||
00372                m_hasCDATASectionElems == true && m_cdataSectionElems.empty() == false);
00373 
00374         return m_hasCDATASectionElems;
00375     }
00376 
00384     bool
00385     isCDATASectionElementName(const XalanQName&     theQName) const;
00386 
00399     void
00400     getNodeSetByKey(
00401             XalanDocument*                  doc,
00402             const XalanQName&               qname,
00403             const XalanDOMString&           ref,
00404             const PrefixResolver&           resolver,
00405             MutableNodeRefList&             nodelist,
00406             StylesheetExecutionContext&     executionContext,
00407             KeyTablesTableType&             theKeysTable) const;
00408 
00409     unsigned long
00410     getNextElemNumberID()
00411     {
00412         return m_elemNumberNextID++;
00413     }
00414 
00415     unsigned long
00416     getElemNumberCount() const
00417     {
00418         return m_elemNumberNextID;
00419     }
00420 
00421     bool
00422     hasPreserveOrStripSpaceElements() const
00423     {
00424         return m_whitespacePreservingElements.empty() == false ||
00425                m_whitespaceStrippingElements.empty() == false;
00426     }
00427 
00428     void
00429     pushWhitespacePreservingElement(const XPath*    theXPath)
00430     {
00431         m_whitespacePreservingElements.push_back(theXPath);
00432     }
00433 
00434     void
00435     pushWhitespaceStrippingElement(const XPath*     theXPath)
00436     {
00437         m_whitespaceStrippingElements.push_back(theXPath);
00438     }
00439 
00440     bool
00441     shouldStripSourceNode(
00442             StylesheetExecutionContext&     executionContext,
00443             const XalanText&                textNode) const;
00444 
00445     void
00446     addAttributeSet(ElemAttributeSet&   theAttributeSet);
00447 
00448     void
00449     executeAttributeSet(
00450             StylesheetExecutionContext&     theExecutionContext,
00451             const XalanQName&               theQName,
00452             const LocatorType*              theLocator) const;
00453 
00454 private:
00455 
00463     const XalanDOMString&
00464     getEncoding(const XSLTResultTarget&     outputTarget) const;
00465 
00471     void 
00472     initDefaultRule(StylesheetConstructionContext&  constructionContext);
00473 
00478     XalanDOMString  m_version;
00479 
00484     bool            m_indentResult;
00485 
00490     XalanDOMString  m_encoding;
00491 
00496     XalanDOMString  m_mediatype;
00497 
00503     XalanDOMString  m_doctypeSystem;
00504 
00513     XalanDOMString  m_doctypePublic;
00514 
00518     bool            m_omitxmlDecl;
00519 
00523     XalanDOMString  m_standalone;
00524 
00529     XalanDOMString              m_resultNameSpaceURL;
00530 
00534     FormatterListener::eFormat  m_outputMethod;
00535 
00540     XalanQNameVectorType        m_cdataSectionElems;
00541 
00542     bool                        m_hasCDATASectionElems;
00543 
00548     URLStackType                m_importStack;
00549 
00550 
00555     ElemTemplateElement*        m_defaultTextRule;
00556 
00561     ElemTemplateElement*        m_defaultRule;
00562 
00567     ElemTemplateElement*        m_defaultRootRule;
00568 
00572     bool                        m_needToBuildKeysTable;
00573 
00577     bool                        m_outputEscapeURLs;
00578 
00582     int                         m_indentAmount;
00583 
00587     bool                        m_omitMETATag;
00588 
00592     unsigned long               m_elemNumberNextID;
00593 
00597     XPathVectorType             m_whitespacePreservingElements;
00598   
00602     XPathVectorType             m_whitespaceStrippingElements;
00603 
00607     AttributeSetMapType         m_attributeSetsMap;
00608 
00609 
00610     // Not implemented...
00611     StylesheetRoot(const StylesheetRoot&);
00612 
00613     StylesheetRoot&
00614     operator=(const StylesheetRoot&);
00615 
00616     bool
00617     operator==(const StylesheetRoot&) const;
00618 };
00619 
00620 
00621 
00622 XALAN_CPP_NAMESPACE_END
00623 
00624 
00625 
00626 #endif  // XALAN_STYLESHEETROOT_HEADER_GUARD

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.7
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.