Author: atsushi
Date: 2007-12-27 09:40:40 -0500 (Thu, 27 Dec 2007)
New Revision: 91940
Modified:
trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
Log:
2007-12-27 Atsushi Enomoto <[EMAIL PROTECTED]>
* XslTransformTests.cs : added test for bug #349375. (Actually the
previous checkin fixed bug #349375.)
Added another notworking one inspired by the same bug.
Modified: trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog 2007-12-27
14:34:30 UTC (rev 91939)
+++ trunk/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog 2007-12-27
14:40:40 UTC (rev 91940)
@@ -1,3 +1,9 @@
+2007-12-27 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XslTransformTests.cs : added test for bug #349375. (Actually the
+ previous checkin fixed bug #349375.)
+ Added another notworking one inspired by the same bug.
+
2007-12-17 Atsushi Enomoto <[EMAIL PROTECTED]>
* XslTransformTests.cs : added test for bug #349111.
Modified: trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
2007-12-27 14:34:30 UTC (rev 91939)
+++ trunk/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
2007-12-27 14:40:40 UTC (rev 91940)
@@ -2062,5 +2062,112 @@
string expected = "<yyy>Harry
Potter</yyy><yyy>29.99</yyy>";
Assert.AreEqual (expected, sw.ToString ());
}
+
+#if NET_2_0
+ [Test] // bug #349375
+ public void PreserveWhitespace ()
+ {
+ XslCompiledTransform xslt = new XslCompiledTransform ();
+ xslt.Load (new XmlTextReader (new StringReader (@"
+<xsl:stylesheet
+ version=""1.0""
+ xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""
+ >
+ <xsl:output omit-xml-declaration='yes' />
+ <xsl:strip-space elements='*'/>
+ <xsl:preserve-space elements='p span'/>
+
+ <xsl:template name='foo'>
+ <xsl:for-each select='node()'>
+ <xsl:attribute name='yes-one-node'/>
+ <xsl:value-of select='.'/>
+ </xsl:for-each>
+ <xsl:if test='not(node())'>
+ <xsl:attribute name='not-node'/>
+ <xsl:value-of select='.'/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match='p'>
+ <y>
+ <xsl:for-each select='child::node()[position()]'>
+ <xsl:choose>
+ <xsl:when test='name()=""span""'>
+ <t>
+ <xsl:call-template name='foo'/>
+ </t>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </y>
+ </xsl:template>
+
+</xsl:stylesheet>")));
+ StringWriter sw = new StringWriter ();
+ xslt.Transform (new XmlTextReader (new StringReader (@"
+<root>
+ <l0>
+ <p>
+ <span>1</span>
+ <span> </span>
+ </p>
+ </l0>
+</root>")), null, sw);
+ Assert.AreEqual (@"<y><t yes-one-node="""">1</t><t
yes-one-node=""""> </t></y>", sw.ToString ());
+ }
+
+ [Test] // reverse case of #349375
+ [Category ("NotWorking")]
+ public void PreserveWhitespace2 ()
+ {
+ XslCompiledTransform xslt = new XslCompiledTransform ();
+ xslt.Load (new XmlTextReader (new StringReader (@"
+<xsl:stylesheet
+ version=""1.0""
+ xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""
+ >
+ <xsl:output omit-xml-declaration='yes' />
+ <xsl:preserve-space elements='*'/>
+ <xsl:strip-space elements='p span'/>
+
+ <xsl:template name='foo'>
+ <xsl:for-each select='node()'>
+ <xsl:attribute name='yes-one-node'/>
+ <xsl:value-of select='.'/>
+ </xsl:for-each>
+ <xsl:if test='not(node())'>
+ <xsl:attribute name='not-node'/>
+ <xsl:value-of select='.'/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match='p'>
+ <y>
+ <xsl:for-each select='child::node()[position()]'>
+ <xsl:choose>
+ <xsl:when test='name()=""span""'>
+ <t>
+ <xsl:call-template name='foo'/>
+ </t>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </y>
+ </xsl:template>
+
+</xsl:stylesheet>")));
+ StringWriter sw = new StringWriter ();
+ xslt.Transform (new XmlTextReader (new StringReader (@"
+<root>
+ <l0>
+ <p>
+ <span>1</span>
+ <span> </span>
+ </p>
+ </l0>
+</root>")), null, sw);
+ Assert.AreEqual (@"<y><t yes-one-node="""">1</t><t
not-node=""""></t></y>", sw.ToString ());
+ }
+#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches