diff --git a/ChangeLog b/ChangeLog
index 4e2dc471cf848eee004a551f595d5b767b1ff09f_Q2hhbmdlTG9n..b680889ed975b48a11d8e41df1b8a204ff896fb2_Q2hhbmdlTG9n 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jan 22 19:37:00 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+	* libxslt/xsltproc.c: avoid segfault when stylesheet is inproper
+	* libxslt/transform.c: add support for "*" to strip and preserve
+	  space.
+
 Mon Jan 22 15:30:19 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
 	* TODO: updated
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 4e2dc471cf848eee004a551f595d5b767b1ff09f_bGlieHNsdC90cmFuc2Zvcm0uYw==..b680889ed975b48a11d8e41df1b8a204ff896fb2_bGlieHNsdC90cmFuc2Zvcm0uYw== 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -512,6 +512,7 @@
 xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node) {
     xmlNodePtr copy;
     xmlNodePtr delete = NULL;
+    int strip_spaces = -1;
 
     switch (node->type) {
 	case XML_DOCUMENT_NODE:
@@ -545,11 +546,29 @@
 		    (ctxt->style->stripSpaces != NULL)) {
 		    const xmlChar *val;
 
-		    val = (const xmlChar *)
-			  xmlHashLookup(ctxt->style->stripSpaces,
-				        node->parent->name);
-		    if ((val != NULL) &&
-			(xmlStrEqual(val, (xmlChar *) "strip"))) {
+		    if (strip_spaces == -1) {
+			/* TODO: add namespaces support */
+			val = (const xmlChar *)
+			      xmlHashLookup(ctxt->style->stripSpaces,
+					    node->parent->name);
+			if (val != NULL) {
+			    if (xmlStrEqual(val, (xmlChar *) "strip"))
+				strip_spaces = 1;
+			    if (xmlStrEqual(val, (xmlChar *) "preserve"))
+				strip_spaces = 0;
+			} 
+			if (strip_spaces == -1) {
+			    val = (const xmlChar *)
+				  xmlHashLookup(ctxt->style->stripSpaces,
+						(const xmlChar *)"*");
+			    if ((val != NULL) &&
+				(xmlStrEqual(val, (xmlChar *) "strip")))
+				strip_spaces = 1;
+			    else
+				strip_spaces = 0;
+			}
+		    }
+		    if (strip_spaces == 1) {
 			delete = node;
 			break;
 		    }
diff --git a/libxslt/xsltproc.c b/libxslt/xsltproc.c
index 4e2dc471cf848eee004a551f595d5b767b1ff09f_bGlieHNsdC94c2x0cHJvYy5j..b680889ed975b48a11d8e41df1b8a204ff896fb2_bGlieHNsdC94c2x0cHJvYy5j 100644
--- a/libxslt/xsltproc.c
+++ b/libxslt/xsltproc.c
@@ -49,5 +49,4 @@
 		else
 		    xmlIndentTreeOutput = 0;
 		i++;
-		break;
 	    }
@@ -53,3 +52,5 @@
 	    }
+	    break;
+		
 	}
     }
@@ -54,16 +55,18 @@
 	}
     }
-    for (;i < argc ; i++) {
-	doc = xmlParseFile(argv[i]);
-	if (doc == NULL) {
-	    fprintf(stderr, "unable to parse %s\n", argv[i]);
-	    continue;
-	}
-	if (repeat) {
-	    int j;
-	    for (j = 0;j < 99; j++) {
-		res = xsltApplyStylesheet(cur, doc);
-		xmlFreeDoc(res);
-		xmlFreeDoc(doc);
-		doc = xmlParseFile(argv[i]);
+    if (cur != NULL) {
+	for (;i < argc ; i++) {
+	    doc = xmlParseFile(argv[i]);
+	    if (doc == NULL) {
+		fprintf(stderr, "unable to parse %s\n", argv[i]);
+		continue;
+	    }
+	    if (repeat) {
+		int j;
+		for (j = 0;j < 99; j++) {
+		    res = xsltApplyStylesheet(cur, doc);
+		    xmlFreeDoc(res);
+		    xmlFreeDoc(doc);
+		    doc = xmlParseFile(argv[i]);
+		}
 	    }
@@ -69,2 +72,18 @@
 	    }
+	    res = xsltApplyStylesheet(cur, doc);
+	    xmlFreeDoc(doc);
+	    if (res == NULL) {
+		fprintf(stderr, "no result for %s\n", argv[i]);
+		continue;
+	    }
+	    if (cur->methodURI == NULL) {
+#ifdef LIBXML_DEBUG_ENABLED
+		if (debug)
+		    xmlDebugDumpDocument(stdout, res);
+		else
+#endif
+		    xsltSaveResultToFile(stdout, res, cur);
+	    }
+
+	    xmlFreeDoc(res);
 	}
@@ -70,18 +89,3 @@
 	}
-	res = xsltApplyStylesheet(cur, doc);
-	xmlFreeDoc(doc);
-	if (res == NULL) {
-	    fprintf(stderr, "no result for %s\n", argv[i]);
-	    continue;
-	}
-	if (cur->methodURI == NULL) {
-#ifdef LIBXML_DEBUG_ENABLED
-	    if (debug)
-		xmlDebugDumpDocument(stdout, res);
-	    else
-#endif
-		xsltSaveResultToFile(stdout, res, cur);
-	}
-
-	xmlFreeDoc(res);
+	xsltFreeStylesheet(cur);
     }
@@ -87,6 +91,4 @@
     }
-    if (cur != NULL)
-	xsltFreeStylesheet(cur);
     xmlCleanupParser();
     xmlMemoryDump();
     return(0);