View | Details | Raw Unified | Return to bug 12172
Collapse All | Expand All

(-)a/C4/XSLT.pm (-18 / +9 lines)
Lines 33-39 use C4::Reserves; Link Here
33
use Encode;
33
use Encode;
34
use XML::LibXML;
34
use XML::LibXML;
35
use XML::LibXSLT;
35
use XML::LibXSLT;
36
use LWP::Simple;
36
use LWP::UserAgent;
37
37
38
use vars qw($VERSION @ISA @EXPORT);
38
use vars qw($VERSION @ISA @EXPORT);
39
39
Lines 43-49 BEGIN { Link Here
43
    @ISA = qw(Exporter);
43
    @ISA = qw(Exporter);
44
    @EXPORT = qw(
44
    @EXPORT = qw(
45
        &XSLTParse4Display
45
        &XSLTParse4Display
46
        &GetURI
47
    );
46
    );
48
}
47
}
49
48
Lines 53-71 C4::XSLT - Functions for displaying XSLT-generated content Link Here
53
52
54
=head1 FUNCTIONS
53
=head1 FUNCTIONS
55
54
56
=head2 GetURI
57
58
GetURI file and returns the xslt as a string
59
60
=cut
61
62
sub GetURI {
63
    my ($uri) = @_;
64
    my $string;
65
    $string = get $uri ;
66
    return $string;
67
}
68
69
=head2 transformMARCXML4XSLT
55
=head2 transformMARCXML4XSLT
70
56
71
Replaces codes with authorized values in a MARC::Record object
57
Replaces codes with authorized values in a MARC::Record object
Lines 229-236 sub XSLTParse4Display { Link Here
229
        my $xslt = XML::LibXSLT->new();
215
        my $xslt = XML::LibXSLT->new();
230
        my $style_doc;
216
        my $style_doc;
231
        if ( $xslfilename =~ /^https?:\/\// ) {
217
        if ( $xslfilename =~ /^https?:\/\// ) {
232
            my $xsltstring = GetURI($xslfilename);
218
	    my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } );
233
            $style_doc = $parser->parse_string($xsltstring);
219
	    my $response = $ua->get($xslfilename);
220
	    if ( $response->is_success ) {
221
		my $xsltstring = $response->decoded_content;
222
                $style_doc = $parser->parse_string($xsltstring);
223
	    } else {
224
		warn "Cannot fetch remote XSLT file";
225
	    }  
234
        } else {
226
        } else {
235
            use Cwd;
227
            use Cwd;
236
            $style_doc = $parser->parse_file($xslfilename);
228
            $style_doc = $parser->parse_file($xslfilename);
237
- 

Return to bug 12172