You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/12/04 12:46:37 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler SyntaxTreeNode.java XslElement.java

morten      01/12/04 03:46:37

  Modified:    java/src/org/apache/xalan/xsltc/compiler SyntaxTreeNode.java
                        XslElement.java
  Log:
  Added a method to the SyntaxTreeNode base class that can be used to check
  the existence of an attribute in the input document: hasAttribute(String name).
  This method is used in the XslElement class to verify the existence of a
  'namespace' attribute with an empty value.
  PR:		bugzilla 4983
  Obtained from:	n/a
  Submitted by:	morten@xml.apache.org
  Reviewed by:	morten@xml.apache.org
  
  Revision  Changes    Path
  1.17      +6 -1      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java
  
  Index: SyntaxTreeNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SyntaxTreeNode.java	2001/11/22 13:08:23	1.16
  +++ SyntaxTreeNode.java	2001/12/04 11:46:37	1.17
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: SyntaxTreeNode.java,v 1.16 2001/11/22 13:08:23 morten Exp $
  + * @(#)$Id: SyntaxTreeNode.java,v 1.17 2001/12/04 11:46:37 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -200,6 +200,11 @@
   	    return(Constants.EMPTYSTRING);
   	else
   	    return(value);
  +    }
  +
  +    protected boolean hasAttribute(String qname) {
  +	if (_attributes == null) return false;
  +	return (_attributes.getValue(qname) != null);
       }
   
       /**
  
  
  
  1.14      +3 -5      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XslElement.java
  
  Index: XslElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XslElement.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XslElement.java	2001/11/22 13:49:07	1.13
  +++ XslElement.java	2001/12/04 11:46:37	1.14
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: XslElement.java,v 1.13 2001/11/22 13:49:07 morten Exp $
  + * @(#)$Id: XslElement.java,v 1.14 2001/12/04 11:46:37 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -119,10 +119,8 @@
   
   	// First try to get the namespace URI from the "namespace" attribute
   	String namespace = getAttribute("namespace");
  -
   	// Then try to get it from the "name" attribute QName prefix
  -	if ((namespace == null) || (namespace.equals(EMPTYSTRING))) {
  -
  +	if (!hasAttribute("namespace")) {
   	    // We are supposed to use the default namespace URI if the QName
   	    // from the "name" attribute is not prefixed, so check that first
   	    if (prefix == null) prefix = EMPTYSTRING;
  @@ -142,7 +140,7 @@
   	    _prefix = prefix;
   	}
   	// Check if this element belongs in a specific namespace
  -	else if (namespace != EMPTYSTRING) {
  +	else {
   	    // Get the namespace requested by the xsl:element
   	    _namespace = new AttributeValueTemplate(namespace, parser);
   	    // Get the current prefix for that namespace (if any)
  
  
  

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