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

(-)a/C4/Record.pm (-10 / +2 lines)
Lines 28-38 use MARC::File::XML; # marc2marcxml, marcxml2marc, changeEncoding Link Here
28
use MARC::Crosswalk::DublinCore; # marc2dcxml
28
use MARC::Crosswalk::DublinCore; # marc2dcxml
29
use Biblio::EndnoteStyle;
29
use Biblio::EndnoteStyle;
30
use Unicode::Normalize; # _entity_encode
30
use Unicode::Normalize; # _entity_encode
31
use XML::LibXSLT;
32
use XML::LibXML;
33
use C4::Biblio; #marc2bibtex
31
use C4::Biblio; #marc2bibtex
34
use C4::Csv; #marc2csv
32
use C4::Csv; #marc2csv
35
use C4::Koha; #marc2csv
33
use C4::Koha; #marc2csv
34
use C4::XSLT ();
36
use YAML; #marcrecords2csv
35
use YAML; #marcrecords2csv
37
use Text::CSV::Encoded; #marc2csv
36
use Text::CSV::Encoded; #marc2csv
38
37
Lines 306-319 sub _transformWithStylesheet { Link Here
306
    # grab the XML, run it through our stylesheet, push it out to the browser
305
    # grab the XML, run it through our stylesheet, push it out to the browser
307
    my $xmlrecord = marc2marcxml($marc);
306
    my $xmlrecord = marc2marcxml($marc);
308
    my $xslfile = C4::Context->config('intrahtdocs') . $stylesheet;
307
    my $xslfile = C4::Context->config('intrahtdocs') . $stylesheet;
309
    my $parser = XML::LibXML->new();
308
    return C4::XSLT::engine->transform($xmlrecord, $xslfile);
310
    my $xslt = XML::LibXSLT->new();
311
    my $source = $parser->parse_string($xmlrecord);
312
    my $style_doc = $parser->parse_file($xslfile);
313
    my $style_sheet = $xslt->parse_stylesheet($style_doc);
314
    my $results = $style_sheet->transform($source);
315
    my $newxmlrecord = $style_sheet->output_string($results);
316
    return ($newxmlrecord);
317
}
309
}
318
310
319
sub marc2endnote {
311
sub marc2endnote {
(-)a/catalogue/cardview.pl (-60 lines)
Lines 1-60 Link Here
1
#!/usr/bin/perl
2
use strict;
3
# parts copyright 2010 BibLibre
4
# This file is part of Koha
5
#
6
# Koha is free software; you can redistribute it and/or modify it under the
7
# terms of the GNU General Public License as published by the Free Software
8
# Foundation; either version 2 of the License, or (at your option) any later
9
# version.
10
#
11
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License along
16
# with Koha; if not, write to the Free Software Foundation, Inc.,
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19
#use warnings; FIXME - Bug 2505
20
21
use CGI;
22
use XML::LibXSLT;
23
use XML::LibXML;
24
use C4::Koha;
25
use C4::Auth;
26
use C4::Biblio;
27
use C4::Languages qw(getTranslatedLanguages);
28
29
my $query=new CGI;
30
my ($template, $borrowernumber, $cookie) 
31
    = get_template_and_user({template_name => "opac-detail.tmpl",
32
			     query => $query,
33
			     type => "opac",
34
			     authnotrequired => 1,
35
			     flagsrequired => {borrow => 1},
36
			     });
37
38
# load the languages
39
my @languages_options = getTranslatedLanguages($query);
40
my $languages_count = @languages_options;
41
if($languages_count > 1){
42
        $template->param(languages => \@languages_options);
43
}
44
my $biblionumber=$query->param('biblionumber');
45
$template->param(biblionumber => $biblionumber);
46
47
# grab the XML, run it through our stylesheet, push it out to the browser
48
my $xmlrecord = GetXmlBiblio($biblionumber);
49
#my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2HTML.xsl";
50
#my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2English.xsl";
51
my $xslfile = C4::Context->config('intranetdir')."/koha-tmpl/intranet-tmpl/prog/en/xslt/compact.xsl";
52
my $parser = XML::LibXML->new();
53
my $xslt = XML::LibXSLT->new();
54
my $source = $parser->parse_string($xmlrecord);
55
my $style_doc = $parser->parse_file($xslfile);
56
my $stylesheet = $xslt->parse_stylesheet($style_doc);
57
my $results = $stylesheet->transform($source);
58
my $newxmlrecord = $stylesheet->output_string($results);
59
print "Content-type: text/html\n\n";
60
print $newxmlrecord;
(-)a/catalogue/showmarc.pl (-10 / +3 lines)
Lines 9-15 Link Here
9
#
9
#
10
# Koha is free software; you can redistribute it and/or modify it under the
10
# Koha is free software; you can redistribute it and/or modify it under the
11
# terms of the GNU General Public License as published by the Free Software
11
# terms of the GNU General Public License as published by the Free Software
12
# Foundation; either version 2 of the License, or (at your option) any later
12
# Foundation; either version 3 of the License, or (at your option) any later
13
# version.
13
# version.
14
#
14
#
15
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
Lines 34-41 use C4::Output; Link Here
34
use C4::Auth;
34
use C4::Auth;
35
use C4::Biblio;
35
use C4::Biblio;
36
use C4::ImportBatch;
36
use C4::ImportBatch;
37
use XML::LibXSLT;
37
use C4::XSLT ();
38
use XML::LibXML;
39
38
40
my $input= new CGI;
39
my $input= new CGI;
41
my $biblionumber= $input->param('id');
40
my $biblionumber= $input->param('id');
Lines 63-75 if($view eq 'card') { Link Here
63
    if ( ! -f $xslfile && $themelang ne '/en' ) {
62
    if ( ! -f $xslfile && $themelang ne '/en' ) {
64
        $xslfile=~s#$themelang#/en#;
63
        $xslfile=~s#$themelang#/en#;
65
    }
64
    }
66
    my $parser       = XML::LibXML->new();
65
    my $newxmlrecord = C4::XSLT::engine->transform($xmlrecord, $xslfile);
67
    my $xslt         = XML::LibXSLT->new();
68
    my $source       = $parser->parse_string($xmlrecord);
69
    my $style_doc    = $parser->parse_file($xslfile);
70
    my $stylesheet   = $xslt->parse_stylesheet($style_doc);
71
    my $results      = $stylesheet->transform($source);
72
    my $newxmlrecord = $stylesheet->output_string($results);
73
    print $input->header(-charset => 'UTF-8'), Encode::encode_utf8($newxmlrecord);
66
    print $input->header(-charset => 'UTF-8'), Encode::encode_utf8($newxmlrecord);
74
}
67
}
75
else {
68
else {
(-)a/opac/opac-showmarc.pl (-17 / +3 lines)
Lines 1-19 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# $Id: showmarc.pl,v 1.1.2.1 2007/06/18 21:57:23 rangi Exp $
4
5
6
# Koha library project  www.koha-community.org
7
8
# Licensed under the GPL
9
10
# Copyright 2007 Liblime
3
# Copyright 2007 Liblime
11
#
4
#
12
# This file is part of Koha.
5
# This file is part of Koha.
13
#
6
#
14
# Koha is free software; you can redistribute it and/or modify it under the
7
# Koha is free software; you can redistribute it and/or modify it under the
15
# terms of the GNU General Public License as published by the Free Software
8
# terms of the GNU General Public License as published by the Free Software
16
# Foundation; either version 2 of the License, or (at your option) any later
9
# Foundation; either version 3 of the License, or (at your option) any later
17
# version.
10
# version.
18
#
11
#
19
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
Lines 37-44 use C4::Output; Link Here
37
use C4::Auth;
30
use C4::Auth;
38
use C4::Biblio;
31
use C4::Biblio;
39
use C4::ImportBatch;
32
use C4::ImportBatch;
40
use XML::LibXSLT;
33
use C4::XSLT ();
41
use XML::LibXML;
42
34
43
my $input       = new CGI;
35
my $input       = new CGI;
44
my $biblionumber = $input->param('id');
36
my $biblionumber = $input->param('id');
Lines 78-90 if ($view eq 'card' || $view eq 'html') { Link Here
78
    $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( -f $xslfile );
70
    $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( -f $xslfile );
79
    $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );
71
    $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );
80
72
81
    my $parser = XML::LibXML->new();
73
    my $newxmlrecord = C4::XSLT::engine->transform($xmlrecord, $xslfilename);
82
    my $xslt   = XML::LibXSLT->new();
83
    my $source = $parser->parse_string($xmlrecord);
84
    my $style_doc = $parser->parse_file($xslfilename);
85
    my $stylesheet = $xslt->parse_stylesheet($style_doc);
86
    my $results = $stylesheet->transform($source);
87
    my $newxmlrecord = $stylesheet->output_string($results);
88
    print $input->header(-charset => 'UTF-8'), Encode::encode_utf8($newxmlrecord);
74
    print $input->header(-charset => 'UTF-8'), Encode::encode_utf8($newxmlrecord);
89
}
75
}
90
else { #view eq marc
76
else { #view eq marc
(-)a/t/db_dependent/Record.t (-2 / +1 lines)
Lines 81-87 my $test4xml=qq(<?xml version="1.0" encoding="UTF-8"?> Link Here
81
</mods>
81
</mods>
82
);
82
);
83
83
84
is ($mods, $test4xml, "testing marc2mosxml");
84
is ($mods, $test4xml, "testing marc2modsxml");
85
85
86
$marc->append_fields(MARC::Field->new(
86
$marc->append_fields(MARC::Field->new(
87
    '100', ' ', ' ', a => 'Rowling, J.K.'
87
    '100', ' ', ' ', a => 'Rowling, J.K.'
88
- 

Return to bug 11826