mmidy       00/02/14 08:42:39

  Modified:    src/org/apache/xalan/xslt StylesheetRoot.java
  Log:
   Check for valid xsl:output atributes
  
  Revision  Changes    Path
  1.22      +28 -3     xml-xalan/src/org/apache/xalan/xslt/StylesheetRoot.java
  
  Index: StylesheetRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/StylesheetRoot.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StylesheetRoot.java       2000/02/10 22:58:44     1.21
  +++ StylesheetRoot.java       2000/02/14 16:42:39     1.22
  @@ -794,10 +794,35 @@
             cdataindex++;
           }
         }
  -      else if(!isAttrOK(aname, atts, i))
  +      else
         {
  -        throw new 
SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE, 
new Object[] {name,aname})); //"(StylesheetHandler) "+"xsl:sort can only be 
used with xsl:apply-templates or xsl:for-each.");
  -      }
  +        // If the attribute is test, or foo:test and foo is not a 
  +        // known namespace prefix, the attribute is invalid.
  +        // if foo is a known prefix, then the attribute is valid.
  +        boolean attrOK = true;
  +        try{          
  +          if(isAttrOK(aname, atts, i))
  +          {
  +            // If a namespace other than xsl was specified, make sure it is 
defined.
  +            int indexOfNSSep = aname.indexOf(':');
  +            if(indexOfNSSep >= 0)
  +            {
  +              String prefix = aname.substring(0, indexOfNSSep);
  +              String ns = getNamespaceForPrefixFromStack(prefix);
  +              attrOK = (!ns.equals(XSLTEngineImpl.m_XSLNameSpaceURL));
  +            }
  +            else
  +              attrOK = false;
  +          }  
  +        }
  +        catch(Exception e)
  +        {
  +          // Namespace not defined
  +          attrOK = false;
  +        }
  +        if (!attrOK)
  +          throw new 
SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE, 
new Object[] {name, aname}));
  +      }  
       }
       if((null != m_outputmethod) && (m_outputmethod.equals("html")) &&
          (false == didSpecifyIndent))
  
  
  

Reply via email to