* Form.cs: Provide meaningful message when MdiParent is assigned a
[mono.git] / mcs / class / System.XML / Mono.Xml.Xsl.Operations / XslElement.cs
index 3aaf97ccc5eb623eb8c268981c8494106d37bdfb..19f2d7d9d45f7cedad236738ef62ca6c9be26400 100644 (file)
@@ -59,18 +59,23 @@ namespace Mono.Xml.Xsl.Operations {
                        if (calcName != null) {
                                int colonAt = calcName.IndexOf (':');
                                if (colonAt == 0)
-                                       throw new XsltCompileException ("Invalid name attribute.", null, c.Input);
+                                       throw new XsltCompileException ("Invalid name attribute", null, c.Input);
                                calcPrefix = colonAt < 0 ? String.Empty : calcName.Substring (0, colonAt);
-                               calcName = colonAt < 0 ? calcName : calcName.Substring (colonAt + 1, calcName.Length - colonAt - 1);
-                               if (ns == null)
-                                       calcNs = c.Input.GetNamespace (calcPrefix);
+                               if (colonAt > 0)
+                                       calcName = calcName.Substring (colonAt + 1);
 
                                try {
                                        XmlConvert.VerifyNCName (calcName);
                                        if (calcPrefix != String.Empty)
                                                XmlConvert.VerifyNCName (calcPrefix);
                                } catch (XmlException ex) {
-                                       throw new XsltCompileException ("Invalid name attribute.", ex, c.Input);
+                                       throw new XsltCompileException ("Invalid name attribute", ex, c.Input);
+                               }
+
+                               if (ns == null) {
+                                       calcNs = c.Input.GetNamespace (calcPrefix);
+                                       if (calcPrefix != String.Empty && calcNs == String.Empty)
+                                               throw new XsltCompileException ("Invalid name attribute", null, c.Input);
                                }
                        } else if (ns != null)
                                calcNs = XslAvt.AttemptPreCalc (ref ns);