I did something similar as a local customization for one site. They wanted to display the 880, but they didn't like the "Alternate Graphic Representation" label -- although that's the LC name for the field, they thought it wouldn't make sense to their patrons. I relabeled it in their OPAC as "Non-Roman Display" instead.
Jane Wagner Library Systems Analyst PTFS Inc. Content Management and Library Solutions 6400 Goldsboro Road, Suite 200 Bethesda, MD 20817 (301) 654-8088 x 151 [email protected] -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Heymans, Wolfgang Sent: Tuesday, September 01, 2009 4:53 AM To: [email protected] Subject: [Koha-patches] [PATCH] Bug 3567: Display Alternate GraphicRepresentation (MARC21 880) in OPAC --- .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 90 ++++++++++++++++++++ .../prog/en/xslt/MARC21slim2OPACResults.xsl | 43 +++++++++ .../opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 89 +++++++++++++++++++- 3 files changed, 221 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index 2e18e44..fe108e8 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -12,6 +12,10 @@ </xsl:template> <xsl:template match="marc:record"> + + <!-- Option: Display Alternate Graphic Representation (MARC 880) --> + <xsl:variable name="display880" select="boolean(marc:datafie...@tag=880])"/> + <xsl:variable name="leader" select="marc:leader"/> <xsl:variable name="leader6" select="substring($leader,7,1)"/> <xsl:variable name="leader7" select="substring($leader,8,1)"/> @@ -50,6 +54,16 @@ </xsl:variable> <!-- Title Statement --> + <!-- Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <h1 class="title"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">245</xsl:with-param> + <xsl:with-param name="codes">abhfgknps</xsl:with-param> + </xsl:call-template> + </h1> + </xsl:if> + <xsl:if test="marc:datafie...@tag=245]"> <h1> <xsl:for-each select="marc:datafie...@tag=245]"> @@ -75,6 +89,18 @@ </h1> </xsl:if> + <!-- Author Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <h5 class="author"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param> + <xsl:with-param name="codes">abc</xsl:with-param> + <xsl:with-param name="index">au</xsl:with-param> + <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 --> + </xsl:call-template> + </h5> + </xsl:if> + <xsl:choose> <xsl:when test="marc:datafie...@tag=100] or marc:datafie...@tag=110] or marc:datafie...@tag=111] or marc:datafie...@tag=700] or marc:datafie...@tag=710] or marc:datafie...@tag=711]"> <h5 class="author">by @@ -138,6 +164,18 @@ <xsl:value-of select="$materialTypeLabel"/> </span> </xsl:if> + + <!--Series: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">440,490</xsl:with-param> + <xsl:with-param name="codes">av</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Series: </xsl:with-param> + <xsl:with-param name="index">se</xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=440 or @tag=490]"> <span class="results_summary"><span class="label">Series: </span> <xsl:for-each select="marc:datafie...@tag=440]"> @@ -169,6 +207,17 @@ </xsl:for-each> </span> </xsl:if> + + <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">260</xsl:with-param> + <xsl:with-param name="codes">abcg</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Publisher: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=260]"> <span class="results_summary"><span class="label">Publisher: </span> <xsl:for-each select="marc:datafie...@tag=260]"> @@ -183,6 +232,17 @@ </xsl:for-each> </span> </xsl:if> + + <!-- Edition Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">250</xsl:with-param> + <xsl:with-param name="codes">ab</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Edition: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=250]"> <span class="results_summary"><span class="label">Edition: </span> <xsl:for-each select="marc:datafie...@tag=250]"> @@ -198,6 +258,16 @@ </span> </xsl:if> + <!-- Description: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">300</xsl:with-param> + <xsl:with-param name="codes">abceg</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Description: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=300]"> <span class="results_summary"><span class="label">Description: </span> <xsl:for-each select="marc:datafie...@tag=300]"> @@ -234,6 +304,16 @@ </span> </xsl:if> + <!-- Other Title Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">246</xsl:with-param> + <xsl:with-param name="codes">abhfgnp</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Other Title: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=246]"> <span class="results_summary"><span class="label">Other Title: </span> <xsl:for-each select="marc:datafie...@tag=246]"> @@ -249,6 +329,16 @@ </span> </xsl:if> + <!-- Uniform Title Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">130,240</xsl:with-param> + <xsl:with-param name="codes">adfklmor</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Uniform Title: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=130]|marc:datafie...@tag=240]|marc:datafield[@ tag=73...@ind2!=2]"> <span class="results_summary"><span class="label">Uniform titles: </span> <xsl:for-each select="marc:datafie...@tag=130]|marc:datafie...@tag=240]|marc:datafield [...@tag=730][@ind2!=2]"> diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index c28ce17..6b1b823 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -14,6 +14,10 @@ <xsl:apply-templates/> </xsl:template> <xsl:template match="marc:record"> + + <!-- Option: Display Alternate Graphic Representation (MARC 880) --> + <xsl:variable name="display880" select="boolean(marc:datafie...@tag=880])"/> + <xsl:variable name="leader" select="marc:leader"/> <xsl:variable name="leader6" select="substring($leader,7,1)"/> <xsl:variable name="leader7" select="substring($leader,8,1)"/> @@ -372,6 +376,16 @@ </xsl:for-each> --> </xsl:variable> + + <!-- Title Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">245</xsl:with-param> + <xsl:with-param name="codes">abh</xsl:with-param> + <xsl:with-param name="bibno"><xsl:value-of select="$biblionumber"/></xsl:with-param> + </xsl:call-template> + </xsl:if> + <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> <xsl:if test="marc:datafie...@tag=245]"> @@ -409,6 +423,15 @@ </a> <p> + <!-- Author Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param> + <xsl:with-param name="codes">abc</xsl:with-param> + <xsl:with-param name="class">term</xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:choose> <xsl:when test="marc:datafie...@tag=100] or marc:datafie...@tag=110] or marc:datafie...@tag=111] or marc:datafie...@tag=700] or marc:datafie...@tag=710] or marc:datafie...@tag=711]"> @@ -797,6 +820,16 @@ </xsl:if> </span> + <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">260</xsl:with-param> + <xsl:with-param name="codes">abcg</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Publisher: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=260]"> <span class="results_summary"> <span class="label">Publisher: </span> @@ -808,6 +841,16 @@ </span> </xsl:if> + <!-- Other Title Statement: Alternate Graphic Representation (MARC 880) --> + <xsl:if test="$display880"> + <xsl:call-template name="m880Select"> + <xsl:with-param name="basetags">246</xsl:with-param> + <xsl:with-param name="codes">ab</xsl:with-param> + <xsl:with-param name="class">results_summary</xsl:with-param> + <xsl:with-param name="label">Other Title: </xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="marc:datafie...@tag=246]"> <span class="results_summary"> <span class="label">Other title: </span> diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl index 917c10d..eed0e1f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl @@ -64,7 +64,94 @@ </xsl:choose> <xsl:text> </xsl:text> </xsl:template> -</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. + + + <!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags + - should be called immediately before the corresonding latin tags are processed + - tags in right-to-left languages are displayed floating right + * Parameter: + + basetags: display these tags if found in linkage section ( subfield 6) of tag 880 + + codes: display these subfields codes + * Options: + - class: wrap output in <span class="$class">...</span> + - label: prefix each(!) tag with label $label + - bibno: link to biblionumber $bibno + - index: build a search link using index $index with subfield $a as key; if subfield $9 is present use index 'an' with key $9 instead. + * Limitations: + - displays every field on a separate line (to switch between rtl and ltr) + * Pitfalls: + (!) output might be empty + --> + <xsl:template name="m880Select"> + <xsl:param name="basetags"/> <!-- e.g. 100,700,110,710 --> + <xsl:param name="codes"/> <!-- e.g. abc --> + <xsl:param name="class"/> <!-- e.g. results_summary --> + <xsl:param name="label"/> <!-- e.g. Edition --> + <xsl:param name="bibno"/> + <xsl:param name="index"/> <!-- e.g. au --> + + <xsl:for-each select="marc:datafie...@tag=880]"> + <xsl:variable name="code6" select="marc:subfie...@code=6]"/> + <xsl:if test="contains(string($basetags), substring($code6,1,3))"> + <span> + <xsl:if test="boolean($class)"> + <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> + </xsl:if> + <xsl:choose> + <!-- display right-to-left tags floating right of their left-to-right counterparts --> + <xsl:when test="substring($code6,10,2) ='/r'"> + <xsl:attribute name="style">display:block; text-align:right; float:right; width:50%; padding-left:20px</xsl:attribute> + <xsl:attribute name="dir">rtl</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style">display:block; </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="boolean($label)"> + <span class="label"> + <xsl:value-of select="$label"/> + </span> + </xsl:if> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="contains($codes, @code)"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:choose> + <xsl:when test="boolean($bibno)"> + <a> + <xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute> + <xsl:value-of select="$str"/> + </a> + </xsl:when> + <xsl:when test="boolean($index) and boolean(marc:subfie...@code=9])"> + <a> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfie...@code=9]"/></xsl:attribute> + <xsl:value-of select="$str"/> + </a> + </xsl:when> + <xsl:when test="boolean($index)"> + <a> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="$index"/>:<xsl:value-of select="marc:subfie...@code='a']"/></xsl:attribute> + <xsl:value-of select="$str"/> + </a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </span> + </xsl:if> + </xsl:for-each> + + </xsl:template> + +</xsl:stylesheet> + +<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. <metaInformation> <scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/> </metaInformation> -- 1.6.0.4 _______________________________________________ Koha-patches mailing list [email protected] http://lists.koha.org/mailman/listinfo/koha-patches
