Hi! I just had to hack up the ESQL Taglib to get a smarter float formating. The almost trivial patch introduces a "format" attribute to get-float and get-double which should be a suitable printf-style formating expression.
Patch attached Bets regards Olaf -- Olaf P�schel, Softwaretechnik, OLMOS Workstations GmbH, Germany Wolfenb�tteler Str. 31A, 38102 Braunschweig, Fon.: +49-531-22020-0 Fax: -99 OLMOS supports signed and/or encrypted mail. Grab my key at www.keyserver.net "Unix *is* user friendly. It's just a bit picky about its friends"
*** ESQL.pm.orig Wed Mar 27 10:42:50 2002
--- ESQL.pm Wed Mar 27 10:45:23 2002
***************
*** 249,255 ****
elsif ($tag eq 'column') {
return '$col = ""';
}
! elsif ($tag =~ /^get-(column|string|boolean|double|float|int|long|short)$/) {
$e->start_expr($tag);
my $code = '$col = ""; $ancestor = 0; $format = "";';
if (my $col = lc($attribs{column})) {
--- 249,255 ----
elsif ($tag eq 'column') {
return '$col = ""';
}
! elsif ($tag =~ /^get-(column|string|boolean|int|long|short)$/) {
$e->start_expr($tag);
my $code = '$col = ""; $ancestor = 0; $format = "";';
if (my $col = lc($attribs{column})) {
***************
*** 270,275 ****
--- 270,287 ----
$code .= '$ancestor = ' . ($attribs{ancestor} || 0) . ';';
return $code;
}
+ elsif ($tag =~ /^get-(float|double)$/) {
+ $e->start_expr($tag);
+ my $code = '$col = ""; $ancestor = 0; $format = "%e";';
+ if (my $col = lc($attribs{column})) {
+ $code .= '$col = q|' . $col . '|;';
+ }
+ if (my $format = $attribs{format}) {
+ $code .= '$format = q|' . $format . '|;';
+ }
+ $code .= '$ancestor = ' . ($attribs{ancestor} || 0) . ';';
+ return $code;
+ }
elsif ($tag eq 'get-xml') {
$e->{XSP_encoding} = $attribs{encoding} || 'UTF-8';
my $code = '$col = ""; $ancestor = 0; $format = "";';
***************
*** 424,430 ****
return '';
}
elsif ($tag =~ /^get-(double|float)$/) {
! $e->append_to_script('sprintf("%e", AxKit::XSP::ESQL::get_column($col,
$ancestor))');
$e->end_expr();
return '';
}
--- 436,442 ----
return '';
}
elsif ($tag =~ /^get-(double|float)$/) {
! $e->append_to_script('sprintf($format, AxKit::XSP::ESQL::get_column($col,
$ancestor))');
$e->end_expr();
return '';
}
msg00852/pgp00000.pgp
Description: PGP signature
