fixed bug #302302, nasty but the fix is rather simple. Daniel

* xinclude.c: fixed bug #302302, nasty but the fix is rather simple.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 11d494b..253f727 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Aug 10 15:25:53 CEST 2005 Daniel Veillard <daniel@veillard.com>
+
+	* xinclude.c: fixed bug #302302, nasty but the fix is rather simple.
+
 Wed Aug 10 11:59:46 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
 
 	* result/schemas/any6_1_0*: Added missing test results.
diff --git a/xinclude.c b/xinclude.c
index b6ec353..503eb76 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -2303,7 +2303,7 @@
 xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) {
     xmlNodePtr cur;
     int ret = 0;
-    int i;
+    int i, start;
 
     if ((doc == NULL) || (tree == NULL))
 	return(-1);
@@ -2315,6 +2315,10 @@
 	if (ret < 0)
 	    return(-1);
     }
+    if (tree)
+	start = ctxt->incNr;
+    else
+        start = ctxt->incBase;
 
     /*
      * First phase: lookup the elements in the document
@@ -2355,7 +2359,7 @@
     /*
      * Second Phase : collect the infosets fragments
      */
-    for (i = ctxt->incBase;i < ctxt->incNr; i++) {
+    for (i = start;i < ctxt->incNr; i++) {
         xmlXIncludeLoadNode(ctxt, i);
 	ret++;
     }