2007-12-17 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 17 Dec 2007 08:25:12 +0000 (08:25 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 17 Dec 2007 08:25:12 +0000 (08:25 -0000)
* Iterator.cs : be more strict to detect the end of
  PredicateIterator. Fixed bug #349111.

* XslTransformTests.cs : added test for bug #349111.

svn path=/trunk/mcs/; revision=91405

mcs/class/System.XML/System.Xml.XPath/ChangeLog
mcs/class/System.XML/System.Xml.XPath/Iterator.cs
mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs

index 92e4d7ff0afcff61b08004063d8f44d844385fae..f751f2bc5c21edab0337320fcb09f56db72f6e4e 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-17  Atsushi Enomoto <atsushi@ximian.com>
+
+       * Iterator.cs : be more strict to detect the end of
+         PredicateIterator. Fixed bug #349111.
+
 2007-12-17  Atsushi Enomoto <atsushi@ximian.com>
 
        * Expression.cs : In any comparison expr, treat RTF as equivalent to
index 24be6d9ccf23e1dd33ef7d74cd0618a9097833c8..7e4f0ac98c774fd76b4f0a66957d72de57d5d782 100644 (file)
@@ -1008,15 +1008,12 @@ namespace System.Xml.XPath
 
                public override bool MoveNextCore ()
                {
-                       if (finished)
-                               return false;
                        while (_iter.MoveNext ())
                        {
                                switch (resType) {
                                        case XPathResultType.Number:
                                                if (_pred.EvaluateNumber (_iter) != _iter.ComparablePosition)
                                                        continue;
-                                               finished = true;
                                                break;
                                        case XPathResultType.Any: {
                                                object result = _pred.Evaluate (_iter);
@@ -1024,7 +1021,6 @@ namespace System.Xml.XPath
                                                {
                                                        if ((double) result != _iter.ComparablePosition)
                                                                continue;
-                                                       finished = true;
                                                }
                                                else if (!XPathFunctions.ToBoolean (result))
                                                        continue;
@@ -1038,6 +1034,7 @@ namespace System.Xml.XPath
 
                                return true;
                        }
+                       finished = true;
                        return false;
                }
                public override XPathNavigator Current { get { return _iter.Current; }}
index e4298a367ed8675aafbbb2815ae02540c5309546..3662017efa762ff42e1896b7a502ee3abeaa335b 100644 (file)
@@ -1,3 +1,7 @@
+2007-12-17  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XslTransformTests.cs : added test for bug #349111.
+
 2007-12-17  Atsushi Enomoto  <atsushi@ximian.com>
 
        * XslTransformTests.cs : added test for bug #349035.
index 32bca1a5ec76f24de71f1417f761c3f97fbdeff9..094f2ec220a790da3c1159293da21016ca70d157 100644 (file)
@@ -2036,5 +2036,31 @@ Services
                        string expected = "<bar>bar is not empty:'HaHa'</bar><bar>bar is empty</bar>";
                        Assert.AreEqual (expected, sw.ToString ());
                }
+
+               [Test]
+               public void Bug349111 ()
+               {
+                       XslTransform xslt = new XslTransform ();
+                       xslt.Load (new XmlTextReader (new StringReader (@"
+<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"">
+  <xsl:template match=""book"">
+    <xsl:for-each select=""child::node()[position()]"">
+      <yyy>
+        <xsl:value-of select="".""/>
+      </yyy>
+    </xsl:for-each>
+  </xsl:template>
+</xsl:stylesheet>"
+                               )));
+                       XPathDocument input = new XPathDocument (new StringReader (@"
+<bookstore>
+  <book> <title lang=""eng"">Harry Potter</title> <price>29.99</price> </book>
+</bookstore>"
+                               ));
+                       StringWriter sw = new StringWriter ();
+                       xslt.Transform (input, null, new XmlTextWriter (sw));
+                       string expected = "<yyy>Harry Potter</yyy><yyy>29.99</yyy>";
+                       Assert.AreEqual (expected, sw.ToString ());
+               }
        }
 }