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 170-193
sub get_biblio_marcxml {
Link Here
|
170 |
|
168 |
|
171 |
sub stylesheet { |
169 |
sub stylesheet { |
172 |
my ( $self, $format ) = @_; |
170 |
my ( $self, $format ) = @_; |
173 |
|
171 |
my $xsl_file = $self->{ conf } |
174 |
my $stylesheet = $self->{ koha_stylesheet }->{ $format }; |
172 |
? $self->{ conf }->{ format }->{ $format }->{ xsl_file } |
175 |
unless ( $stylesheet ) { |
173 |
: ( C4::Context->config('intrahtdocs') . |
176 |
my $xsl_file = $self->{ conf } |
174 |
'/prog/en/xslt/' . |
177 |
? $self->{ conf }->{ format }->{ $format }->{ xsl_file } |
175 |
C4::Context->preference('marcflavour') . |
178 |
: ( C4::Context->config('intrahtdocs') . |
176 |
'slim2OAIDC.xsl' |
179 |
'/prog/en/xslt/' . |
177 |
); |
180 |
C4::Context->preference('marcflavour') . |
178 |
return $xsl_file; |
181 |
'slim2OAIDC.xsl' ); |
|
|
182 |
$xsl_file || die( "No stylesheet found for $format" ); |
183 |
my $parser = XML::LibXML->new(); |
184 |
my $xslt = XML::LibXSLT->new(); |
185 |
my $style_doc = $parser->parse_file( $xsl_file ); |
186 |
$stylesheet = $xslt->parse_stylesheet( $style_doc ); |
187 |
$self->{ koha_stylesheet }->{ $format } = $stylesheet; |
188 |
} |
189 |
|
190 |
return $stylesheet; |
191 |
} |
179 |
} |
192 |
|
180 |
|
193 |
|
181 |
|
194 |
- |
|
|