Lines 32-44
use Koha::OAI::Server::GetRecord;
Link Here
|
32 |
use Koha::OAI::Server::ListRecords; |
32 |
use Koha::OAI::Server::ListRecords; |
33 |
use Koha::OAI::Server::ListIdentifiers; |
33 |
use Koha::OAI::Server::ListIdentifiers; |
34 |
use XML::SAX::Writer; |
34 |
use XML::SAX::Writer; |
35 |
use XML::LibXML; |
|
|
36 |
use XML::LibXSLT; |
37 |
use YAML::Syck qw( LoadFile ); |
35 |
use YAML::Syck qw( LoadFile ); |
38 |
use CGI qw/:standard -oldstyle_urls/; |
36 |
use CGI qw/:standard -oldstyle_urls/; |
39 |
use C4::Context; |
37 |
use C4::Context; |
40 |
use C4::Biblio; |
38 |
use C4::Biblio; |
41 |
|
39 |
use Koha::XSLT_Handler; |
42 |
|
40 |
|
43 |
=head1 NAME |
41 |
=head1 NAME |
44 |
|
42 |
|
Lines 106-112
sub new {
Link Here
|
106 |
$self->{ koha_identifier } = C4::Context->preference("OAI-PMH:archiveID"); |
104 |
$self->{ koha_identifier } = C4::Context->preference("OAI-PMH:archiveID"); |
107 |
$self->{ koha_max_count } = C4::Context->preference("OAI-PMH:MaxCount"); |
105 |
$self->{ koha_max_count } = C4::Context->preference("OAI-PMH:MaxCount"); |
108 |
$self->{ koha_metadata_format } = ['oai_dc', 'marc21', 'marcxml']; |
106 |
$self->{ koha_metadata_format } = ['oai_dc', 'marc21', 'marcxml']; |
109 |
$self->{ koha_stylesheet } = { }; # Build when needed |
107 |
$self->{ xslt_engine } = Koha::XSLT_Handler->new; |
110 |
|
108 |
|
111 |
# Load configuration file if defined in OAI-PMH:ConfFile syspref |
109 |
# Load configuration file if defined in OAI-PMH:ConfFile syspref |
112 |
if ( my $file = C4::Context->preference("OAI-PMH:ConfFile") ) { |
110 |
if ( my $file = C4::Context->preference("OAI-PMH:ConfFile") ) { |
Lines 167-190
sub get_biblio_marcxml {
Link Here
|
167 |
|
165 |
|
168 |
sub stylesheet { |
166 |
sub stylesheet { |
169 |
my ( $self, $format ) = @_; |
167 |
my ( $self, $format ) = @_; |
170 |
|
168 |
my $xsl_file = $self->{ conf } |
171 |
my $stylesheet = $self->{ koha_stylesheet }->{ $format }; |
169 |
? $self->{ conf }->{ format }->{ $format }->{ xsl_file } |
172 |
unless ( $stylesheet ) { |
170 |
: ( C4::Context->config('intrahtdocs') . |
173 |
my $xsl_file = $self->{ conf } |
171 |
'/prog/en/xslt/' . |
174 |
? $self->{ conf }->{ format }->{ $format }->{ xsl_file } |
172 |
C4::Context->preference('marcflavour') . |
175 |
: ( C4::Context->config('intrahtdocs') . |
173 |
'slim2OAIDC.xsl' |
176 |
'/prog/en/xslt/' . |
174 |
); |
177 |
C4::Context->preference('marcflavour') . |
175 |
return $xsl_file; |
178 |
'slim2OAIDC.xsl' ); |
|
|
179 |
$xsl_file || die( "No stylesheet found for $format" ); |
180 |
my $parser = XML::LibXML->new(); |
181 |
my $xslt = XML::LibXSLT->new(); |
182 |
my $style_doc = $parser->parse_file( $xsl_file ); |
183 |
$stylesheet = $xslt->parse_stylesheet( $style_doc ); |
184 |
$self->{ koha_stylesheet }->{ $format } = $stylesheet; |
185 |
} |
186 |
|
187 |
return $stylesheet; |
188 |
} |
176 |
} |
189 |
|
177 |
|
190 |
|
178 |
|
191 |
- |
|
|