|
Lines 542-551
sub handle_one_result {
Link Here
|
| 542 |
$hServer[$conn]->{syntax}); |
542 |
$hServer[$conn]->{syntax}); |
| 543 |
} |
543 |
} |
| 544 |
else { #z3950 |
544 |
else { #z3950 |
| 545 |
($marcrecord)= MarcToUTF8Record($rec->raw(), |
545 |
if ($hServer[$conn]->{encoding} eq 'utf8'){ |
| 546 |
marcflavour_from_syntax($conn), $hServer[$conn]->{encoding}); |
546 |
$marcrecord= MARC::Record->new_from_usmarc($rec->raw()); |
|
|
547 |
C4::Charset::SetUTF8Flag $marcrecord; |
| 548 |
}else{ |
| 549 |
($marcrecord) = MarcToUTF8Record($rec->raw(), marcflavour_from_syntax($conn), $hServer[$conn]->{encoding}) |
| 550 |
} |
| 547 |
} |
551 |
} |
| 548 |
$marcrecord->encoding('UTF-8'); #force UTF-8 |
552 |
|
| 549 |
#convert to system marc flavour and/or additional xslt proc. |
553 |
#convert to system marc flavour and/or additional xslt proc. |
| 550 |
$marcrecord= do_xslt_processing($conn, $marcrecord); |
554 |
$marcrecord= do_xslt_processing($conn, $marcrecord); |
| 551 |
|
555 |
|
|
Lines 570-584
sub do_xslt_processing {
Link Here
|
| 570 |
my ($conn, $marcrecord)= @_; |
574 |
my ($conn, $marcrecord)= @_; |
| 571 |
my ($res, $newmarcrec, $parser, $style_doc, $stylesheet); |
575 |
my ($res, $newmarcrec, $parser, $style_doc, $stylesheet); |
| 572 |
|
576 |
|
| 573 |
if($hServer[$conn]->{marc_conv} && defined $xsltconv) { |
577 |
if($hServer[$conn]->{add_xslt}) { #server specific xslt proc |
| 574 |
$parser = XML::LibXML->new(); |
|
|
| 575 |
$res= $parser->parse_string($marcrecord->as_xml()); |
| 576 |
$res= $xsltconv->transform($res); |
| 577 |
$res= $xsltconv->output_string($res); |
| 578 |
$newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8'); |
| 579 |
} |
| 580 |
|
| 581 |
if($hServer[$conn]->{add_xslt}) { #server specific xslt proc |
| 582 |
$res= $newmarcrec? $newmarcrec->as_xml(): $marcrecord->as_xml(); |
578 |
$res= $newmarcrec? $newmarcrec->as_xml(): $marcrecord->as_xml(); |
| 583 |
$parser = XML::LibXML->new() unless $parser; |
579 |
$parser = XML::LibXML->new() unless $parser; |
| 584 |
$res= $parser->parse_string($res); |
580 |
$res= $parser->parse_string($res); |
|
Lines 595-600
sub do_xslt_processing {
Link Here
|
| 595 |
warn "z3950_search: XSLT problem with ".$hServer[$conn]->{add_xslt}; |
591 |
warn "z3950_search: XSLT problem with ".$hServer[$conn]->{add_xslt}; |
| 596 |
} |
592 |
} |
| 597 |
} |
593 |
} |
|
|
594 |
|
| 595 |
if( not $newmarcrec and $hServer[$conn]->{marc_conv} and defined $xsltconv) { |
| 596 |
$parser = XML::LibXML->new(); |
| 597 |
$res= $parser->parse_string($marcrecord->as_xml()); |
| 598 |
$res= $xsltconv->transform($res); |
| 599 |
$res= $xsltconv->output_string($res); |
| 600 |
|
| 601 |
$newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8'); |
| 602 |
} |
| 603 |
|
| 598 |
return $newmarcrec // $marcrecord; |
604 |
return $newmarcrec // $marcrecord; |
| 599 |
} |
605 |
} |
| 600 |
|
606 |
|