[Mono-bugs] [Bug 76046][Nor] New - XslTransform.Load cannot be used with an xml node

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Sep 9 19:45:24 EDT 2005

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by csaba.halasz at gmail.com.


--- shadow/76046	2005-09-09 19:45:24.000000000 -0400
+++ shadow/76046.tmp.15243	2005-09-09 19:45:24.000000000 -0400
@@ -0,0 +1,47 @@
+Bug#: 76046
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: Csaba.Halasz at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: XslTransform.Load cannot be used with an xml node
+It is not possible to initialize an xsl transformation from an XmlNode of
+an XmlDocument.
+The following code should run OK (it does with M$), but it throws
+System.Xml.Xsl.XsltCompileException: Stylesheet root element must be either
+"stylesheet" or "transform" or any literal element.
+I tested with version 1.1.9.
+using System;
+using System.Xml;
+using System.Xml.Xsl;
+class Test
+        public static void Main(string[] args)
+        {
+                XmlDocument doc = new XmlDocument ();
+                XslTransform xslt = new XslTransform ();
+                doc.LoadXml ("<root><dummy /><xsl:transform
+xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' /></root>");
+                XmlNode Node = doc.ChildNodes[0].ChildNodes[1];
+                Console.WriteLine(Node.Name);
+                xslt.Load (Node, null, null);
+        }
+Additional info: this happens because line 140 in
+mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs calls MoveToFirstChild().
+I guess some condition should be tested to see if this is actually needed.

More information about the mono-bugs mailing list