Bug 32794: (follow-up) Replace code by new function (template)
[srvgit] / koha-tmpl / opac-tmpl / bootstrap / en / xslt / MARC21slim2OPACResults.xsl
index c7f05fd..36026bd 100644 (file)
                 </xsl:choose>
             </xsl:for-each>
 -->
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
+            <xsl:variable name="controlField007" select="marc:controlfield[@tag=007]"/>
+            <xsl:variable name="cf007ss11" select="substring($controlField007,1,1)"/>
+            <xsl:variable name="cf007ss21" select="substring($controlField007,2,1)"/>
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'b'">
                 chip cartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'c'">
                 <img src="/opac-tmpl/lib/famfamfam/cd.png" alt="computer optical disc cartridge" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'j'">
                 magnetic disc
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'm'">
                 magneto-optical disc
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'o'">
                 <img src="/opac-tmpl/lib/famfamfam/cd.png" alt="optical disc" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'r'">
                available online
                 <img src="/opac-tmpl/lib/famfamfam/drive_web.png" alt="remote" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'a'">
                 tape cartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'f'">
                 tape cassette
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
+            <xsl:if test="$cf007ss11 = 'c' and $cf007ss21 = 'h'">
                 tape reel
             </xsl:if>
 
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
+            <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'a'">
                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="celestial globe" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
+            <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'e'">
                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="earth moon globe" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
+            <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'b'">
                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="planetary or lunar globe" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'd' and $cf007ss21 = 'c'">
                 <img src="/opac-tmpl/lib/famfamfam/world.png" alt="terrestrial globe" class="format"/>
             </xsl:if>
 
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
+            <xsl:if test="$cf007ss11 = 'o' and $cf007ss21 = 'o'">
                 kit
             </xsl:if>
 
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'd'">
                 atlas
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'g'">
                 diagram
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'j'">
                 map
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'q'">
                 model
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'k'">
                 profile
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'r'">
                 remote-sensing image
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 's'">
                 section
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
+            <xsl:if test="$cf007ss11 = 'a' and $cf007ss21 = 'y'">
                 view
             </xsl:if>
 
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'a'">
                 aperture card
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'e'">
                 microfiche
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'f'">
                 microfiche cassette
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'b'">
                 microfilm cartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'c'">
                 microfilm cassette
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'd'">
                 microfilm reel
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
+            <xsl:if test="$cf007ss11 = 'h' and $cf007ss21 = 'g'">
                 microopaque
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'm' and $cf007ss21 = 'c'">
                 film cartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
+            <xsl:if test="$cf007ss11 = 'm' and $cf007ss21 = 'f'">
                 film cassette
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
+            <xsl:if test="$cf007ss11 = 'm' and $cf007ss21 = 'r'">
                 film reel
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'n'">
                 <img src="/opac-tmpl/lib/famfamfam/chart_curve.png" alt="chart" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'c'">
                 collage
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'd'">
                  <img src="/opac-tmpl/lib/famfamfam/pencil.png" alt="drawing" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'o'">
                 <img src="/opac-tmpl/lib/famfamfam/note.png" alt="flash card" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'e'">
                 <img src="/opac-tmpl/lib/famfamfam/paintbrush.png" alt="painting" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'f'">
                 photomechanical print
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'g'">
                 photonegative
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'h'">
                 photoprint
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'i'">
                 <img src="/opac-tmpl/lib/famfamfam/picture.png" alt="picture" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'j'">
                 print
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
+            <xsl:if test="$cf007ss11 = 'k' and $cf007ss21 = 'l'">
                 technical drawing
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
+            <xsl:if test="$cf007ss11 = 'q' and $cf007ss21 = 'q'">
                 <img src="/opac-tmpl/lib/famfamfam/script.png" alt="notated music" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'd'">
                 filmslip
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'c'">
                 filmstrip cartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
+            <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'o'">
                 filmstrip roll
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
+            <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 'f'">
                 other filmstrip type
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
+            <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 's'">
                 <img src="/opac-tmpl/lib/famfamfam/pictures.png" alt="slide" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
+            <xsl:if test="$cf007ss11 = 'g' and $cf007ss21 = 't'">
                 transparency
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
+            <xsl:if test="$cf007ss11 = 'r' and $cf007ss21 = 'r'">
                 remote-sensing image
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'e'">
                 cylinder
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'q'">
                 roll
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'g'">
                 sound cartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 's'">
                 sound cassette
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'd'">
                 <img src="/opac-tmpl/lib/famfamfam/cd.png" alt="sound disc" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 't'">
                 sound-tape reel
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'i'">
                 sound-track film
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
+            <xsl:if test="$cf007ss11 = 's' and $cf007ss21 = 'w'">
                 wire recording
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'c'">
                 combination
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
+            <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'b'">
                 braille
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
+            <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'a'">
                 moon
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 'f' and $cf007ss21 = 'd'">
                 tactile, with no writing system
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'c'">
                 braille
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
+            <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'b'">
                 <img src="/opac-tmpl/lib/famfamfam/magnifier.png" alt="large print" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
+            <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'a'">
                 regular print
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 't' and $cf007ss21 = 'd'">
                 text in looseleaf binder
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
+            <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'c'">
                 videocartridge
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
+            <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'f'">
                 videocassette
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
+            <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'd'">
                 <img src="/opac-tmpl/lib/famfamfam/dvd.png" alt="videodisc" class="format"/>
             </xsl:if>
-            <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
+            <xsl:if test="$cf007ss11 = 'v' and $cf007ss21 = 'r'">
                 videoreel
             </xsl:if>
 <!--
         </xsl:choose>
       </xsl:variable>
 
-      <span class="results_summary"><a>
+      <div class="results_summary"><a>
         <xsl:attribute name="href">
           <xsl:value-of select="$OpenURLResolverURL" />
         </xsl:attribute>
             <xsl:value-of select="$openurltext" />
           </xsl:otherwise>
         </xsl:choose>
-      </a></span>
+      </a></div>
     </xsl:if>
     <!-- End of OpenURL -->
 
     <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]">
 
-        <span class="byAuthor">by </span>
+        <span class="byAuthor">by</span><xsl:text> </xsl:text>
         <ul class="author resource_list">
         <!-- #13383 -->
         <xsl:for-each select="marc:datafield[(@tag=100 or @tag=700 or @tag=110 or @tag=710 or @tag=111 or @tag=711) and @ind1!='z']">
             <li>
-            <xsl:call-template name="chopPunctuation">
-                <xsl:with-param name="chopString">
-                    <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">
-                            <xsl:choose>
-                                <!-- #13383 include subfield e for field 111  -->
-                                <xsl:when test="@tag=111 or @tag=711">aeq</xsl:when>
-                                <xsl:when test="@tag=110 or @tag=710">ab</xsl:when>
-                                <xsl:otherwise>abcjq</xsl:otherwise>
-                            </xsl:choose>
-                        </xsl:with-param>
-                    </xsl:call-template>
-                </xsl:with-param>
-                <xsl:with-param name="punctuation">
-                    <xsl:text>:,;/ </xsl:text>
-                </xsl:with-param>
-            </xsl:call-template>
-            <!-- Display title portion for 110 and 710 fields -->
-            <xsl:if test="(@tag=110 or @tag=710) and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
-                <span class="titleportion">
-                <xsl:choose>
-                    <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
-                    <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
-                </xsl:choose>
-                <xsl:call-template name="chopPunctuation">
-                    <xsl:with-param name="chopString">
-                    <xsl:call-template name="subfieldSelect">
-                        <xsl:with-param name="codes">cdnt</xsl:with-param>
-                    </xsl:call-template>
-                    </xsl:with-param>
-                </xsl:call-template>
-                </span>
-            </xsl:if>
-            <!-- Display title portion for 111 and 711 fields -->
-            <xsl:if test="(@tag=111 or @tag=711) and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
-                    <span class="titleportion">
+                <a>
                     <xsl:choose>
-                        <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
-                        <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
+                        <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
+                            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
+                        </xsl:otherwise>
                     </xsl:choose>
-
                     <xsl:call-template name="chopPunctuation">
                         <xsl:with-param name="chopString">
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">cdgnt</xsl:with-param>
-                        </xsl:call-template>
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">
+                                    <xsl:choose>
+                                        <!-- #13383 include subfield e for field 111  -->
+                                        <xsl:when test="@tag=111 or @tag=711">aeq</xsl:when>
+                                        <xsl:when test="@tag=110 or @tag=710">ab</xsl:when>
+                                        <xsl:otherwise>abcjq</xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:with-param>
+                            </xsl:call-template>
+                        </xsl:with-param>
+                        <xsl:with-param name="punctuation">
+                            <xsl:text>:,;/ </xsl:text>
                         </xsl:with-param>
                     </xsl:call-template>
-                    </span>
-            </xsl:if>
-            <!-- Display dates for 100 and 700 fields -->
-            <xsl:if test="(@tag=100 or @tag=700) and marc:subfield[@code='d']">
-                <span class="authordates">
-                <xsl:text>, </xsl:text>
-                <xsl:call-template name="chopPunctuation">
-                    <xsl:with-param name="chopString">
-                        <xsl:call-template name="subfieldSelect">
-                           <xsl:with-param name="codes">d</xsl:with-param>
+                    <!-- Display title portion for 110 and 710 fields -->
+                    <xsl:if test="(@tag=110 or @tag=710) and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
+                        <span class="titleportion">
+                        <xsl:choose>
+                            <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
+                            <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:call-template name="chopPunctuation">
+                            <xsl:with-param name="chopString">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">cdnt</xsl:with-param>
+                            </xsl:call-template>
+                            </xsl:with-param>
                         </xsl:call-template>
-                    </xsl:with-param>
-                </xsl:call-template>
-                </span>
-            </xsl:if>
-            <!-- Display title portion for 100 and 700 fields -->
-            <xsl:if test="@tag=700 and marc:subfield[@code='t']">
-                <span class="titleportion">
-                <xsl:text>. </xsl:text>
-                <xsl:call-template name="chopPunctuation">
-                    <xsl:with-param name="chopString">
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">t</xsl:with-param>
+                        </span>
+                    </xsl:if>
+                    <!-- Display title portion for 111 and 711 fields -->
+                    <xsl:if test="(@tag=111 or @tag=711) and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
+                            <span class="titleportion">
+                            <xsl:choose>
+                                <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
+                                <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
+                            </xsl:choose>
+
+                            <xsl:call-template name="chopPunctuation">
+                                <xsl:with-param name="chopString">
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">cdgnt</xsl:with-param>
+                                </xsl:call-template>
+                                </xsl:with-param>
+                            </xsl:call-template>
+                            </span>
+                    </xsl:if>
+                    <!-- Display dates for 100 and 700 fields -->
+                    <xsl:if test="(@tag=100 or @tag=700) and marc:subfield[@code='d']">
+                        <span class="authordates">
+                        <xsl:text>, </xsl:text>
+                        <xsl:call-template name="chopPunctuation">
+                            <xsl:with-param name="chopString">
+                                <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">d</xsl:with-param>
+                                </xsl:call-template>
+                            </xsl:with-param>
                         </xsl:call-template>
-                    </xsl:with-param>
-                </xsl:call-template>
-                </span>
-            </xsl:if>
-            <!-- Display relators for 1XX and 7XX fields -->
-            <xsl:if test="marc:subfield[@code='4' or @code='e'][not(parent::*[@tag=111])] or (self::*[@tag=111] and marc:subfield[@code='4' or @code='j'][. != ''])">
-                <span class="relatorcode">
-                    <xsl:text> [</xsl:text>
-                    <xsl:choose>
-                        <xsl:when test="@tag=111 or @tag=711">
+                        </span>
+                    </xsl:if>
+                    <!-- Display title portion for 100 and 700 fields -->
+                    <xsl:if test="@tag=700 and marc:subfield[@code='t']">
+                        <span class="titleportion">
+                        <xsl:text>. </xsl:text>
+                        <xsl:call-template name="chopPunctuation">
+                            <xsl:with-param name="chopString">
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">t</xsl:with-param>
+                                </xsl:call-template>
+                            </xsl:with-param>
+                        </xsl:call-template>
+                        </span>
+                    </xsl:if>
+                    <!-- Display relators for 1XX and 7XX fields -->
+                    <xsl:if test="marc:subfield[@code='4' or @code='e'][not(parent::*[@tag=111])] or (self::*[@tag=111] and marc:subfield[@code='4' or @code='j'][. != ''])">
+                        <span class="relatorcode">
+                            <xsl:text> [</xsl:text>
                             <xsl:choose>
-                                <!-- Prefer j over 4 for 111 and 711 -->
-                                <xsl:when test="marc:subfield[@code='j']">
-                                    <xsl:for-each select="marc:subfield[@code='j']">
+                                <xsl:when test="@tag=111 or @tag=711">
+                                    <xsl:choose>
+                                        <!-- Prefer j over 4 for 111 and 711 -->
+                                        <xsl:when test="marc:subfield[@code='j']">
+                                            <xsl:for-each select="marc:subfield[@code='j']">
+                                                <xsl:value-of select="."/>
+                                                <xsl:if test="position() != last()">, </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:if>
+                                            </xsl:for-each>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:when>
+                                <!-- Prefer e over 4 on 100 and 110 -->
+                                <xsl:when test="marc:subfield[@code='e']">
+                                    <xsl:for-each select="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
                                         <xsl:value-of select="."/>
                                         <xsl:if test="position() != last()">, </xsl:if>
                                     </xsl:for-each>
                                     </xsl:for-each>
                                 </xsl:otherwise>
                             </xsl:choose>
-                        </xsl:when>
-                        <!-- Prefer e over 4 on 100 and 110 -->
-                        <xsl:when test="marc:subfield[@code='e']">
-                            <xsl:for-each select="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
-                                <xsl:value-of select="."/>
-                                <xsl:if test="position() != last()">, </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:if>
-                            </xsl:for-each>
-                        </xsl:otherwise>
-                    </xsl:choose>
-                    <xsl:text>]</xsl:text>
-                </span>
-            </xsl:if>
+                            <xsl:text>]</xsl:text>
+                        </span>
+                    </xsl:if>
+                </a>
             </li>
         </xsl:for-each>
         </ul>
     </xsl:call-template>
 
     <xsl:if test="marc:datafield[@tag=250]">
-    <span class="results_summary edition">
+    <div class="results_summary edition">
     <span class="label">Edition: </span>
             <xsl:for-each select="marc:datafield[@tag=250]">
                     <xsl:call-template name="subfieldSelect">
                         <xsl:with-param name="codes">ab</xsl:with-param>
                     </xsl:call-template>
             </xsl:for-each>
-       </span>
-    </xsl:if>
-
-    <xsl:if test="marc:datafield[@tag=773]">
-        <xsl:for-each select="marc:datafield[@tag=773]">
-            <xsl:if test="marc:subfield[@code='t']">
-    <span class="results_summary source">
-    <span class="label">Source: </span>
-            <xsl:value-of select="marc:subfield[@code='t']"/>
-    </span>
-            </xsl:if>
-        </xsl:for-each>
+       </div>
     </xsl:if>
 
 <xsl:if test="$DisplayOPACiconsXSLT!='0'">
-    <span class="results_summary type">
+    <div class="results_summary type">
     <xsl:if test="$typeOf008!=''">
     <span class="results_material_type">
         <span class="label">Material type: </span>
         </span>
     </xsl:if>
 <xsl:text> </xsl:text> <!-- added blank space to fix font display problem, see Bug 3671 -->
-       </span>
+</div>
 </xsl:if>
 
     <xsl:call-template name="show-lang-041"/>
 
     <!-- Publisher or Distributor Number -->
     <xsl:if test="marc:datafield[@tag=028]">
-         <span class="results_summary publisher_number ">
+         <div class="results_summary publisher_number ">
             <span class="label">Publisher number: </span>
             <ul class="resource_list">
                 <xsl:for-each select="marc:datafield[@tag=028]">
                     </li>
                 </xsl:for-each>
             </ul>
-        </span>
+        </div>
     </xsl:if>
 
     <!-- Publisher info and RDA related info from tags 260, 264 -->
             <xsl:call-template name="showRDAtag264"/>
         </xsl:when>
         <xsl:when test="marc:datafield[@tag=260]">
-            <span class="results_summary publisher"><span class="label">Publication details: </span>
+            <div class="results_summary publisher"><span class="label">Publication details: </span>
                 <xsl:for-each select="marc:datafield[@tag=260]">
                     <xsl:if test="marc:subfield[@code='a']">
                         <span class="publisher_place" property="location">
                     <xsl:text>; </xsl:text>
                     <xsl:call-template name="showRDAtag264"/>
                 </xsl:if>
-            </span>
+            </div>
         </xsl:when>
     </xsl:choose>
 
     <!-- Dissertation note -->
     <xsl:if test="marc:datafield[@tag=502]">
-        <span class="results_summary diss_note">
+        <div class="results_summary diss_note">
             <span class="label">Dissertation note: </span>
             <xsl:for-each select="marc:datafield[@tag=502]">
                 <xsl:call-template name="subfieldSelect">
                 </xsl:call-template>
             </xsl:for-each>
             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
-        </span>
+        </div>
     </xsl:if>
 
     <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
     </xsl:if>
 
     <xsl:if test="marc:datafield[@tag=246]">
-    <span class="results_summary other_title">
+    <div class="results_summary other_title">
     <span class="label">Other title: </span>
         <ul class="resource_list">
             <xsl:for-each select="marc:datafield[@tag=246]">
                 </li>
             </xsl:for-each>
         </ul>
-       </span>
+    </div>
     </xsl:if>
     <xsl:if test="marc:datafield[@tag=242]">
-    <span class="results_summary translated_title">
+    <div class="results_summary translated_title">
     <span class="label">Title translated: </span>
             <xsl:for-each select="marc:datafield[@tag=242]">
                     <xsl:call-template name="subfieldSelect">
                     </xsl:call-template>
                     <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>
+       </div>
     </xsl:if>
+
+    <xsl:call-template name="host-item-entries">
+        <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
+    </xsl:call-template>
+
     <xsl:if test="marc:datafield[@tag=856]">
-         <span class="results_summary online_resources">
+         <div class="results_summary online_resources">
                           <span class="label">Online access: </span>
                     <ul class="resource_list">
                             <xsl:for-each select="marc:datafield[@tag=856]">
                                </xsl:when>
                                <xsl:otherwise>
                     <xsl:attribute name="href">
-                        <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
-                            <xsl:choose>
-                                <xsl:when test="@ind1=7">
-                                    <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
-                                </xsl:when>
-                                <xsl:when test="@ind1=1">
-                                    <xsl:text>ftp://</xsl:text>
-                                </xsl:when>
-                                <xsl:otherwise>
-                                    <xsl:text>http://</xsl:text>
-                                </xsl:otherwise>
-                            </xsl:choose>
-                        </xsl:if>
+                        <xsl:call-template name="AddMissingProtocol">
+                            <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
+                            <xsl:with-param name="indicator1" select="@ind1"/>
+                            <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
+                        </xsl:call-template>
                         <xsl:value-of select="marc:subfield[@code='u']"/>
                     </xsl:attribute>
                                </xsl:otherwise>
                               </xsl:if>
                             </xsl:for-each>
                             </ul>
-                            </span>
+                            </div>
                         </xsl:if>
 
         <!-- Availability line -->
-        <span class="results_summary availability">
+        <div class="results_summary availability">
             <span class="label">Availability: </span>
 
             <xsl:choose>
                             <status english="Damaged">Damaged</status>
                             <status english="Pending hold">Pending hold</status>
                             <status english="In transit">In transit</status>
-                            <status english="Waiting">On hold</status>
+                            <status english="Hold waiting">On hold</status>
+                            <status english="Recall waiting">Waiting recall</status>
                         </xsl:variable>
                         <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')|key('item-by-status', 'other')"/>
                         <xsl:choose>
                                     </xsl:call-template>
                                 </xsl:for-each>
                             </xsl:when>
+                            <xsl:when test="$OPACResultsUnavailableGroupingBy='branchonly'">
+                                <!-- Only group by branch, do not list substatuses and individual call numbers -->
+                                <xsl:for-each select="items:items/items:item[not(items:resultbranch=preceding-sibling::*/items:resultbranch)]">
+                                    <xsl:sort select="items:resultbranch"/>
+                                    <xsl:variable name="currentbranch" select="items:resultbranch"/>
+                                    <xsl:if test="count($unavailable_items[items:resultbranch=$currentbranch])>0">
+                                        <span class="ItemSummary unavailable">
+                                            <xsl:value-of select="$currentbranch"/>
+                                            <span class="unavailable">
+                                                <xsl:text> (</xsl:text>
+                                                <xsl:value-of select="count($unavailable_items[items:resultbranch=$currentbranch])"/>
+                                                <xsl:text>)</xsl:text>
+                                            </span>
+                                        <xsl:text>. </xsl:text>
+                                        </span>
+                                    </xsl:if>
+                                </xsl:for-each>
+                            </xsl:when>
                         </xsl:choose>
                     </span></xsl:if>
 
                 </xsl:otherwise>
             </xsl:choose>
-        </span>
+        </div>
         <!-- End of Availability line -->
 
     </xsl:template>