Bug 5106: Tidy up code in opac-showmarc.pl
This commit is contained in:
parent
3f0eeb9c28
commit
1729177587
1 changed files with 10 additions and 17 deletions
|
@ -61,10 +61,17 @@ if ($importid) {
|
||||||
$xmlrecord = $record->as_xml();
|
$xmlrecord = $record->as_xml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($view eq 'card') {
|
|
||||||
|
if ($view eq 'card' || $view eq 'html') {
|
||||||
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
|
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
|
||||||
my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl";
|
my $xslfile;
|
||||||
|
if ($view eq 'card'){
|
||||||
|
$xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl";
|
||||||
|
}
|
||||||
|
else { # must be html
|
||||||
|
$xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl";
|
||||||
|
}
|
||||||
my $parser = XML::LibXML->new();
|
my $parser = XML::LibXML->new();
|
||||||
my $xslt = XML::LibXSLT->new();
|
my $xslt = XML::LibXSLT->new();
|
||||||
my $source = $parser->parse_string($xmlrecord);
|
my $source = $parser->parse_string($xmlrecord);
|
||||||
|
@ -72,20 +79,6 @@ if ($view eq 'card') {
|
||||||
my $stylesheet = $xslt->parse_stylesheet($style_doc);
|
my $stylesheet = $xslt->parse_stylesheet($style_doc);
|
||||||
my $results = $stylesheet->transform($source);
|
my $results = $stylesheet->transform($source);
|
||||||
my $newxmlrecord = $stylesheet->output_string($results);
|
my $newxmlrecord = $stylesheet->output_string($results);
|
||||||
#warn $newxmlrecord;
|
|
||||||
print $input->header(), $newxmlrecord;
|
|
||||||
exit;
|
|
||||||
} elsif ($view eq 'html'){
|
|
||||||
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
|
|
||||||
my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl";
|
|
||||||
my $parser = XML::LibXML->new();
|
|
||||||
my $xslt = XML::LibXSLT->new();
|
|
||||||
my $source = $parser->parse_string($xmlrecord);
|
|
||||||
my $style_doc = $parser->parse_file($xslfile);
|
|
||||||
my $stylesheet = $xslt->parse_stylesheet($style_doc);
|
|
||||||
my $results = $stylesheet->transform($source);
|
|
||||||
my $newxmlrecord = $stylesheet->output_string($results);
|
|
||||||
#warn $newxmlrecord;
|
|
||||||
print $input->header(), $newxmlrecord;
|
print $input->header(), $newxmlrecord;
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue