--- loncom/xml/lonxml.pm	2003/05/21 20:41:55	1.255
+++ loncom/xml/lonxml.pm	2003/05/22 21:05:01	1.257
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.255 2003/05/21 20:41:55 sakharuk Exp $
+# $Id: lonxml.pm,v 1.257 2003/05/22 21:05:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -520,13 +520,8 @@ sub inner_xmlparse {
 	    $Apache::lonxml::usestyle=0;
 	    my $string=$$style_for_target{$token->[1]}.
 	      '<LONCAPA_INTERNAL_TURN_STYLE_ON />';
-##### LETS TRY VARIABLE INTERPOLATION (it may be stupid but at least it works)
-	    my %localhash=%{$token->[2]};
-	    foreach my $localkey (keys %localhash) {
-		$string=~s/\$$localkey/$localhash{$localkey}/g;
-	    }
-#####
 	    &Apache::lonxml::newparser($pars,\$string);
+	    $Apache::lonxml::style_values=$$parstack[-1];
 	} else {
 	  $result = &callsub("start_$token->[1]", $target, $token, $stack,
 			     $parstack, $pars, $safeeval, $style_for_target);
@@ -549,15 +544,8 @@ sub inner_xmlparse {
 	    $Apache::lonxml::usestyle=0;
 	    my $string=$$style_for_target{'/'.$token->[1]}.
 	      '<LONCAPA_INTERNAL_TURN_STYLE_ON />';
-##### LETS TRY VARIABLE INTERPOLATION (it may be stupid but at least it works)
-	    my @localarray = split /;/, $$parstack[-1];
-	    foreach my $localelement (@localarray) {
-		$localelement=~/my\s+\$([^=]+)=\"(.*)\"$/;
-		my ($whatchange,$tochange) = ($1,$2);
-		$string=~s/\$$whatchange/$tochange/g;
-	    }
-#####
 	    &Apache::lonxml::newparser($pars,\$string);
+	    $Apache::lonxml::style_values=$$parstack[-1];
 	} else {
 	  $result = &callsub("end_$token->[1]", $target, $token, $stack,
 			     $parstack, $pars,$safeeval, $style_for_target);
@@ -567,10 +555,14 @@ sub inner_xmlparse {
       }
       #evaluate variable refs in result
       if ($result ne "") {
+	  my $extras;
+	  if (!$Apache::lonxml::usestyle) {
+	      $extras=$Apache::lonxml::style_values;
+	  }
 	if ( $#$parstack > -1 ) {
-	  $result=&Apache::run::evaluate($result,$safeeval,$$parstack[-1]);
+	  $result=&Apache::run::evaluate($result,$safeeval,$extras.$$parstack[-1]);
 	} else {
-	  $result= &Apache::run::evaluate($result,$safeeval,'');
+	  $result= &Apache::run::evaluate($result,$safeeval,$extras);
 	}
       }
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
@@ -1322,7 +1314,7 @@ sub error {
 
 sub warning {
   $warningcount++;
-  if ($ENV{'request.state'} eq 'construct') {
+  if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
     print "<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";
   }
 }