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...@apache.org on 2001/09/28 16:49:40 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/templates ElemLiteralResult.java ElemTemplateElement.java Stylesheet.java

mmidy       01/09/28 07:49:40

  Modified:    java/src/org/apache/xalan/templates ElemLiteralResult.java
                        ElemTemplateElement.java Stylesheet.java
  Log:
  Bugzilla 3800: Make sure that when looking for excluded prefixes, we check the URI associated with the prefix, not the prefix in the excluded list.
  
  Revision  Changes    Path
  1.28      +15 -10    xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java
  
  Index: ElemLiteralResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ElemLiteralResult.java	2001/09/20 15:53:43	1.27
  +++ ElemLiteralResult.java	2001/09/28 14:49:40	1.28
  @@ -246,23 +246,29 @@
      * the "extension-element-prefixes" property.
      * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a>
      *
  -   * @param prefix non-null reference to prefix that might be excluded.
  +   * @param prefix non-null reference to prefix that might be excluded.(not currently used)
  +   * @param uri reference to namespace that prefix maps to
      *
      * @return true if the prefix should normally be excluded.
      */
  -  public boolean containsExcludeResultPrefix(String prefix)
  +  public boolean containsExcludeResultPrefix(String prefix, String uri)
     {
   
  -    if (null == m_excludeResultPrefixes)
  -      return super.containsExcludeResultPrefix(prefix);
  +    if (null == m_excludeResultPrefixes || uri == null)
  +      return super.containsExcludeResultPrefix(prefix, uri);
   
       if (prefix.length() == 0)
         prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
   
  -    if (m_excludeResultPrefixes.contains(prefix))
  -      return true;
  -    else
  -      return super.containsExcludeResultPrefix(prefix);
  +    // This loop is ok here because this code only runs during
  +    // stylesheet compile time.    
  +    for (int i =0; i< m_excludeResultPrefixes.size(); i++)
  +    {
  +      if (uri.equals(getNamespaceForPrefix(m_excludeResultPrefixes.elementAt(i))))
  +        return true;
  +    }    
  +    
  +    return super.containsExcludeResultPrefix(prefix, uri);
     }
   
     /**
  @@ -604,8 +610,7 @@
   
       if (null != m_excludeResultPrefixes)
       {
  -      if (m_excludeResultPrefixes.contains(prefix))
  -        return true;
  +      return containsExcludeResultPrefix(prefix, uri);
       }
   
       return false;
  
  
  
  1.44      +3 -3      xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- ElemTemplateElement.java	2001/09/13 14:52:27	1.43
  +++ ElemTemplateElement.java	2001/09/28 14:49:40	1.44
  @@ -916,11 +916,11 @@
      *
      * @return true if the prefix should normally be excluded.
      */
  -  public boolean containsExcludeResultPrefix(String prefix)
  +  public boolean containsExcludeResultPrefix(String prefix, String uri)
     {
       ElemTemplateElement parent = this.getParentElem();
       if(null != parent)
  -      return parent.containsExcludeResultPrefix(prefix);
  +      return parent.containsExcludeResultPrefix(prefix, uri);
         
       return false;
     }
  @@ -948,7 +948,7 @@
                 || uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL))
           return true;
   
  -      if (containsExcludeResultPrefix(prefix))
  +      if (containsExcludeResultPrefix(prefix, uri))
           return true;
       }
   
  
  
  
  1.24      +15 -4     xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Stylesheet.java	2001/06/12 19:15:13	1.23
  +++ Stylesheet.java	2001/09/28 14:49:40	1.24
  @@ -389,19 +389,30 @@
      * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
      *
      * @param prefix non-null reference to prefix that might be excluded.
  +   * @param uri reference to namespace that prefix maps to
      *
      * @return true if the prefix should normally be excluded.>
      */
  -  public boolean containsExcludeResultPrefix(String prefix)
  +  public boolean containsExcludeResultPrefix(String prefix, String uri) 
     {
   
  -    if (null == m_ExcludeResultPrefixs)
  +    if (null == m_ExcludeResultPrefixs || uri == null )
         return false;
  +    
  +    // This loop is ok here because this code only runs during
  +    // stylesheet compile time.
  +    for (int i =0; i< m_ExcludeResultPrefixs.size(); i++)
  +    {
  +      if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i))))
  +        return true;
  +    }
  +    
  +    return false;
   
  -    if (prefix.length() == 0)
  +  /*  if (prefix.length() == 0)
         prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
   
  -    return m_ExcludeResultPrefixs.contains(prefix);
  +    return m_ExcludeResultPrefixs.contains(prefix); */
     }
   
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org