dbertoni    00/07/11 12:54:54

  Modified:    c/src/XSLT Stylesheet.cpp Stylesheet.hpp
                        StylesheetHandler.cpp StylesheetHandler.hpp
                        StylesheetRoot.cpp
  Log:
  Fixed problems with namespace handling for attributes, and during xsl:include.
  
  Revision  Changes    Path
  1.24      +4 -18     xml-xalan/c/src/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Stylesheet.cpp    2000/07/06 20:19:25     1.23
  +++ Stylesheet.cpp    2000/07/11 19:54:53     1.24
  @@ -262,13 +262,15 @@
                        *nsContext);
                }
                else if(equals(aname, Constants::ATTRNAME_USE))
  +             {
                        useAttr = 
constructionContext.createXPath(atts.getValue(i),
                                *nsContext);
  -             else
  +             }
  +             else if (isAttrOK(aname, atts, i, constructionContext) == false)
                {
                        constructionContext.error(
                                XalanDOMString("xsl:key, unrecognized keyword 
'") +
  -                                     Constants::ATTRNAME_NAME + 
  +                                     aname + 
                                        XalanDOMString("'!"));
                }
        }
  @@ -1475,22 +1477,6 @@
                }
        }
   }    
  -
  -
  -
  -const
  -Stylesheet::NamespaceVectorType& Stylesheet::getNamespaceDecls() const
  -{ 
  -     return m_namespaceDecls;
  -}
  -
  -
  -
  -void
  -Stylesheet::setNamespaceDecls(const NamespaceVectorType& ns)
  -{
  -     m_namespaceDecls = ns;
  -}
   
   
   
  
  
  
  1.16      +30 -2     xml-xalan/c/src/XSLT/Stylesheet.hpp
  
  Index: Stylesheet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Stylesheet.hpp    2000/07/06 20:19:25     1.15
  +++ Stylesheet.hpp    2000/07/11 19:54:53     1.16
  @@ -238,12 +238,37 @@
        }
   
        /**
  +      * Retrieve the stack of namespace lists
  +      * 
  +      * @return vector of namespace vectors
  +      */
  +     NamespacesStackType&
  +     getNamespaces()
  +     { 
  +             return m_namespaces;
  +     }
  +
  +     /**
         * Retrieve the list of namespace declarations currently in effect
         * 
         * @return vector of namespace vectors
         */
        const NamespaceVectorType&
  -     getNamespaceDecls() const;
  +     getNamespaceDecls() const
  +     {
  +             return m_namespaceDecls;
  +     }
  +
  +     /**
  +      * Retrieve the list of namespace declarations currently in effect
  +      * 
  +      * @return vector of namespace vectors
  +      */
  +     NamespaceVectorType&
  +     getNamespaceDecls()
  +     {
  +             return m_namespaceDecls;
  +     }
   
        /**
         * Set the list of namespace declarations currently in effect
  @@ -251,7 +276,10 @@
         * @param ns vector of namespace vectors
         */
        void
  -     setNamespaceDecls(const NamespaceVectorType& ns);
  +     setNamespaceDecls(const NamespaceVectorType& ns)
  +     {
  +             m_namespaceDecls = ns;
  +     }
   
        /*
         * Get the top entry on the namespace stack, or 0, if
  
  
  
  1.34      +13 -1     xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StylesheetHandler.cpp     2000/06/17 21:14:24     1.33
  +++ StylesheetHandler.cpp     2000/07/11 19:54:53     1.34
  @@ -1590,7 +1590,9 @@
        m_inTemplate(theHandler.m_inTemplate),
        m_foundStylesheet(theHandler.m_foundStylesheet),
        m_XSLNameSpaceURL(theHandler.m_stylesheet.getXSLTNamespaceURI()),
  -     m_foundNotImport(theHandler.m_foundNotImport)
  +     m_foundNotImport(theHandler.m_foundNotImport),
  +     m_namespaceDecls(),
  +     m_namespaces()
   {
        m_handler.m_elemStack.clear();
        m_handler.m_pTemplate = 0;
  @@ -1598,6 +1600,11 @@
        m_handler.m_inTemplate = false;
        m_handler.m_foundStylesheet = false;
        m_handler.m_foundNotImport = false;
  +
  +     // This is much more efficient, since we're just swapping
  +     // underlying data.  This clears out the stack as well...
  +     m_namespaceDecls.swap(theHandler.m_stylesheet.getNamespaceDecls());
  +     m_namespaces.swap(theHandler.m_stylesheet.getNamespaces());
   }
   
   
  @@ -1621,4 +1628,9 @@
        m_handler.m_foundStylesheet = m_foundStylesheet;
        m_handler.m_stylesheet.setXSLTNamespaceURI(m_XSLNameSpaceURL);
        m_handler.m_foundNotImport = m_foundNotImport;
  +
  +     // This is much more efficient, since we're just swapping
  +     // underlying data.
  +     m_handler.m_stylesheet.getNamespaceDecls().swap(m_namespaceDecls);
  +     m_handler.m_stylesheet.getNamespaces().swap(m_namespaces);
   }
  
  
  
  1.14      +16 -9     xml-xalan/c/src/XSLT/StylesheetHandler.hpp
  
  Index: StylesheetHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetHandler.hpp     2000/05/29 22:47:56     1.13
  +++ StylesheetHandler.hpp     2000/07/11 19:54:53     1.14
  @@ -78,11 +78,14 @@
   
   
   
  +#include <XSLT/Stylesheet.hpp>
  +
  +
  +
   class ElemTemplate;
   class ElemTemplateElement;
   class ElemTextLiteral;
   class ExtensionNSHandler;
  -class Stylesheet;
   class StylesheetConstructionContext;
   
   
  @@ -481,22 +484,26 @@
                ~PushPopIncludeState();
   
        private:
  +
  +             StylesheetHandler&                                      
m_handler;
  +
  +             ElemTemplateStackType                           m_elemStack;
   
  -             StylesheetHandler&                      m_handler;
  +             ElemTemplate* const                                     
m_pTemplate;
   
  -             ElemTemplateStackType           m_elemStack;
  +             ElemTemplateElement* const                      m_lastPopped;
   
  -             ElemTemplate* const                     m_pTemplate;
  +             const bool                                                      
m_inTemplate;
   
  -             ElemTemplateElement* const      m_lastPopped;
  +             const bool                                                      
m_foundStylesheet;
   
  -             const bool                                      m_inTemplate;
  +             const XalanDOMString                            
m_XSLNameSpaceURL;
   
  -             const bool                                      
m_foundStylesheet;
  +             const bool                                                      
m_foundNotImport;
   
  -             const XalanDOMString            m_XSLNameSpaceURL;
  +             Stylesheet::NamespaceVectorType         m_namespaceDecls;
   
  -             const bool                                      
m_foundNotImport;
  +             Stylesheet::NamespacesStackType         m_namespaces;
        };
   
        friend class PushPopIncludeState;
  
  
  
  1.18      +1 -1      xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- StylesheetRoot.cpp        2000/05/26 19:25:36     1.17
  +++ StylesheetRoot.cpp        2000/07/11 19:54:53     1.18
  @@ -553,7 +553,7 @@
                                m_cdataSectionElems.push_back(qname);
                        }
                }
  -             else
  +             else if (isAttrOK(aname, atts, i, constructionContext) == false)
                {
                        constructionContext.error(name + XalanDOMString(" has 
an illegal attribute: ")+aname);
                }
  
  
  

Reply via email to