added an alternate marc2html stylesheet which only outputs a div instead of a full...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Sep 2008 21:08:35 +0000 (21:08 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Sep 2008 21:08:35 +0000 (21:08 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10525 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/opensrf.xml.example
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl [new file with mode: 0644]

index 5a37c57..764ee48 100644 (file)
@@ -324,6 +324,7 @@ vim:et:ts=4:sw=4:
                 </unix_config>
                 <app_settings>
                     <marc_html_xsl>oilsMARC21slim2HTML.xsl</marc_html_xsl>
+                                       <marc_html_xsl_slim>oilsMARC21slim2HTMLslim.xsl</marc_html_xsl_slim>
 
                     <!-- Default to using staged search -->
                     <use_staged_search>true</use_staged_search>
index c1a01c9..1a5ea6d 100644 (file)
@@ -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 (file)
index 0000000..7b694fd
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+       <xsl:output method="text"/>
+       
+       <xsl:template match="/">
+        <div>
+            <xsl:apply-templates/>
+        </div>
+       </xsl:template>
+       
+       <xsl:template match="marc:record">
+               <table class='marc_table'>
+                       <tr class='marc_tag_row'>
+                               <th class='marc_tag_col' NOWRAP="TRUE" ALIGN="RIGHT" VALIGN="middle">
+                                       LDR
+                               </th>
+                               <td class='marc_tag_data' COLSPAN='3'>
+                                       <xsl:value-of select="marc:leader"/>
+                               </td>
+                       </tr>
+                       <xsl:apply-templates select="marc:datafield|marc:controlfield"/>
+               </table>
+       </xsl:template>
+       
+       <xsl:template match="marc:controlfield">
+               <tr class='marc_tag_row'>
+                       <th class='marc_tag_col' NOWRAP="TRUE" ALIGN="RIGHT" VALIGN="middle">
+                               <xsl:value-of select="@tag"/>
+                       </th>
+                       <td class='marc_tag_data' COLSPAN='3'>
+                               <xsl:value-of select="."/>
+                       </td>
+               </tr>
+       </xsl:template>
+       
+       <xsl:template match="marc:datafield">
+               <tr class='marc_tag_row'>
+                       <th class='marc_tag_col' NOWRAP="TRUE" ALIGN="RIGHT" VALIGN="middle">
+                               <xsl:value-of select="@tag"/>
+                       </th>
+                       <td class='marc_tag_ind'>
+                               <xsl:value-of select="@ind1"/>
+                       </td>
+
+                       <td class='marc_tag_ind' style='border-left: 1px solid #A0A0A0; padding-left: 3px;'>
+                               <xsl:value-of select="@ind2"/>
+                               <span style='color:#FFF'>.</span> 
+                       </td>
+
+                       <td class='marc_subfields'>
+                               <xsl:apply-templates select="marc:subfield"/>
+                       </td>
+               </tr>
+       </xsl:template>
+       
+       <xsl:template match="marc:subfield">
+               <span style='color: blue;padding-left: 5px;padding-right: 5px;'> 
+                       &#8225;<xsl:value-of select="@code"/>
+               </span><xsl:value-of select="."/>       
+       </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
+<metaInformation>
+<scenarios ><scenario default="no" name="Ray Charles" userelativepaths="yes" externalpreview="no" url="..\xml\MARC21slim\raycharles.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="s7" userelativepaths="yes" externalpreview="no" url="..\ifla\sally7.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
+</metaInformation>
+-->