From 834c17e340d1aed15274546261de2c30c1e67cd3 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 3 Sep 2008 21:08:35 +0000 Subject: [PATCH] added an alternate marc2html stylesheet which only outputs a div instead of a full html document. falls back to the old style if slim is selected but no slim xsl is configured git-svn-id: svn://svn.open-ils.org/ILS/trunk@10525 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/opensrf.xml.example | 1 + .../OpenILS/Application/Search/Biblio.pm | 42 ++++++++---- Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl | 68 +++++++++++++++++++ 3 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl diff --git a/Open-ILS/examples/opensrf.xml.example b/Open-ILS/examples/opensrf.xml.example index 5a37c57de4..764ee48bb8 100644 --- a/Open-ILS/examples/opensrf.xml.example +++ b/Open-ILS/examples/opensrf.xml.example @@ -324,6 +324,7 @@ vim:et:ts=4:sw=4: oilsMARC21slim2HTML.xsl + oilsMARC21slim2HTMLslim.xsl true diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index c1a01c9d6c..1a5ea6dfb5 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -1208,20 +1208,37 @@ __PACKAGE__->register_method( my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $marc_sheet; +my $slim_marc_sheet; my $settings_client = OpenSRF::Utils::SettingsClient->new(); sub biblio_record_to_marc_html { - my( $self, $client, $recordid ) = @_; - - if( !$marc_sheet ) { - my $dir = $settings_client->config_value( "dirs", "xsl" ); - my $xsl = $settings_client->config_value( - "apps", "open-ils.search", "app_settings", "marc_html_xsl" ); - - $xsl = $parser->parse_file("$dir/$xsl"); - $marc_sheet = $xslt->parse_stylesheet( $xsl ); - } + my( $self, $client, $recordid, $slim ) = @_; + + my $sheet; + my $dir = $settings_client->config_value( "dirs", "xsl" ); + + if($slim) { + unless($slim_marc_sheet) { + my $xsl = $settings_client->config_value( + "apps", "open-ils.search", "app_settings", 'marc_html_xsl_slim'); + if($xsl) { + $xsl = $parser->parse_file("$dir/$xsl"); + $slim_marc_sheet = $xslt->parse_stylesheet( $xsl ); + } + } + $sheet = $slim_marc_sheet; + } + unless($sheet) { + unless($marc_sheet) { + my $xsl_key = ($slim) ? 'marc_html_xsl_slim' : 'marc_html_xsl'; + my $xsl = $settings_client->config_value( + "apps", "open-ils.search", "app_settings", 'marc_html_xsl' ); + $xsl = $parser->parse_file("$dir/$xsl"); + $marc_sheet = $xslt->parse_stylesheet( $xsl ); + } + $sheet = $marc_sheet; + } my $record = $apputils->simple_scalar_request( "open-ils.cstore", @@ -1229,10 +1246,9 @@ sub biblio_record_to_marc_html { $recordid ); my $xmldoc = $parser->parse_string($record->marc); - my $html = $marc_sheet->transform($xmldoc); - $html = $html->toString(); + my $html = $sheet->transform($xmldoc); + $html = $html->documentElement->toString(); return $html; - } diff --git a/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl b/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl new file mode 100644 index 0000000000..7b694fdbac --- /dev/null +++ b/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl @@ -0,0 +1,68 @@ + + + + + +
+ +
+
+ + + + + + + + +
+ LDR + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + ‡ + + + +
+ + -- 2.43.2