--- loncom/xml/lonxml.pm	2003/11/21 18:54:10	1.294
+++ loncom/xml/lonxml.pm	2003/11/21 20:21:20	1.295
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.294 2003/11/21 18:54:10 albertel Exp $
+# $Id: lonxml.pm,v 1.295 2003/11/21 20:21:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -167,6 +167,9 @@ $Apache::lonxml::style_end_values='';
 #should we do the postag variable interpolation
 $Apache::lonxml::post_evaluate=1;
 
+#a header message to emit in the case of any generated warning or errors
+$Apache::lonxml::warnings_error_header='';
+
 sub xmlbegin {
   my $output='';
   if ($ENV{'browser.mathml'}) {
@@ -625,6 +628,7 @@ sub setup_globals {
   @Apache::lonxml::extlinks=();
   @Apache::lonxml::ssi_info=();
   $Apache::lonxml::post_evaluate=1;
+  $Apache::lonxml::warnings_error_header='';
   if ($target eq 'meta') {
     $Apache::lonxml::redirection = 0;
     $Apache::lonxml::metamode = 1;
@@ -1301,7 +1305,9 @@ sub error {
   $errorcount++;
   if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
     # If printing in construction space, put the error inside <pre></pre>
-    print "<b>ERROR:</b>".join("\n",@_)."\n";
+      print $Apache::lonxml::warnings_error_header.
+	  "<b>ERROR:</b>".join("\n",@_)."\n";
+      $Apache::lonxml::warnings_error_header='';
   } else {
     print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />";
     #notify author
@@ -1324,13 +1330,15 @@ sub error {
 }
 
 sub warning {
-  $warningcount++;
+    $warningcount++;
   
-  if ($ENV{'form.grade_target'} ne 'tex') {
-      if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
-        print "<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";
-      }
-  }
+    if ($ENV{'form.grade_target'} ne 'tex') {
+	if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
+	    print $Apache::lonxml::warnings_error_header.
+		"<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";
+	    $Apache::lonxml::warnings_error_header='';
+	}
+    }
 }
 
 sub get_param {