fix #68882, cleanup the XInclude copying of node, merge back IDs in the

* tree.c valid.c xinclude.c: fix #68882, cleanup the XInclude
  copying of node, merge back IDs in the target document.
* result/XInclude/docids.xml test/XInclude/docs/docids.xml
  test/XInclude/ents/ids.xml: test case
* result/VC/ElementValid4: output changed due to a typo fix
Daniel
diff --git a/tree.c b/tree.c
index 4d86c7e..c871dbb 100644
--- a/tree.c
+++ b/tree.c
@@ -2845,6 +2845,21 @@
 	    tmp = tmp->next;
 	}
     }
+    /*
+     * Try to handle IDs
+     */
+    if ((target->doc != NULL) && (cur->doc != NULL) &&
+	(cur->doc->ids != NULL) && (cur->parent != NULL)) {
+	if (xmlIsID(cur->doc, cur->parent, cur)) {
+	    xmlChar *id;
+
+	    id = xmlNodeListGetString(cur->doc, cur->children, 1);
+	    if (id != NULL) {
+		xmlAddID(NULL, target->doc, id, ret);
+		xmlFree(id);
+	    }
+	}
+    }
     return(ret);
 }