[open-ils-commits] SPAM: r10525 - in trunk/Open-ILS: examples
src/perlmods/OpenILS/Application/Search xsl
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 3 17:08:40 EDT 2008
Author: erickson
Date: 2008-09-03 17:08:35 -0400 (Wed, 03 Sep 2008)
New Revision: 10525
Added:
trunk/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl
Modified:
trunk/Open-ILS/examples/opensrf.xml.example
trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
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
Modified: trunk/Open-ILS/examples/opensrf.xml.example
===================================================================
--- trunk/Open-ILS/examples/opensrf.xml.example 2008-09-03 17:57:14 UTC (rev 10524)
+++ trunk/Open-ILS/examples/opensrf.xml.example 2008-09-03 21:08:35 UTC (rev 10525)
@@ -324,6 +324,7 @@
</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>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2008-09-03 17:57:14 UTC (rev 10524)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2008-09-03 21:08:35 UTC (rev 10525)
@@ -1208,20 +1208,37 @@
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 ) = @_;
+ my( $self, $client, $recordid, $slim ) = @_;
- 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" );
+ my $sheet;
+ my $dir = $settings_client->config_value( "dirs", "xsl" );
- $xsl = $parser->parse_file("$dir/$xsl");
- $marc_sheet = $xslt->parse_stylesheet( $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 @@
$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;
-
}
Added: trunk/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl
===================================================================
--- trunk/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl (rev 0)
+++ trunk/Open-ILS/xsl/oilsMARC21slim2HTMLslim.xsl 2008-09-03 21:08:35 UTC (rev 10525)
@@ -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;'>
+ ‡<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>
+-->
More information about the open-ils-commits
mailing list