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/valid.c b/valid.c
index 7643aa5..a6434c2 100644
--- a/valid.c
+++ b/valid.c
@@ -1859,7 +1859,8 @@
 	/*
 	 * The id is already defined in this DTD.
 	 */
-	VERROR(ctxt->userData, "ID %s already defined\n", value);
+	if (ctxt != NULL)
+	    VERROR(ctxt->userData, "ID %s already defined\n", value);
 	xmlFreeID(ret);
 	return(NULL);
     }