Bug 5106: Tidy up code in opac-showmarc.pl

This commit is contained in:
Chris Cormack 2010-12-21 17:12:49 +13:00
parent 3f0eeb9c28
commit 1729177587

View file

@ -62,9 +62,16 @@ if ($importid) {
}
}
if ($view eq 'card' || $view eq 'html') {
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
my $xslfile;
if ($view eq 'card'){
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl";
$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 $xslt = XML::LibXSLT->new();
my $source = $parser->parse_string($xmlrecord);
@ -72,20 +79,6 @@ if ($view eq 'card') {
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
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;
exit;
} else {