dbertoni    2002/07/24 16:15:52

  Modified:    c/src/XSLT ElemLiteralResult.cpp ElemLiteralResult.hpp
  Log:
  Cache attribute count.
  
  Revision  Changes    Path
  1.51      +12 -13    xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
  
  Index: ElemLiteralResult.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- ElemLiteralResult.cpp     20 May 2002 18:05:13 -0000      1.50
  +++ ElemLiteralResult.cpp     24 Jul 2002 23:15:52 -0000      1.51
  @@ -101,6 +101,7 @@
                        xslToken),
        m_elementName(name),
        m_avts(),
  +     m_attrCount(0),
        m_hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ? 
true : false)
   {
        const unsigned int      nAttrs = atts.getLength();
  @@ -212,9 +213,9 @@
        // OK, now check all attribute AVTs to make sure
        // our NamespacesHandler knows about any prefixes
        // that will need namespace declarations...
  -     const AVTVectorType::size_type  nAttrs = m_avts.size();
  +     m_attrCount = m_avts.size();
   
  -     for(AVTVectorType::size_type i = 0; i < nAttrs; ++i)
  +     for(AVTVectorType::size_type i = 0; i < m_attrCount; ++i)
        {
                const AVT* const        avt = m_avts[i];
   
  @@ -228,7 +229,7 @@
                }
        }
   
  -     if (nAttrs != 0 ||
  +     if (m_attrCount != 0 ||
                m_namespacesHandler.getNamespaceDeclarationsCount() != 0)
        {
                canGenerateAttributes(true);
  @@ -320,15 +321,13 @@
                }
        }
   
  -     if(0 != m_avts.size())
  +     if(m_attrCount > 0)
        {
  -             const AVTVectorType::size_type  nAttrs = m_avts.size();
  -
                StylesheetExecutionContext::GetAndReleaseCachedString   
theGuard(executionContext);
   
                XalanDOMString&         theStringedValue = theGuard.get();
   
  -             for(AVTVectorType::size_type i = 0; i < nAttrs; ++i)
  +             for(AVTVectorType::size_type i = 0; i < m_attrCount; ++i)
                {
                        const AVT* const        avt = m_avts[i];
   
  @@ -384,7 +383,12 @@
       {
                const XalanDOMString::size_type         indexOfNSSep = 
indexOf(attrName, XalanUnicode::charColon);
   
  -             if(indexOfNSSep < length(attrName))
  +             if(indexOfNSSep >= length(attrName))
  +             {
  +                     // An empty namespace is OK.
  +                     isAttrOK = true;
  +             }
  +             else
                {
                        const XalanDOMString    prefix(attrName, indexOfNSSep);
   
  @@ -394,11 +398,6 @@
                        {
                                isAttrOK = true;
                        }
  -             }
  -             else
  -             {
  -                     // An empty namespace is OK.
  -                     isAttrOK = true;
                }
       }
   
  
  
  
  1.25      +8 -3      xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
  
  Index: ElemLiteralResult.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ElemLiteralResult.hpp     16 May 2002 00:48:20 -0000      1.24
  +++ ElemLiteralResult.hpp     24 Jul 2002 23:15:52 -0000      1.25
  @@ -182,17 +182,22 @@
        /**
         * The name of the literal result element.
         */
  -     const XalanDOMString    m_elementName;
  +     const XalanDOMString            m_elementName;
   
        /**
         * A vector to keep track of the attribute elements.
         */
  -     AVTVectorType                   m_avts;
  +     AVTVectorType                           m_avts;
  +
  +     /**
  +      * The size of m_avts, once the stylesheet is compiled...
  +      */
  +     AVTVectorType::size_type        m_attrCount;
   
        /**
         * If true, the literal result element has a namespace prefix...
         */
  -     const bool                              m_hasPrefix;
  +     const bool                                      m_hasPrefix;
   };
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to