apply fix for XHTML1 formating from Nick Wellnhofer fixes bug #141266

* xmlsave.c: apply fix for XHTML1 formating from Nick Wellnhofer
  fixes bug #141266
* test/xhtmlcomp result//xhtmlcomp*: added the specific regression
  test
Daniel
diff --git a/ChangeLog b/ChangeLog
index 04679df..47d230a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun May  9 19:46:13 CEST 2004 Daniel Veillard <daniel@veillard.com>
+
+	* xmlsave.c: apply fix for XHTML1 formating from Nick Wellnhofer
+	  fixes bug #141266
+	* test/xhtmlcomp result//xhtmlcomp*: added the specific regression
+	  test
+
 Sun May  9 14:07:21 CEST 2004 Daniel Veillard <daniel@veillard.com>
 
 	* Makefile.am: fix for a pedantic make check without make all request
diff --git a/result/noent/xhtmlcomp b/result/noent/xhtmlcomp
new file mode 100644
index 0000000..4ce634c
--- /dev/null
+++ b/result/noent/xhtmlcomp
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <body>
+    <h1><abbr>a</abbr> b</h1>
+  </body>
+</html>
diff --git a/result/xhtmlcomp b/result/xhtmlcomp
new file mode 100644
index 0000000..4ce634c
--- /dev/null
+++ b/result/xhtmlcomp
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <body>
+    <h1><abbr>a</abbr> b</h1>
+  </body>
+</html>
diff --git a/result/xhtmlcomp.rdr b/result/xhtmlcomp.rdr
new file mode 100644
index 0000000..97517b7
--- /dev/null
+++ b/result/xhtmlcomp.rdr
@@ -0,0 +1,19 @@
+0 10 html 0 0
+0 1 html 0 0
+1 14 #text 0 1 
+  
+1 1 body 0 0
+2 14 #text 0 1 
+    
+2 1 h1 0 0
+3 1 abbr 0 0
+4 3 #text 0 1 a
+3 15 abbr 0 0
+3 3 #text 0 1  b
+2 15 h1 0 0
+2 14 #text 0 1 
+  
+1 15 body 0 0
+1 14 #text 0 1 
+
+0 15 html 0 0
diff --git a/result/xhtmlcomp.sax b/result/xhtmlcomp.sax
new file mode 100644
index 0000000..a7a0d69
--- /dev/null
+++ b/result/xhtmlcomp.sax
@@ -0,0 +1,23 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(html, -//W3C//DTD XHTML 1.0 Strict//EN, http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd)
+SAX.externalSubset(html, -//W3C//DTD XHTML 1.0 Strict//EN, http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd)
+SAX.startElement(html)
+SAX.characters(
+  , 3)
+SAX.startElement(body)
+SAX.characters(
+    , 5)
+SAX.startElement(h1)
+SAX.startElement(abbr)
+SAX.characters(a, 1)
+SAX.endElement(abbr)
+SAX.characters( b, 2)
+SAX.endElement(h1)
+SAX.characters(
+  , 3)
+SAX.endElement(body)
+SAX.characters(
+, 1)
+SAX.endElement(html)
+SAX.endDocument()
diff --git a/test/xhtmlcomp b/test/xhtmlcomp
new file mode 100644
index 0000000..47dd2a7
--- /dev/null
+++ b/test/xhtmlcomp
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+  <body>
+    <h1><abbr>a</abbr> b</h1>
+  </body>
+</html>
diff --git a/xmlsave.c b/xmlsave.c
index b4f6de9..65b96d1 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -1127,10 +1127,14 @@
 	    child = child->next;
 	}
     } else if (cur->children != NULL) {
+	int indent = ctxt->format;
+	
 	if (format) xmlOutputBufferWriteString(buf, "\n");
 	if (ctxt->level >= 0) ctxt->level++;
+	ctxt->format = format;
 	xhtmlNodeListDumpOutput(ctxt, cur->children);
 	if (ctxt->level > 0) ctxt->level--;
+	ctxt->format = indent;
 	if ((xmlIndentTreeOutput) && (format))
 	    xmlOutputBufferWrite(buf, ctxt->indent_size *
 	                         (ctxt->level > ctxt->indent_nr ?