+ } elsif ($http_method eq 'GET' and $http_path eq "/getxslt") {
+
+ $url = $xslt_map{$inputuri};
+ print "Downloading XSLT ...\n";
+ helm_wget($tmp_dir, $url);
+ print "XSLT downloaded!\n";
+ $inputuri =~ s/.*\///;
+ my $filename = $tmp_dir . "/" . $inputuri;
+ my $cont;
+ die "Could not find XSLT!\n" unless stat($filename);
+ open(FD, $filename) or die "Can't open xslt local copy: '$filename'\n";
+ while(<FD>) {
+ s/xsl:import\s+href="/xsl:import href="$myownurl\/getxslt?uri=/g;
+ s/xsl:include\s+href="/xsl:include href="$myownurl\/getxslt?uri=/g;
+ $cont .= $_;
+ }
+ close(FD);
+ answer($c, $cont, "text/xml", "");
+ unlink $filename or
+ print "Can't unlink XSLT temp file '$filename'";
+
+# <old_version>
+# my $filename = $inputuri;
+# $filename = $style_dir."/".$filename;
+# print "XSLT: $inputuri ==> ($filename)\n";
+# if (stat($filename)) {
+# print "Using local copy\n";
+# open(FD, $filename) or die "Cannot open $filename\n";
+# $cont = "";
+# while(<FD>) {
+# # Vary bad heuristic for substituion of absolute URLs
+# # for relative ones
+# s/xsl:import\s+href="/xsl:import href="$myownurl\/getxslt?uri=/g ;
+# s/xsl:include\s+href="/xsl:include href="$myownurl\/getxslt?uri=/g ;
+# $cont .= $_;
+# }
+# close(FD);
+# answer($c,$cont,"text/xml","");
+# } else {
+# die "Could not find XSLT!";
+# }
+# </old_version>
+