3 hours of debug, this was hell:
- SAX.c parser.c xpath.c: generating IDs when not validating
  from an external parsed entity was poisoning the ID has table
  with removed values. This was killing XSLT on the KDE help
  browser.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 9f1a5e0..839965f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Apr 18 23:33:11 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+	* SAX.c parser.c xpath.c: generating IDs when not validating
+	  from an external parsed entity was poisoning the ID has table
+	  with removed values. This was killing XSLT on the KDE help
+	  browser.
+
 Wed Apr 18 17:09:15 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
 	* entities.h: andrew@ugh.net.au detected a double declaration
diff --git a/SAX.c b/SAX.c
index 9691a88..c3f94fc 100644
--- a/SAX.c
+++ b/SAX.c
@@ -890,7 +890,7 @@
 	    ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc,
 					       ctxt->node, ret, value);
 	}
-    } else {
+    } else if (ctxt->external != 2){
         /*
 	 * when validating, the ID registration is done at the attribute
 	 * validation level. Otherwise we have to do specific handling here.
diff --git a/parser.c b/parser.c
index 8483069..a784f71 100644
--- a/parser.c
+++ b/parser.c
@@ -4217,13 +4217,16 @@
     ctxt->entity = ctxt->input;
     NEXT;
     if (RAW == '?') {
-        ret->ocur = XML_ELEMENT_CONTENT_OPT;
+	if (ret != NULL)
+	    ret->ocur = XML_ELEMENT_CONTENT_OPT;
 	NEXT;
     } else if (RAW == '*') {
-        ret->ocur = XML_ELEMENT_CONTENT_MULT;
+	if (ret != NULL)
+	    ret->ocur = XML_ELEMENT_CONTENT_MULT;
 	NEXT;
     } else if (RAW == '+') {
-        ret->ocur = XML_ELEMENT_CONTENT_PLUS;
+	if (ret != NULL)
+	    ret->ocur = XML_ELEMENT_CONTENT_PLUS;
 	NEXT;
     }
     return(ret);
@@ -8880,6 +8883,7 @@
     xmlParserCtxtPtr ctxt;
     xmlDocPtr newDoc;
     xmlSAXHandlerPtr oldsax = NULL;
+    int oldexternal = ctxt->external;
     int ret = 0;
 
     if (depth > 40) {
@@ -8950,6 +8954,7 @@
      */
     ctxt->instate = XML_PARSER_CONTENT;
     ctxt->validate = 0;
+    ctxt->external = 2;
     ctxt->loadsubset = 0;
     ctxt->depth = depth;
 
diff --git a/xpath.c b/xpath.c
index 48ddc75..7d4fc32 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3755,7 +3755,10 @@
  */
 xmlNodePtr
 xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
-    if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
+    if (ctxt->context->node == NULL)
+	return(NULL);
+    if (ctxt->context->node->type != XML_ELEMENT_NODE)
+	return(NULL);
     if (cur == NULL) {
         if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc)
 	    return(NULL);