From 607b40c83dcce4a6ccdd58dab0b66bf72692682e Mon Sep 17 00:00:00 2001
From: Winona Salesky <wsalesky@gmail.com>
Date: Tue, 10 Mar 2015 22:05:00 -0400
Subject: [PATCH] Updates for 7xx view in details view

---
 .../prog/en/xslt/MARC21slim2intranetDetail.xsl     | 180 ++++++++++++++----
 .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl    | 202 ++++++++++++++++-----
 2 files changed, 302 insertions(+), 80 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
index 349dbea..33cc844 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 "&#160;" >]>
 
 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
+
 <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,91 @@
         </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="$str"/>    
+                        </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:for-each select="marc:subfield[@code='e']">
+                                        <xsl:value-of select="."/>
+                                        <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                    </xsl:for-each>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:for-each select="marc:subfield[@code='4']">
+                                        <xsl:value-of select="."/>
+                                        <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                    </xsl:for-each>
+                                </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><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </span>
+        </xsl:if>
+        
+        <!-- #13382 Added Contained Works 7xx@ind2=2 -->
+        <xsl:if test="marc:datafield[@tag=700][@ind2=2][not(marc:subfield[@code='i'])] or marc:datafield[@tag=710][@ind2=2][not(marc:subfield[@code='i'])] or marc:datafield[@tag=711][@ind2=2][not(marc:subfield[@code='i'])]">
+            <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="$str"/>    
+                        </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:for-each select="marc:subfield[@code='e']">
+                                        <xsl:value-of select="."/>
+                                        <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                    </xsl:for-each>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:for-each select="marc:subfield[@code='4']">
+                                        <xsl:value-of select="."/>
+                                        <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                    </xsl:for-each>
+                                </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><span class="separator"><xsl:text> | </xsl:text></span></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']">
@@ -565,22 +658,6 @@
             </span>
         </xsl:if>
 
-<!-- DDC classification -->
-    <xsl:if test="marc:datafield[@tag=082]">
-        <span class="results_summary ddc">
-            <span class="label">DDC classification: </span>
-            <xsl:for-each select="marc:datafield[@tag=082]">
-                <xsl:call-template name="subfieldSelect">
-                    <xsl:with-param name="codes">a</xsl:with-param>
-                </xsl:call-template>
-                <xsl:choose>
-                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
-                    <xsl:otherwise> | </xsl:otherwise>
-                </xsl:choose>
-            </xsl:for-each>
-        </span>
-    </xsl:if>
-
         <xsl:if test="marc:datafield[@tag=856]">
         <span class="results_summary online_resources"><span class="label">Online resources: </span>
         <xsl:for-each select="marc:datafield[@tag=856]">
@@ -965,7 +1042,8 @@
         <xsl:choose>
           <xsl:when test="position()&gt;1"/>
           <xsl:when test="@tag&lt;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>
@@ -977,28 +1055,58 @@
             </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:for-each select="marc:subfield[@code='e']">
+                                    <xsl:value-of select="."/>
+                                    <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                </xsl:for-each>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:for-each select="marc:subfield[@code='4']">
+                                    <xsl:value-of select="."/>
+                                    <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                </xsl:for-each>
+                            </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><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
         </xsl:choose>
         </xsl:for-each>
         </h5>
         </xsl:if>
     </xsl:template>
 
-</xsl:stylesheet>
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
index 11624c4..5e6f514 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 $ -->
+
 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
 <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!=''">
@@ -572,6 +576,91 @@
         </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="$str"/>    
+                            </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:for-each select="marc:subfield[@code='e']">
+                                            <xsl:value-of select="."/>
+                                            <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                        </xsl:for-each>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:for-each select="marc:subfield[@code='4']">
+                                            <xsl:value-of select="."/>
+                                            <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                        </xsl:for-each>
+                                    </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><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </span> 
+            </xsl:if>
+            
+            <!-- #13382 Added Contained Works 7xx@ind2=2 -->
+            <xsl:if test="marc:datafield[@tag=700][@ind2=2][not(marc:subfield[@code='i'])] or marc:datafield[@tag=710][@ind2=2][not(marc:subfield[@code='i'])] or marc:datafield[@tag=711][@ind2=2][not(marc:subfield[@code='i'])]">
+                <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="$str"/>    
+                            </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:for-each select="marc:subfield[@code='e']">
+                                            <xsl:value-of select="."/>
+                                            <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                        </xsl:for-each>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:for-each select="marc:subfield[@code='4']">
+                                            <xsl:value-of select="."/>
+                                            <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                        </xsl:for-each>
+                                    </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><span class="separator"><xsl:text> | </xsl:text></span></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']">
@@ -625,23 +714,6 @@
             </span>
         </xsl:if>
 
-<!-- DDC classification -->
-    <xsl:if test="marc:datafield[@tag=082]">
-        <span class="results_summary ddc">
-            <span class="label">DDC classification: </span>
-            <xsl:for-each select="marc:datafield[@tag=082]">
-                <xsl:call-template name="subfieldSelect">
-                    <xsl:with-param name="codes">a</xsl:with-param>
-                </xsl:call-template>
-                <xsl:choose>
-                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
-                    <xsl:otherwise> | </xsl:otherwise>
-                </xsl:choose>
-            </xsl:for-each>
-        </span>
-    </xsl:if>
-
-
 <!-- Image processing code added here, takes precedence over text links including y3z text   -->
         <xsl:if test="marc:datafield[@tag=856]">
         <span class="results_summary online_resources"><span class="label">Online resources: </span>
@@ -1042,8 +1114,16 @@
         <xsl:param name="UseAuthoritiesForTracings" />
         <xsl:param name="materialTypeLabel" />
         <xsl:param name="theme" />
+        <xsl:if test="count($authorfield)&gt;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()&gt;1"/>
+                <xsl:when test="@tag&lt;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']">
@@ -1084,21 +1164,50 @@
                     </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:for-each select="marc:subfield[@code='e']">
+                                        <xsl:value-of select="."/>
+                                        <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                    </xsl:for-each>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:for-each select="marc:subfield[@code='4']">
+                                        <xsl:value-of select="."/>
+                                        <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>    
+                                    </xsl:for-each>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            <xsl:text>]</xsl:text>
+                        </span> 
+                    </xsl:if>
                 </xsl:if>
             </a>
             <xsl:if test="marc:subfield[@code=9]">
@@ -1112,8 +1221,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><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
+            </xsl:choose>
         </xsl:for-each>
-        <xsl:text>.</xsl:text>
+        </h5>
+        </xsl:if>
     </xsl:template>
 
     <xsl:template name="nameABCQ">
@@ -1190,4 +1304,4 @@
         </xsl:variable>
         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
     </xsl:template>
-</xsl:stylesheet>
+</xsl:stylesheet>
\ No newline at end of file
-- 
1.9.5 (Apple Git-50.3)