grchiu      2003/08/25 16:31:15

  Modified:    java/src/org/apache/xalan/processor
                        XSLTElementProcessor.java
               java/src/org/apache/xalan/templates Stylesheet.java
  Log:
  Patch for bugzilla 12441. In forward-compatible mode, an unknown attribute
  should be ignored. Currently Xalan throws an exception.
  
  Reviewed by Morris Kwan ([EMAIL PROTECTED]).
  
  Revision  Changes    Path
  1.17      +8 -2      
xml-xalan/java/src/org/apache/xalan/processor/XSLTElementProcessor.java
  
  Index: XSLTElementProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTElementProcessor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XSLTElementProcessor.java 30 Jan 2003 18:45:45 -0000      1.16
  +++ XSLTElementProcessor.java 25 Aug 2003 23:31:14 -0000      1.17
  @@ -326,7 +326,13 @@
     {
   
       XSLTElementDef def = getElemDef();
  -    AttributesImpl undefines = throwError ? null : new AttributesImpl();
  +    AttributesImpl undefines = null;
  +    boolean isCompatibleMode = ((null != handler.getStylesheet() 
  +                                 && handler.getStylesheet().getCompatibleMode())
  +                                || !throwError);
  +    if (isCompatibleMode)
  +      undefines = new AttributesImpl();
  +
   
       // Keep track of which XSLTAttributeDefs have been processed, so 
       // I can see which default values need to be set.
  @@ -351,7 +357,7 @@
   
         if (null == attrDef)
         {
  -        if (throwError)
  +        if (!isCompatibleMode)
           {
   
             // Then barf, because this element does not allow this attribute.
  
  
  
  1.28      +17 -0     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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Stylesheet.java   30 Jan 2003 18:45:51 -0000      1.27
  +++ Stylesheet.java   25 Aug 2003 23:31:14 -0000      1.28
  @@ -435,6 +435,12 @@
      * @serial
      */
     private String m_Version;
  +  
  +  /**
  +   * Whether or not the stylesheet is in "Forward Compatibility Mode" 
  +   * @serial
  +   */
  +  private boolean m_isCompatibleMode = false;
   
     /**
      * Set the "version" property.
  @@ -445,6 +451,17 @@
     public void setVersion(String v)
     {
       m_Version = v;
  +    m_isCompatibleMode = (Double.valueOf(v).doubleValue() > 
Constants.XSLTVERSUPPORTED);
  +  }
  +
  +  /**
  +   * Get whether or not the stylesheet is in "Forward Compatibility Mode"
  +   * 
  +   * @return true if in forward compatible mode, false otherwise
  +   */
  +  public boolean getCompatibleMode()
  +  {
  +     return m_isCompatibleMode;
     }
   
     /**
  
  
  

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

Reply via email to