matts 2005/08/09 10:50:35
Modified: lib/Apache/AxKit Provider.pm
lib/Apache/AxKit/Provider File.pm
Log:
Fix for relative URLs in xsl stylesheets when using file:/// URIs.
Revision Changes Path
1.23 +11 -7 xml-axkit/lib/Apache/AxKit/Provider.pm
Index: Provider.pm
===================================================================
RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Provider.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Provider.pm 9 Aug 2005 16:10:57 -0000 1.22
+++ Provider.pm 9 Aug 2005 17:50:35 -0000 1.23
@@ -154,6 +154,10 @@
}
+sub get_document_uri {
+ return shift->{apache}->uri();
+}
+
sub get_dom {
my $self = shift;
require Apache::AxKit::LibXMLSupport;
@@ -172,22 +176,22 @@
my $str;
if($str = $r->pnotes('xml_string')) {
use bytes;
- AxKit::Debug(8, "Provider::get_dom/parse_string($str, ",
$self->{apache}->uri(), ")");
- $xml_doc = $parser->parse_string($str, $self->{apache}->uri()) ||
+ AxKit::Debug(8, "Provider::get_dom/parse_string($str, ",
$self->get_document_uri(), ")");
+ $xml_doc = $parser->parse_string($str, $self->get_document_uri()) ||
throw Apache::AxKit::Exception::Error(
-text => "XML::LibXML->parse_string returned nothing!"
);
} else {
eval {
my $fh = $self->get_fh();
- AxKit::Debug(8, "Provider::get_dom/parse_fh($fh, ",
$self->{apache}->uri(), ")");
- $xml_doc = $parser->parse_fh($fh,
$self->{apache}->uri());
+ AxKit::Debug(8, "Provider::get_dom/parse_fh($fh, ",
$self->get_document_uri(), ")");
+ $xml_doc = $parser->parse_fh($fh,
$self->get_document_uri());
};
if ($@) {
use bytes;
my $xmlstring = ${$self->get_strref()};
- AxKit::Debug(8,
"Provider::get_dom/parse_string($xmlstring, ", $self->{apache}->uri(), ")");
- $xml_doc = $parser->parse_string($xmlstring,
$self->{apache}->uri()) ||
+ AxKit::Debug(8,
"Provider::get_dom/parse_string($xmlstring, ", $self->get_document_uri(), ")");
+ $xml_doc = $parser->parse_string($xmlstring,
$self->get_document_uri()) ||
throw Apache::AxKit::Exception::Error(
-text => "XML::LibXML->parse_string
returned nothing!"
);
1.20 +8 -1 xml-axkit/lib/Apache/AxKit/Provider/File.pm
Index: File.pm
===================================================================
RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Provider/File.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- File.pm 14 Jul 2005 18:43:35 -0000 1.19
+++ File.pm 9 Aug 2005 17:50:35 -0000 1.20
@@ -44,6 +44,7 @@
else {
if ($p{uri} and $p{uri} =~ s|^file:(//)?||) {
$p{file} = delete $p{uri};
+ $self->{protocol} = "file:$1";
}
if ($p{uri}) {
@@ -132,6 +133,12 @@
return;
}
+sub get_document_uri {
+ my $self = shift;
+ return $self->{protocol}.$self->{file} if ($self->{protocol});
+ return $self->SUPER::get_document_uri(@_);
+}
+
sub get_dir_xml {
my $self = shift;
my $r = AxKit::Apache->request;