You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@locus.apache.org on 2000/02/18 17:48:39 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt ElemLiteralResult.java ElemTemplateElement.java XSLTEngineImpl.java

mmidy       00/02/18 08:48:39

  Modified:    src/org/apache/xalan/xpath/xml MutableAttrListImpl.java
               src/org/apache/xalan/xslt ElemLiteralResult.java
                        ElemTemplateElement.java XSLTEngineImpl.java
  Log:
  Don't call MutableAtttrList to remove attributes before adding them. Change addAttribute to look for existing attribute.
  
  Revision  Changes    Path
  1.2       +24 -12    xml-xalan/src/org/apache/xalan/xpath/xml/MutableAttrListImpl.java
  
  Index: MutableAttrListImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/MutableAttrListImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MutableAttrListImpl.java	2000/02/17 15:44:31	1.1
  +++ MutableAttrListImpl.java	2000/02/18 16:48:37	1.2
  @@ -80,18 +80,30 @@
     public void addAttribute (String name, String type, String value)
     {
       // removeAttribute (name); // I think this is correct, but I don't think I need it
  -    
    if((m_firstFree+SLOTS_PER_ATTR) >= m_mapSize)
  +    int offset = m_firstFree;
  +    // first see if the attribute was already in the list. Increment by SLOTS_PER_ATTR
    // because names would only be in those slots. 
  +    for(int i = 0; i < m_firstFree; i+=SLOTS_PER_ATTR)
       {
  -      m_mapSize+=m_blocksize;
  -      String newMap[] = new String[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  -      m_map = newMap;
  -    }
  -
  -    m_map[m_firstFree+OFFSET_NAME] = name;
  -    m_map[m_firstFree+OFFSET_TYPE] = type;
  -    m_map[m_firstFree+OFFSET_VALUE] = value;
  -    m_firstFree+=SLOTS_PER_ATTR;
  +      if(m_map[i+OFFSET_NAME].equals(name))
  +      {
  +        offset = i;
  +        break;
      }  
  +    }
    // If the attribute was not in the list, see if we need a bigger list 
  +    if (offset == m_firstFree)
  +    {      
      if((m_firstFree+SLOTS_PER_ATTR) >= m_mapSize)
  +      {
  +        m_mapSize+=m_blocksize;
  +        String newMap[] = new String[m_mapSize];
  +        System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +        m_map = newMap;
  +      }
  +      m_firstFree+=SLOTS_PER_ATTR;
  +    }  
  +    // add or reset the attribute
  +    m_map[offset+OFFSET_NAME] = name;
  +    m_map[offset+OFFSET_TYPE] = type;
  +    m_map[offset+OFFSET_VALUE] = value;
  +    
     }
     
     
  @@ -111,7 +123,7 @@
      */
     public void removeAttribute (String name)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +    for(int i = 0; i < m_firstFree; i+=SLOTS_PER_ATTR)
       {
         if(m_map[i+OFFSET_NAME].equals(name))
         {
  
  
  
  1.15      +1 -1      xml-xalan/src/org/apache/xalan/xslt/ElemLiteralResult.java
  
  Index: ElemLiteralResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemLiteralResult.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemLiteralResult.java	2000/01/20 14:40:07	1.14
  +++ ElemLiteralResult.java	2000/02/18 16:48:38	1.15
  @@ -224,7 +224,7 @@
             // add to result tree
             if(nsprefix == null ||!(m_stylesheet.shouldExcludeResultNamespaceNode(this, nsprefix, stringedValue)))
             {            
  -            processor.m_pendingAttributes.removeAttribute(avt.m_name);
  +            //processor.m_pendingAttributes.removeAttribute(avt.m_name);
               processor.m_pendingAttributes.addAttribute(avt.m_name, avt.m_type, 
                                                                 stringedValue);
             }
  
  
  
  1.18      +1 -1      xml-xalan/src/org/apache/xalan/xslt/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemTemplateElement.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ElemTemplateElement.java	2000/02/17 13:06:26	1.17
  +++ ElemTemplateElement.java	2000/02/18 16:48:38	1.18
  @@ -417,7 +417,7 @@
         }
       }
   
  -    attList.removeAttribute(aname);
  +    //attList.removeAttribute(aname);
       attList.addAttribute(aname, "CDATA", newValue);
     }
     
  
  
  
  1.41      +1 -1      xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
  
  Index: XSLTEngineImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- XSLTEngineImpl.java	2000/02/18 06:41:08	1.40
  +++ XSLTEngineImpl.java	2000/02/18 16:48:38	1.41
  @@ -4118,7 +4118,7 @@
         }
       }
   
  -    attList.removeAttribute(aname);
  +    //attList.removeAttribute(aname);
       attList.addAttribute(aname, "CDATA", value);
     }