[Koha-patches] [PATCH] Bug 13382: RDA 700s
Nicole C. Engard
nengard at bywatersolutions.com
Thu Jan 29 21:26:01 CET 2015
From: Winona Salesky <wsalesky at gmail.com>
This patch updates the visibility of the 7xx fields in the
XSLT display in the staff and OPAC.
To test:
* Search the opac for a title with 7xx fields
* Click the title
* Make sure the fields display properly
* Repeat for a few more titles
* Repeat in the Staff Client
---
.../prog/en/xslt/MARC21slim2intranetDetail.xsl | 198 ++++++++++++++++++--
.../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 110 +++++++++---
2 files changed, 263 insertions(+), 45 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
index f96c0eb..b0d3995 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
@@ -3,6 +3,7 @@
<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
<!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
+<!-- Edited: Bug 13382 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky at gmail.com -->
<xsl:stylesheet version="1.0"
xmlns:marc="http://www.loc.gov/MARC21/slim"
xmlns:items="http://www.koha-community.org/items"
@@ -140,9 +141,17 @@
</xsl:if>
<!-- Author Statement -->
- <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
- <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
-
+ <!-- #13382 suppress 700$i and 7xx/@ind2=2 -->
+ <xsl:call-template name="showAuthor">
+ <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
+ <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
+ </xsl:call-template>
+ <xsl:call-template name="showAuthor">
+ <!-- #13382 suppress 700$i and 7xx/@ind2=2 -->
+ <xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711][not(@ind2=2)][not(marc:subfield[@code='i'][parent::marc:datafield[@tag='700']])]"/>
+ <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
+ </xsl:call-template>
+
<xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
<span class="results_summary type"><span class="label">Material type: </span>
<xsl:element name="img"><xsl:attribute name="src">/intranet-tmpl/prog/img/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
@@ -524,7 +533,115 @@
</xsl:for-each>
</span>
</xsl:if>
-
+
+ <!-- #13382 Added Related works 700$i -->
+ <xsl:if test="marc:datafield[@tag=700][marc:subfield[@code='i']]">
+ <span class="results_summary related_works"><span class="label">Related Works: </span>
+ <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='i']]">
+ <xsl:variable name="str">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdfghiklmorstux</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <!-- add relator code too between brackets-->
+ <xsl:if test="marc:subfield[@code='4' or @code='e']">
+ <span class="relatorcode">
+ <xsl:text> [</xsl:text>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='e']">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">e</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">4</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>]</xsl:text>
+ </span>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text> -- </xsl:text></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
+ <!-- #13382 Added Contained Works 7xx at ind2=2 -->
+ <xsl:if test="marc:datafield[@tag=700][@ind2=2] or marc:datafield[@tag=710][@ind2=2] or marc:datafield[@tag=711][@ind2=2]">
+ <span class="results_summary contained_works"><span class="label">Contained Works: </span>
+ <xsl:for-each select="marc:datafield[@tag=700][@ind2=2][not(marc:subfield[@code='i'])] | marc:datafield[@tag=710][@ind2=2][not(marc:subfield[@code='i'])] | marc:datafield[@tag=711][@ind2=2][not(marc:subfield[@code='i'])]">
+ <xsl:variable name="str">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdfghiklmorstux</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <!-- add relator code too between brackets-->
+ <xsl:if test="marc:subfield[@code='4' or @code='e']">
+ <span class="relatorcode">
+ <xsl:text> [</xsl:text>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='e']">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">e</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">4</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>]</xsl:text>
+ </span>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </span>
+ </xsl:if>
+
<xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
<span class="results_summary subjects"><span class="label">Subject(s): </span>
<xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
@@ -949,7 +1066,8 @@
<xsl:choose>
<xsl:when test="position()>1"/>
<xsl:when test="@tag<700">Author(s): </xsl:when>
- <xsl:otherwise>Additional author(s): </xsl:otherwise>
+ <!--#13382 Changed Additional author to contributor -->
+ <xsl:otherwise>Contributor(s): </xsl:otherwise>
</xsl:choose>
<a>
<xsl:choose>
@@ -961,24 +1079,66 @@
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
- <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCQ"/></xsl:when>
- <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
- <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
+ <xsl:when test="@tag=100"><xsl:call-template name="nameABCQ"/></xsl:when>
+ <xsl:when test="@tag=110"><xsl:call-template name="nameABCDN"/></xsl:when>
+ <xsl:when test="@tag=111"><xsl:call-template name="nameACDEQ"/></xsl:when>
+ <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
+ <!--#13382 Added all relevant subfields 4, e, are handled separately -->
+ <xsl:when test="@tag=700 or @tag=710 or @tag=711">
+ <xsl:variable name="str">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdfghiklmnoprstux</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="$str"/>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
</xsl:choose>
<!-- add relator code too between brackets-->
- <xsl:if test="marc:subfield[@code='4' or @code='e']">
- <span class="relatorcode">
- <xsl:text> [</xsl:text>
- <xsl:choose>
- <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
- </xsl:choose>
- <xsl:text>]</xsl:text>
- </span>
- </xsl:if>
+ <xsl:if test="marc:subfield[@code='4' or @code='e']">
+ <xsl:if test="not(@tag=111 or @tag=711)">
+ <span class="relatorcode">
+ <xsl:text> [</xsl:text>
+ <!-- #13382 If both $e and $4 are present only display $e -->
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='e']">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">e</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">4</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>]</xsl:text>
+ </span>
+ </xsl:if>
+ </xsl:if>
</a>
<xsl:choose>
- <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
+ <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</h5>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
index af9ac00..04eda03 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
+<!-- Edited: Bug 13382 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky at gmail.com -->
<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
<xsl:stylesheet version="1.0"
xmlns:marc="http://www.loc.gov/MARC21/slim"
@@ -158,18 +159,21 @@
</xsl:call-template>
</h5>
</xsl:if>
- <xsl:choose>
- <xsl:when test="marc:datafield[@tag=100] or marc:datafield[@tag=110] or marc:datafield[@tag=111] or marc:datafield[@tag=700] or marc:datafield[@tag=710] or marc:datafield[@tag=711]">
- <h5 class="author">by
- <xsl:call-template name="showAuthor">
- <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111 or @tag=700 or @tag=710 or @tag=711]"/>
- <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
- <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
- <xsl:with-param name="theme" select="$theme"/>
- </xsl:call-template>
- </h5>
- </xsl:when>
- </xsl:choose>
+
+ <!--#13382 Added Author Statement to seperate Authors and Contributors -->
+ <xsl:call-template name="showAuthor">
+ <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
+ <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
+ <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
+ <xsl:with-param name="theme" select="$theme"/>
+ </xsl:call-template>
+ <xsl:call-template name="showAuthor">
+ <!-- #13382 suppress 700$i and 7xx/@ind2=2 -->
+ <xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711][not(@ind2=2)][not(marc:subfield[@code='i'][parent::marc:datafield[@tag='700']])]"/>
+ <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
+ <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
+ <xsl:with-param name="theme" select="$theme"/>
+ </xsl:call-template>
<xsl:if test="$DisplayOPACiconsXSLT!='0'">
<xsl:if test="$materialTypeCode!=''">
@@ -1025,8 +1029,16 @@
<xsl:param name="UseAuthoritiesForTracings" />
<xsl:param name="materialTypeLabel" />
<xsl:param name="theme" />
+ <xsl:if test="count($authorfield)>0">
+ <!--#13382 Changed Additional author to contributor -->
+ <h5>
<xsl:for-each select="$authorfield">
- <xsl:choose><xsl:when test="position()!=1"><xsl:text>; </xsl:text></xsl:when></xsl:choose>
+ <xsl:choose>
+ <xsl:when test="position()>1"/>
+ <xsl:when test="@tag<700">by </xsl:when>
+ <!--#13382 Changed Additional author to contributor -->
+ <xsl:otherwise>Contributor(s): </xsl:otherwise>
+ </xsl:choose>
<xsl:choose>
<xsl:when test="not(@tag=111 or @tag=711)" />
<xsl:when test="marc:subfield[@code='n']">
@@ -1067,21 +1079,62 @@
</xsl:choose>
<span property="name">
<xsl:choose>
- <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCQ"/></xsl:when>
- <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
- <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
+ <xsl:when test="@tag=100"><xsl:call-template name="nameABCQ"/></xsl:when>
+ <xsl:when test="@tag=110"><xsl:call-template name="nameABCDN"/></xsl:when>
+ <xsl:when test="@tag=111"><xsl:call-template name="nameACDEQ"/></xsl:when>
+ <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
+ <!--#13382 Added all relevant subfields 4, e, are handled separately -->
+ <xsl:when test="@tag=700 or @tag=710 or @tag=711">
+ <xsl:variable name="str">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdfghiklmnoprstux</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="$str"/>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
</xsl:choose>
</span></span></span>
- <!-- add relator code too between brackets-->
+ <!-- #13382 If both $e and $4 are present only display $e -->
<xsl:if test="marc:subfield[@code='4' or @code='e']">
- <span class="relatorcode">
- <xsl:text> [</xsl:text>
- <xsl:choose>
- <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
- </xsl:choose>
- <xsl:text>]</xsl:text>
- </span>
+ <xsl:if test="not(@tag=111 or @tag=711)">
+ <span class="relatorcode">
+ <xsl:text> [</xsl:text>
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='e']">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">e</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">4</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/. </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>]</xsl:text>
+ </span>
+ </xsl:if>
</xsl:if>
</a>
<xsl:if test="marc:subfield[@code=9]">
@@ -1095,8 +1148,13 @@
</xsl:element>
</a>
</xsl:if>
+ <!--#13382 Changed separator to | -->
+ <xsl:choose>
+ <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise>
+ </xsl:choose>
</xsl:for-each>
- <xsl:text>.</xsl:text>
+ </h5>
+ </xsl:if>
</xsl:template>
<xsl:template name="nameABCQ">
--
1.7.2.3
More information about the Koha-patches
mailing list