Explorar o código

2004-12-01 Atsushi Enomoto <[email protected]>

	* Compiler.cs : XPathNavigatorNsm needed more love. Clone() does not
	  make sense here.



svn path=/trunk/mcs/; revision=36891
Atsushi Eno %!s(int64=21) %!d(string=hai) anos
pai
achega
fc24b787d9

+ 5 - 0
mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog

@@ -1,3 +1,8 @@
+2004-12-01  Atsushi Enomoto  <[email protected]>
+
+	* Compiler.cs : XPathNavigatorNsm needed more love. Clone() does not
+	  make sense here.
+
 2004-12-01  Atsushi Enomoto  <[email protected]>
 
 	* Compiler.cs : don't create XPathNavigatorNsm for every GetNsm() call.

+ 8 - 4
mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs

@@ -824,9 +824,7 @@ namespace Mono.Xml.Xsl
 		XPathNavigator nsScope;
 		
 		public XPathNavigatorNsm (XPathNavigator n) : base (n.NameTable) {
-			nsScope = n.Clone ();
-			if (nsScope.NodeType == XPathNodeType.Attribute)
-				nsScope.MoveToParent ();
+			nsScope = n;
 		}
 
 		public XPathNavigator Navigator {
@@ -844,7 +842,13 @@ namespace Mono.Xml.Xsl
 			if (prefix == "" || prefix == null)
 				return "";
 			
-			return nsScope.GetNamespace (prefix);
+			XPathNavigator n = nsScope;
+			if (nsScope.NodeType == XPathNodeType.Attribute) {
+				n = nsScope.Clone ();
+				n.MoveToParent ();
+			}
+
+			return n.GetNamespace (prefix);
 		}
 	}
 }