Modified test for legal element names in <xsl:element>. The element name is
treated as an attribute value. Whitespaces are not allowed in plain text
element names, but should be allowed inside "{...}" attribute values.
PR:		Bugzilla 1489
Obtained from:	n/a
Submitted by:	morten@xml.apache.org
Reviewed by:	morten@xml.apache.org

diff --git a/src/org/apache/xalan/xsltc/compiler/XslElement.java b/src/org/apache/xalan/xsltc/compiler/XslElement.java
index 9852c62..1788b1c 100644
--- a/src/org/apache/xalan/xsltc/compiler/XslElement.java
+++ b/src/org/apache/xalan/xsltc/compiler/XslElement.java
@@ -122,17 +122,6 @@
 	    }
 	}
 
-	// Next check that the local part of the QName is legal (no whitespace)
-	if (qname.getLocalPart().indexOf(' ') > -1) {
-	    final ErrorMsg msg = 
-		new ErrorMsg("You can't call an element \""+
-			     qname.getLocalPart()+"\"");
-	    parser.reportError(Constants.WARNING, msg);
-	    parseChildren(parser);
-	    _ignore = true; // Ignore the element if the local part is invalid
-	    return;
-	}
-
 	// Check if this element belongs in a specific namespace
 	if (namespace != Constants.EMPTYSTRING) {
 	    // Get the namespace requested by the xsl:element
@@ -152,6 +141,18 @@
 
 	_name = AttributeValue.create(this, name, parser);
 
+	// Next check that the local part of the QName is legal (no whitespace)
+	if ((_name instanceof SimpleAttributeValue) &&
+	    (qname.getLocalPart().indexOf(' ') > -1)) {
+	    final ErrorMsg msg = 
+		new ErrorMsg("You can't call an element \""+
+			     qname.getLocalPart()+"\"");
+	    parser.reportError(Constants.WARNING, msg);
+	    parseChildren(parser);
+	    _ignore = true; // Ignore the element if the local part is invalid
+	    return;
+	}
+
 	// Handle the 'use-attribute-sets' attribute
 	final String useSets = getAttribute("use-attribute-sets");
 	if (useSets.length() > 0) {