Author: atsushi
Date: 2006-01-13 01:38:10 -0500 (Fri, 13 Jan 2006)
New Revision: 55493

Modified:
   trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
   trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
   trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
Log:
2006-01-13  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * GenericOutputter.cs : When writing string, use WriteWhitespace()
          instead of WhiteString() when its state is not Content. This fixes
          BVTs_bvt066 case (broken after implementing strict state check in
          XmlTextWriter).

        * XslTransformTests.cs : added DocTypeAfterText().



Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog   2006-01-13 06:19:54 UTC 
(rev 55492)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog   2006-01-13 06:38:10 UTC 
(rev 55493)
@@ -1,3 +1,10 @@
+2006-01-13  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * GenericOutputter.cs : When writing string, use WriteWhitespace()
+         instead of WhiteString() when its state is not Content. This fixes
+         BVTs_bvt066 case (broken after implementing strict state check in
+         XmlTextWriter).
+
 2005-12-24  Gert Driesen  <[EMAIL PROTECTED]>
 
        * XslOutput.cs: Do not report error for unknown value for "standalone"

Modified: trunk/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs 2006-01-13 
06:19:54 UTC (rev 55492)
+++ trunk/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs 2006-01-13 
06:38:10 UTC (rev 55493)
@@ -333,6 +333,14 @@
                        CheckState ();
                        if (_insideCData)
                                Emitter.WriteCDataSection (text);
+                       // This weird check is required to reject Doctype
+                       // after non-whitespace nodes but also to allow 
+                       // Doctype after whitespace nodes. It especially
+                       // happens when there is an xsl:text before the
+                       // document element (e.g. BVTs_bvt066 testcase).
+                       else if (_state != WriteState.Content &&
+                                text.Length > 0 && XmlChar.IsWhitespace (text))
+                               Emitter.WriteWhitespace (text);
                        else
                                Emitter.WriteString (text);
                }

Modified: trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog    2006-01-13 
06:19:54 UTC (rev 55492)
+++ trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog    2006-01-13 
06:38:10 UTC (rev 55493)
@@ -1,5 +1,9 @@
 2006-01-13  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * XslTransformTests.cs : added DocTypeAfterText().
+
+2006-01-13  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * XslTransformTests.cs : Output_Indent_Xml_DocType() is working now.
 
 2005-12-27  Gert Driesen  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs 
2006-01-13 06:19:54 UTC (rev 55492)
+++ trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs 
2006-01-13 06:38:10 UTC (rev 55493)
@@ -1848,5 +1848,31 @@
                                "  <body>44.442,70</body>{0}" +
                                "</html>", Environment.NewLine), sw.ToString 
());
                }
+
+               [Test]
+               [Category ("NotDotNet")]
+               // MS bug: the output must be well-formed XML general entity
+               // (doctype must not appear after text nodes).
+               public void DocTypeAfterText ()
+               {
+                       string xsl = @"
+<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+    <xsl:output doctype-system='system'/>
+    <xsl:template match='/'>
+        <xsl:text xml:space='preserve'> a </xsl:text>
+        <foo/>
+    </xsl:template>
+</xsl:stylesheet>";
+                       XslTransform t = new XslTransform ();
+                       t.Load (new XmlTextReader (xsl, XmlNodeType.Document, 
null));
+                       XmlDocument doc = new XmlDocument ();
+                       try {
+                               t.Transform (new XPathDocument (
+                                            new StringReader ("<root/>")),
+                                            null, TextWriter.Null);
+                               Assert.Fail ("should fail; doctype is not 
allowed after whitespace. See XSLT 1.0 section 16.1.");
+                       } catch {
+                       }
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to