## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.5

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-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 #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 <XalanDOM/XalanDOMString.hpp>
    00072
    00073
    00074
    00075 #include <PlatformSupport/FormatterListener.hpp>
    00076
    00077
    00078
    00079 XALAN_CPP_NAMESPACE_BEGIN
    00080
    00081
    00082
    00083 class StylesheetConstructionContext;
    00084 class XalanText;
    00085 class XSLTResultTarget;
    00086
    00087
    00088
    00094 class XALAN_XSLT_EXPORT StylesheetRoot : public Stylesheet
    00095 {
    00096 public:
    00097
    00098 #if defined(XALAN_NO_STD_NAMESPACE)
    00099     typedef vector<const XalanQName*>       XalanQNameVectorType;
    00100     typedef vector<const XPath*>            XPathVectorType;
    00101 #else
    00102     typedef std::vector<const XalanQName*>  XalanQNameVectorType;
    00103     typedef std::vector<const XPath*>       XPathVectorType;
    00104 #endif
    00105
    00112     StylesheetRoot(
    00113         const XalanDOMString&           baseIdentifier,
    00114         StylesheetConstructionContext&  constructionContext);
    00115
    00116     virtual
    00117     ~StylesheetRoot();
    00118
    00122     virtual void
    00123     postConstruction(StylesheetConstructionContext&     constructionContext);
    00124
    00132     void
    00133     process(
    00134             XalanNode*                      sourceTree,
    00135             XSLTResultTarget&               outputTarget,
    00136             StylesheetExecutionContext&     executionContext) const;
    00137
    00150     FormatterListener*
    00151     setupFormatterListener(
    00152             XSLTResultTarget&               outputTarget,
    00153             StylesheetExecutionContext&     executionContext) const;
    00154
    00161     FormatterListener::eFormat
    00162     getOutputMethod() const
    00163     {
    00164         return m_outputMethod;
    00165     }
    00166
    00167     bool
    00168     isOutputMethodSet() const
    00169     {
    00170         return getOutputMethod() == FormatterListener::OUTPUT_METHOD_NONE ? false : true;
    00171     }
    00172
    00179     XalanDOMString
    00180     getOutputVersion() const
    00181     {
    00182         return m_version;
    00183     }
    00184
    00191     bool
    00192     getOutputIndent() const
    00193     {
    00194         return m_indentResult;
    00195     }
    00196
    00203     XalanDOMString
    00204     getOutputEncoding() const
    00205     {
    00206         return m_encoding;
    00207     }
    00208
    00215     XalanDOMString
    00216     getOutputMediaType() const
    00217     {
    00218         return m_mediatype;
    00219     }
    00220
    00227     XalanDOMString
    00228     getOutputDoctypeSystem() const
    00229     {
    00230         return m_doctypeSystem;
    00231     }
    00232
    00239     XalanDOMString
    00240     getOutputDoctypePublic() const
    00241     {
    00242         return m_doctypePublic;
    00243     }
    00244
    00250     bool
    00251     getOmitOutputXMLDecl() const
    00252     {
    00253         return m_omitxmlDecl;
    00254     }
    00255
    00262     XalanDOMString
    00263     getOutputStandalone() const
    00264     {
    00265         return m_standalone;
    00266     }
    00267
    00273     ElemTemplateElement*
    00274     getDefaultTextRule() const
    00275     {
    00276         return m_defaultTextRule;
    00277     }
    00278
    00284     ElemTemplateElement*
    00285     getDefaultRule() const
    00286     {
    00287         return m_defaultRule;
    00288     }
    00289
    00295     ElemTemplateElement*
    00296     getDefaultRootRule() const
    00297     {
    00298         return m_defaultRootRule;
    00299     }
    00300
    00308     void
    00309     processOutputSpec(
    00310             const XalanDOMChar*             name,
    00311             const AttributeListType&        atts,
    00312             StylesheetConstructionContext&  constructionContext);
    00313
    00319     URLStackType&
    00320     getImportStack()
    00321     {
    00322         return m_importStack;
    00323     }
    00324
    00330     const URLStackType&
    00331     getImportStack() const
    00332     {
    00333         return m_importStack;
    00334     }
    00335
    00341     void
    00342     setIndentResult(bool bIndent)
    00343     {
    00344         m_indentResult = bIndent;
    00345     }
    00346
    00353     void
    00354     setOutputMethod(FormatterListener::eFormat  meth)
    00355     {
    00356         m_outputMethod = meth;
    00357     }
    00358
    00359     bool
    00360     hasCDATASectionElements() const
    00361     {
    00362         assert(m_hasCDATASectionElems == false && m_cdataSectionElems.size() == 0 ||
    00363                m_hasCDATASectionElems == true && m_cdataSectionElems.size() != 0);
    00364
    00365         return m_hasCDATASectionElems;
    00366     }
    00367
    00375     bool
    00376     isCDATASectionElementName(const XalanQName&     theQName) const;
    00377
    00390     void
    00391     getNodeSetByKey(
    00392             XalanDocument*                  doc,
    00393             const XalanQName&               qname,
    00394             const XalanDOMString&           ref,
    00395             const PrefixResolver&           resolver,
    00396             MutableNodeRefList&             nodelist,
    00397             StylesheetExecutionContext&     executionContext,
    00398             KeyTablesTableType&             theKeysTable) const;
    00399
    00400     unsigned long
    00401     getNextElemNumberID()
    00402     {
    00403         return m_elemNumberNextID++;
    00404     }
    00405
    00406     unsigned long
    00407     getElemNumberCount() const
    00408     {
    00409         return m_elemNumberNextID;
    00410     }
    00411
    00412     bool
    00413     hasPreserveOrStripSpaceElements() const
    00414     {
    00415         return m_whitespacePreservingElements.empty() == false ||
    00416                m_whitespaceStrippingElements.empty() == false;
    00417     }
    00418
    00419     void
    00420     pushWhitespacePreservingElement(const XPath*    theXPath)
    00421     {
    00422         m_whitespacePreservingElements.push_back(theXPath);
    00423     }
    00424
    00425     void
    00426     pushWhitespaceStrippingElement(const XPath*     theXPath)
    00427     {
    00428         m_whitespaceStrippingElements.push_back(theXPath);
    00429     }
    00430
    00431     bool
    00432     shouldStripSourceNode(
    00433             StylesheetExecutionContext&     executionContext,
    00434             const XalanText&                textNode) const;
    00435
    00436 private:
    00437
    00445     const XalanDOMString&
    00446     getEncoding(const XSLTResultTarget&     outputTarget) const;
    00447
    00453     void
    00454     initDefaultRule(StylesheetConstructionContext&  constructionContext);
    00455
    00460     XalanDOMString  m_version;
    00461
    00466     bool            m_indentResult;
    00467
    00472     XalanDOMString  m_encoding;
    00473
    00478     XalanDOMString  m_mediatype;
    00479
    00485     XalanDOMString  m_doctypeSystem;
    00486
    00495     XalanDOMString  m_doctypePublic;
    00496
    00500     bool            m_omitxmlDecl;
    00501
    00505     XalanDOMString  m_standalone;
    00506
    00511     XalanDOMString              m_resultNameSpaceURL;
    00512
    00516     FormatterListener::eFormat  m_outputMethod;
    00517
    00522     XalanQNameVectorType        m_cdataSectionElems;
    00523
    00524     bool                        m_hasCDATASectionElems;
    00525
    00530     URLStackType                m_importStack;
    00531
    00532
    00537     ElemTemplateElement*        m_defaultTextRule;
    00538
    00543     ElemTemplateElement*        m_defaultRule;
    00544
    00549     ElemTemplateElement*        m_defaultRootRule;
    00550
    00554     bool                        m_needToBuildKeysTable;
    00555
    00559     bool                        m_outputEscapeURLs;
    00560
    00564     int                         m_indentAmount;
    00565
    00569     bool                        m_omitMETATag;
    00570
    00574     unsigned long               m_elemNumberNextID;
    00575
    00579     XPathVectorType             m_whitespacePreservingElements;
    00580
    00584     XPathVectorType             m_whitespaceStrippingElements;
    00585
    00586     // Not implemented...
    00587     StylesheetRoot(const StylesheetRoot&);
    00588
    00589     StylesheetRoot&
    00590     operator=(const StylesheetRoot&);
    00591
    00592     bool
    00593     operator==(const StylesheetRoot&) const;
    00594 };
    00595
    00596
    00597
    00598 XALAN_CPP_NAMESPACE_END
    00599
    00600
    00601
    00602 #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.5 Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.