Bug 35283: Add missing subfield h to action note 583 in OPAC detail page
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / xslt / MARC21slim2OPACDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
3 <!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com  -->
4 <!DOCTYPE stylesheet>
5 <xsl:stylesheet version="1.0"
6   xmlns:marc="http://www.loc.gov/MARC21/slim"
7   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8   xmlns:str="http://exslt.org/strings"
9   exclude-result-prefixes="marc str">
10     <xsl:import href="MARC21slimUtils.xsl"/>
11     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
12
13     <xsl:template match="/">
14             <xsl:apply-templates/>
15     </xsl:template>
16
17     <xsl:template match="marc:record">
18
19         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21
22     <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
23     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
24     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
25     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
26
27     <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
28     <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
29     <xsl:variable name="AuthorLinkSortBy" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortBy']"/>
30     <xsl:variable name="AuthorLinkSortOrder" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortOrder']"/>
31     <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
32     <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='OPACDisplay856uAsImage']"/>
33     <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>
34     <xsl:variable name="theme" select="marc:sysprefs/marc:syspref[@name='opacthemes']"/>
35     <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
36     <xsl:variable name="TracingQuotesLeft">
37       <xsl:choose>
38         <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICUStyleQuotes']='1'">{</xsl:when>
39         <xsl:otherwise>"</xsl:otherwise>
40       </xsl:choose>
41     </xsl:variable>
42     <xsl:variable name="TracingQuotesRight">
43       <xsl:choose>
44         <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICUStyleQuotes']='1'">}</xsl:when>
45         <xsl:otherwise>"</xsl:otherwise>
46       </xsl:choose>
47     </xsl:variable>
48         <xsl:variable name="leader" select="marc:leader"/>
49         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
50         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
51         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
52         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
53         <xsl:variable name="materialTypeCode">
54             <xsl:choose>
55                 <xsl:when test="$leader19='a'">ST</xsl:when>
56                 <xsl:when test="$leader6='a'">
57                     <xsl:choose>
58                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
59                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
60                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
61                     </xsl:choose>
62                 </xsl:when>
63                 <xsl:when test="$leader6='t'">BK</xsl:when>
64                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
65                 <xsl:when test="$leader6='m'">CF</xsl:when>
66                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
67                 <xsl:when test="$leader6='g'">VM</xsl:when>
68                 <xsl:when test="$leader6='k'">PK</xsl:when>
69                 <xsl:when test="$leader6='r'">OB</xsl:when>
70                 <xsl:when test="$leader6='i'">MU</xsl:when>
71                 <xsl:when test="$leader6='j'">MU</xsl:when>
72                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
73             </xsl:choose>
74         </xsl:variable>
75         <xsl:variable name="materialTypeLabel">
76             <xsl:choose>
77                 <xsl:when test="$leader19='a'">Set</xsl:when>
78                 <xsl:when test="$leader6='a'">
79                     <xsl:choose>
80                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Text</xsl:when>
81                         <xsl:when test="$leader7='i' or $leader7='s'">
82                             <xsl:choose>
83                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
84                                 <xsl:otherwise>Series</xsl:otherwise>
85                             </xsl:choose>
86                         </xsl:when>
87                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
88                     </xsl:choose>
89                 </xsl:when>
90                 <xsl:when test="$leader6='t'">Text</xsl:when>
91                                 <xsl:when test="$leader6='o'">Kit</xsl:when>
92                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
93                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
94                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
95                 <xsl:when test="$leader6='g'">Film</xsl:when>
96                 <xsl:when test="$leader6='k'">Picture</xsl:when>
97                 <xsl:when test="$leader6='r'">Object</xsl:when>
98                 <xsl:when test="$leader6='j'">Music</xsl:when>
99                 <xsl:when test="$leader6='i'">Sound</xsl:when>
100                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
101             </xsl:choose>
102         </xsl:variable>
103
104         <!-- Schema.org type -->
105         <xsl:variable name="schemaOrgType">
106             <xsl:choose>
107                 <xsl:when test="$materialTypeLabel='Book'">Book</xsl:when>
108                 <xsl:when test="$materialTypeLabel='Map'">Map</xsl:when>
109                 <xsl:when test="$materialTypeLabel='Music'">MusicAlbum</xsl:when>
110                 <xsl:otherwise>CreativeWork</xsl:otherwise>
111             </xsl:choose>
112         </xsl:variable>
113
114         <!-- Wrapper div for our schema.org object -->
115         <xsl:element name="div">
116             <xsl:attribute name="class"><xsl:value-of select="'record'" /></xsl:attribute>
117             <xsl:attribute name="vocab">http://schema.org/</xsl:attribute>
118             <xsl:attribute name="typeof"><xsl:value-of select='$schemaOrgType' /> Product</xsl:attribute>
119             <xsl:attribute name="resource">#record</xsl:attribute>
120
121         <!-- Title Statement -->
122         <!-- Alternate Graphic Representation (MARC 880) -->
123         <xsl:if test="$display880">
124             <h2 class="title" property="alternateName">
125                 <xsl:call-template name="m880Select">
126                     <xsl:with-param name="basetags">245</xsl:with-param>
127                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
128                 </xsl:call-template>
129             </h2>
130         </xsl:if>
131
132             <!--Bug 13381 -->
133             <xsl:if test="marc:datafield[@tag=245]">
134                 <h1 class="title" property="name">
135                     <xsl:for-each select="marc:datafield[@tag=245]">
136                         <xsl:call-template name="subfieldSelect">
137                             <xsl:with-param name="codes">a</xsl:with-param>
138                         </xsl:call-template>
139                         <xsl:text> </xsl:text>
140                         <!-- 13381 add additional subfields-->
141                         <!-- bug17625 adding f and g subfields -->
142                         <xsl:for-each select="marc:subfield[contains('bcfghknps', @code)]">
143                             <xsl:choose>
144                                 <xsl:when test="@code='h'">
145                                     <!--  13381 Span class around subfield h so it can be suppressed via css -->
146                                     <span class="title_medium"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
147                                 </xsl:when>
148                                 <xsl:when test="@code='c'">
149                                     <!--  13381 Span class around subfield c so it can be suppressed via css -->
150                                     <span class="title_resp_stmt"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
151                                 </xsl:when>
152                                 <xsl:otherwise>
153                                     <xsl:apply-templates/>
154                                     <xsl:text> </xsl:text>
155                                 </xsl:otherwise>
156                             </xsl:choose>
157                         </xsl:for-each>
158                     </xsl:for-each>
159                 </h1>
160             </xsl:if>
161
162
163         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
164         <xsl:if test="$display880">
165             <span class="results_summary author h3">
166                 <xsl:call-template name="m880Select">
167                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
168                     <xsl:with-param name="codes">abc</xsl:with-param>
169                     <xsl:with-param name="index">au</xsl:with-param>
170                     <!-- do not use label 'by ' here, it would be repeated for every occurrence of 100,110,111,700,710,711 -->
171                 </xsl:call-template>
172             </span>
173         </xsl:if>
174
175         <!--#13382 Added Author Statement to separate Authors and Contributors -->
176         <xsl:call-template name="showAuthor">
177             <xsl:with-param name="authorfield" select="marc:datafield[(@tag=100 or @tag=110 or @tag=111)]"/>
178             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
179             <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/>
180             <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/>
181             <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
182             <xsl:with-param name="theme" select="$theme"/>
183         </xsl:call-template>
184
185         <xsl:call-template name="showAuthor">
186             <!-- #13382 suppress 700$i and 7xx/@ind2=2 -->
187             <xsl:with-param name="authorfield" select="marc:datafield[(@tag=700 or @tag=710 or @tag=711) and not(@ind2=2) and not(marc:subfield[@code='i'])]"/>
188             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
189             <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/>
190             <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/>
191             <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
192             <xsl:with-param name="theme" select="$theme"/>
193         </xsl:call-template>
194
195    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
196         <xsl:if test="$materialTypeCode!=''">
197         <span class="results_summary type"><span class="label">Material type: </span>
198         <xsl:element name="img">
199             <xsl:attribute name="src">/opac-tmpl/lib/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute>
200             <xsl:attribute name="alt"><xsl:value-of select="$materialTypeLabel"/></xsl:attribute>
201             <xsl:attribute name="class">materialtype mt_icon_<xsl:value-of select="$materialTypeCode"/></xsl:attribute>
202         </xsl:element>
203         <xsl:value-of select="$materialTypeLabel"/>
204         </span>
205         </xsl:if>
206     </xsl:if>
207
208
209     <!-- Publisher or Distributor Number -->
210     <xsl:if test="marc:datafield[@tag=028]">
211         <span class="results_summary publisher_number ">
212             <span class="label">Publisher number: </span>
213             <xsl:for-each select="marc:datafield[@tag=028]">
214                 <xsl:call-template name="subfieldSelect">
215                     <xsl:with-param name="codes">abq</xsl:with-param>
216                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
217                 </xsl:call-template>
218             </xsl:for-each>
219         </span>
220     </xsl:if>
221
222     <xsl:call-template name="show-lang-041"/>
223
224         <!--Series: Alternate Graphic Representation (MARC 880) -->
225         <xsl:if test="$display880">
226             <xsl:call-template name="m880Select">
227                 <xsl:with-param name="basetags">440,490</xsl:with-param>
228                 <xsl:with-param name="codes">av</xsl:with-param>
229                 <xsl:with-param name="class">results_summary series</xsl:with-param>
230                 <xsl:with-param name="label">Series: </xsl:with-param>
231                 <xsl:with-param name="index">se</xsl:with-param>
232             </xsl:call-template>
233         </xsl:if>
234
235     <xsl:call-template name="show-series">
236         <xsl:with-param name="searchurl">/cgi-bin/koha/opac-search.pl</xsl:with-param>
237         <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
238         <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
239     </xsl:call-template>
240
241         <!-- Analytics information -->
242         <xsl:variable name="leader7_class">
243             <xsl:choose>
244                 <!--xsl:when test="$leader7='a'">analytic_mcp</xsl:when-->
245                 <!--xsl:when test="$leader7='b'">analytic_scp</xsl:when-->
246                 <xsl:when test="$leader7='c'">analytic_collection</xsl:when>
247                 <xsl:when test="$leader7='d'">analytic_subunit</xsl:when>
248                 <xsl:when test="$leader7='i'">analytic_ires</xsl:when>
249                 <xsl:when test="$leader7='m'">analytic_monograph</xsl:when>
250                 <xsl:when test="$leader7='s'">analytic_serial</xsl:when>
251                 <xsl:otherwise>analytic_undefined</xsl:otherwise>
252             </xsl:choose>
253         </xsl:variable>
254
255         <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
256         <xsl:if test="$show_analytics_link='1'">
257             <xsl:element name="span">
258                 <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
259                 <span class="label">Analytics: </span>
260                 <a>
261                 <xsl:choose>
262                     <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
263                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute>
264                     </xsl:when>
265                     <xsl:otherwise>
266                         <xsl:variable name="title_query">
267                             <xsl:text>Host-item:(</xsl:text>
268                             <xsl:call-template name="quote_search_term">
269                                 <xsl:with-param name="term"><xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='a']"/></xsl:with-param>
270                             </xsl:call-template>
271                             <xsl:text>)</xsl:text>
272                         </xsl:variable>
273                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($title_query, true())"/></xsl:attribute>
274                     </xsl:otherwise>
275                 </xsl:choose>
276                 <xsl:text>Show analytics</xsl:text>
277                 </a>
278             </xsl:element>
279         </xsl:if>
280
281         <!-- Volumes of sets and traced series -->
282         <xsl:variable name="show_volumes_link" select="marc:variables/marc:variable[@name='show_volumes_link']" />
283         <xsl:variable name="title" select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())" />
284         <xsl:if test="$show_volumes_link='1' and ($materialTypeCode='ST' or substring($controlField008,22,1)='m')">
285         <span class="results_summary volumes"><span class="label">Volumes: </span>
286             <a>
287             <xsl:choose>
288             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
289                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
290             </xsl:when>
291             <xsl:otherwise>
292                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:"<xsl:value-of select="$title"/>"+OR+host-item,phr="<xsl:value-of select="$title"/>"+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
293             </xsl:otherwise>
294             </xsl:choose>
295             <xsl:text>Show volumes</xsl:text>
296             </a>
297         </span>
298         </xsl:if>
299
300         <!-- Set -->
301         <xsl:if test="$leader19='c'">
302         <span class="results_summary set"><span class="label">Set: </span>
303         <xsl:for-each select="marc:datafield[@tag=773]">
304             <a>
305             <xsl:choose>
306             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
307                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
308             </xsl:when>
309             <xsl:otherwise>
310                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', ''), true())"/></xsl:attribute>
311             </xsl:otherwise>
312             </xsl:choose>
313             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
314             </a>
315             <xsl:choose>
316                 <xsl:when test="position()=last()"></xsl:when>
317                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
318             </xsl:choose>
319         </xsl:for-each>
320         </span>
321         </xsl:if>
322
323         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
324         <xsl:if test="$display880">
325             <xsl:call-template name="m880Select">
326                 <xsl:with-param name="basetags">260,264</xsl:with-param>
327                 <xsl:with-param name="codes">abcg</xsl:with-param>
328                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
329                 <xsl:with-param name="label">Publication details: </xsl:with-param>
330             </xsl:call-template>
331         </xsl:if>
332
333         <!-- Publisher info and RDA related info from tags 260, 264 -->
334         <xsl:choose>
335             <xsl:when test="marc:datafield[@tag=264]">
336                 <xsl:call-template name="showRDAtag264">
337                    <xsl:with-param name="show_url">1</xsl:with-param>
338                 </xsl:call-template>
339             </xsl:when>
340             <xsl:when test="marc:datafield[@tag=260]">
341              <span class="results_summary publisher"><span class="label">Publication details: </span>
342                  <xsl:for-each select="marc:datafield[@tag=260]">
343                      <xsl:for-each select="marc:subfield">
344                          <xsl:if test="@code='a'">
345                              <span class="publisher_place" property="location">
346                                  <a>
347                                      <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=pl:"<xsl:value-of select="str:encode-uri(current(), true())"/>"</xsl:attribute>
348                                      <xsl:value-of select="current()"/>
349                                  </a>
350                              </span>
351                          </xsl:if>
352                          <xsl:if test="@code='b'">
353                              <span property="publisher" typeof="Organization">
354                                  <span property="name" class="publisher_name">
355                                      <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute>
356                                          <xsl:value-of select="current()"/>
357                                     </a>
358                                  </span>
359                              </span>
360                          </xsl:if>
361                          <xsl:if test="@code='c'">
362                              <span property="datePublished" class="publisher_date">
363                                  <a>
364                                      <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=copydate:"<xsl:value-of select="str:encode-uri(current(), true())"/>"</xsl:attribute>
365                                      <xsl:value-of select="current()"/>
366                                  </a>
367                              </span>
368                          </xsl:if>
369                          <xsl:if test="@code='g'">
370                             <span property="datePublished" class="publisher_date">
371                                <xsl:call-template name="chopPunctuation">
372                                    <xsl:with-param name="chopString">
373                                      <xsl:value-of select="current()"/>
374                                     </xsl:with-param>
375                                 </xsl:call-template>
376                             </span>
377                          </xsl:if>
378                          <xsl:if test="position() != last()">
379                              <xsl:text> </xsl:text>
380                          </xsl:if>
381                      </xsl:for-each>
382                      <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
383                  </xsl:for-each>
384              </span>
385             </xsl:when>
386         </xsl:choose>
387
388         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
389         <xsl:if test="$display880">
390             <xsl:call-template name="m880Select">
391                 <xsl:with-param name="basetags">250</xsl:with-param>
392                 <xsl:with-param name="codes">ab</xsl:with-param>
393                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
394                 <xsl:with-param name="label">Edition: </xsl:with-param>
395             </xsl:call-template>
396         </xsl:if>
397
398         <xsl:if test="marc:datafield[@tag=250]">
399         <span class="results_summary edition"><span class="label">Edition: </span>
400             <xsl:for-each select="marc:datafield[@tag=250]">
401                 <span property="bookEdition">
402                 <xsl:call-template name="chopPunctuation">
403                   <xsl:with-param name="chopString">
404                     <xsl:call-template name="subfieldSelect">
405                         <xsl:with-param name="codes">ab</xsl:with-param>
406                     </xsl:call-template>
407                    </xsl:with-param>
408                </xsl:call-template>
409                 </span>
410                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
411             </xsl:for-each>
412         </span>
413         </xsl:if>
414
415         <!-- Description: Alternate Graphic Representation (MARC 880) -->
416         <xsl:if test="$display880">
417             <xsl:call-template name="m880Select">
418                 <xsl:with-param name="basetags">300</xsl:with-param>
419                 <xsl:with-param name="codes">abceg</xsl:with-param>
420                 <xsl:with-param name="class">results_summary description</xsl:with-param>
421                 <xsl:with-param name="label">Description: </xsl:with-param>
422             </xsl:call-template>
423         </xsl:if>
424
425         <xsl:if test="marc:datafield[@tag=300]">
426         <span class="results_summary description"><span class="label">Description: </span>
427             <xsl:for-each select="marc:datafield[@tag=300]">
428                 <span property="description">
429                 <xsl:call-template name="chopPunctuation">
430                   <xsl:with-param name="chopString">
431                     <xsl:call-template name="subfieldSelect">
432                         <xsl:with-param name="codes">abcefg</xsl:with-param>
433                     </xsl:call-template>
434                    </xsl:with-param>
435                </xsl:call-template>
436                 </span>
437                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
438             </xsl:for-each>
439         </span>
440        </xsl:if>
441
442
443             <!-- Content Type -->
444             <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
445                 <span class="results_summary" id="content_type">
446                     <xsl:if test="marc:datafield[@tag=336]">
447                         <span class="label">Content type: </span>
448                         <ul class="resource_list">
449                             <xsl:for-each select="marc:datafield[@tag=336]">
450                                 <li>
451                                     <xsl:call-template name="subfieldSelect">
452                                         <xsl:with-param name="codes">a</xsl:with-param>
453                                         <xsl:with-param name="delimeter">, </xsl:with-param>
454                                     </xsl:call-template>
455                                 </li>
456                             </xsl:for-each>
457                         </ul>
458                     </xsl:if>
459                     <xsl:text> </xsl:text>
460                     <!-- Media Type -->
461                     <xsl:if test="marc:datafield[@tag=337]">
462                         <span class="label">Media type: </span>
463                         <ul class="resource_list">
464                             <xsl:for-each select="marc:datafield[@tag=337]">
465                                 <li>
466                                     <xsl:call-template name="subfieldSelect">
467                                         <xsl:with-param name="codes">a</xsl:with-param>
468                                         <xsl:with-param name="delimeter">, </xsl:with-param>
469                                     </xsl:call-template>
470                                 </li>
471                             </xsl:for-each>
472                         </ul>
473                     </xsl:if>
474                     <xsl:text> </xsl:text>
475                     <!-- Media Type -->
476                     <xsl:if test="marc:datafield[@tag=338]">
477                         <span class="label">Carrier type: </span>
478                         <ul class="resource_list">
479                             <xsl:for-each select="marc:datafield[@tag=338]">
480                                 <li>
481                                     <xsl:call-template name="subfieldSelect">
482                                         <xsl:with-param name="codes">a</xsl:with-param>
483                                         <xsl:with-param name="delimeter">, </xsl:with-param>
484                                     </xsl:call-template>
485                                 </li>
486                             </xsl:for-each>
487                         </ul>
488                     </xsl:if>
489                 </span>
490             </xsl:if>
491
492         <!-- 385 - Audience -->
493         <xsl:if test="marc:datafield[@tag=385]">
494             <span class="results_summary audience">
495                 <span class="label">Audience: </span>
496                 <ul class="resource_list">
497                     <xsl:for-each select="marc:datafield[@tag=385]">
498                         <li>
499                             <xsl:if test="marc:subfield[@code='m']">
500                                 <xsl:call-template name="chopPunctuation">
501                                     <xsl:with-param name="chopString">
502                                         <xsl:call-template name="subfieldSelect">
503                                             <xsl:with-param name="codes">m</xsl:with-param>
504                                         </xsl:call-template>
505                                     </xsl:with-param>
506                                 </xsl:call-template>
507                                 <xsl:text>: </xsl:text>
508                             </xsl:if>
509                             <xsl:call-template name="chopPunctuation">
510                                 <xsl:with-param name="chopString">
511                                     <xsl:call-template name="subfieldSelect">
512                                         <xsl:with-param name="codes">a</xsl:with-param>
513                                         <xsl:with-param name="delimeter">, </xsl:with-param>
514                                     </xsl:call-template>
515                                 </xsl:with-param>
516                             </xsl:call-template>
517                         </li>
518                     </xsl:for-each>
519                 </ul>
520             </span>
521         </xsl:if>
522
523         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
524             <span class="results_summary isbn"><span class="label">ISBN: </span>
525                 <ul class="resource_list">
526                     <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
527                         <li>
528                             <span property="isbn">
529                                 <xsl:value-of select="."/>
530                             </span>
531                         </li>
532                     </xsl:for-each>
533                 </ul>
534             </span>
535         </xsl:if>
536
537         <!-- Build ISSN -->
538         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
539             <span class="results_summary issn"><span class="label">ISSN: </span>
540                 <ul class="resource_list">
541                     <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
542                         <li>
543                             <span property="issn">
544                                 <xsl:value-of select="."/>
545                             </span>
546                         </li>
547                     </xsl:for-each>
548                 </ul>
549             </span>
550         </xsl:if>
551
552         <xsl:if test="marc:datafield[@tag=013]">
553             <span class="results_summary patent_info">
554                 <span class="label">Patent information: </span>
555                 <xsl:for-each select="marc:datafield[@tag=013]">
556                     <xsl:call-template name="subfieldSelect">
557                         <xsl:with-param name="codes">acdef</xsl:with-param>
558                         <xsl:with-param name="delimeter">, </xsl:with-param>
559                     </xsl:call-template>
560                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
561                 </xsl:for-each>
562             </span>
563         </xsl:if>
564
565         <xsl:if test="marc:datafield[@tag=088]">
566             <span class="results_summary report_number">
567                 <span class="label">Report number: </span>
568                 <xsl:for-each select="marc:datafield[@tag=088]">
569                     <xsl:call-template name="subfieldSelect">
570                         <xsl:with-param name="codes">a</xsl:with-param>
571                     </xsl:call-template>
572                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
573                 </xsl:for-each>
574             </span>
575         </xsl:if>
576
577         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
578         <xsl:if test="$display880">
579             <xsl:call-template name="m880Select">
580                 <xsl:with-param name="basetags">246</xsl:with-param>
581                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
582                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
583                 <xsl:with-param name="label">Other title: </xsl:with-param>
584             </xsl:call-template>
585         </xsl:if>
586
587         <xsl:if test="marc:datafield[@tag=246]">
588             <span class="results_summary other_title">
589                 <span class="label">Other title: </span>
590                 <ul class="resource_list">
591                     <xsl:for-each select="marc:datafield[@tag=246]">
592                         <li>
593                             <span property="alternateName">
594                                 <xsl:call-template name="chopPunctuation">
595                                     <xsl:with-param name="chopString">
596                                         <xsl:if test="marc:subfield[@code='i']">
597                                             <xsl:call-template name="subfieldSelect">
598                                                 <xsl:with-param name="codes">i</xsl:with-param>
599                                             </xsl:call-template>
600                                         </xsl:if>
601                                         <xsl:text> </xsl:text>
602                                         <xsl:call-template name="subfieldSelect">
603                                             <xsl:with-param name="codes">abhfgnp</xsl:with-param>
604                                         </xsl:call-template>
605                                     </xsl:with-param>
606                                 </xsl:call-template>
607                                 <xsl:if test="@ind1=1 and not(marc:subfield[@code='i'])">
608                                     <xsl:choose>
609                                         <xsl:when test="@ind2=0"> [Portion of title]</xsl:when>
610                                         <xsl:when test="@ind2=1"> [Parallel title]</xsl:when>
611                                         <xsl:when test="@ind2=2"> [Distinctive title]</xsl:when>
612                                         <xsl:when test="@ind2=3"> [Other title]</xsl:when>
613                                         <xsl:when test="@ind2=4"> [Cover title]</xsl:when>
614                                         <xsl:when test="@ind2=5"> [Added title page title]</xsl:when>
615                                         <xsl:when test="@ind2=6"> [Caption title]</xsl:when>
616                                         <xsl:when test="@ind2=7"> [Running title]</xsl:when>
617                                         <xsl:when test="@ind2=8"> [Spine title]</xsl:when>
618                                     </xsl:choose>
619                                 </xsl:if>
620                             </span>
621                         </li>
622                     </xsl:for-each>
623                 </ul>
624             </span>
625         </xsl:if>
626
627
628         <xsl:if test="marc:datafield[@tag=242]">
629         <span class="results_summary translated_title"><span class="label">Title translated: </span>
630             <xsl:for-each select="marc:datafield[@tag=242]">
631                 <span property="alternateName">
632                 <xsl:call-template name="chopPunctuation">
633                   <xsl:with-param name="chopString">
634                     <xsl:call-template name="subfieldSelect">
635                         <xsl:with-param name="codes">abchnp</xsl:with-param>
636                     </xsl:call-template>
637                    </xsl:with-param>
638                </xsl:call-template>
639                 </span>
640                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
641             </xsl:for-each>
642         </span>
643        </xsl:if>
644
645         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
646         <xsl:if test="$display880">
647             <span property="alternateName">
648             <xsl:call-template name="m880Select">
649                 <xsl:with-param name="basetags">130,240</xsl:with-param>
650                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
651                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
652                 <xsl:with-param name="label">Uniform titles: </xsl:with-param>
653             </xsl:call-template>
654             </span>
655         </xsl:if>
656
657         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
658             <span class="results_summary uniform_titles">
659                 <span class="label">Uniform titles: </span>
660                 <ul class="resource_list">
661                     <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
662                         <li>
663                             <span property="alternateName">
664                                 <xsl:if test="marc:subfield[@code='i']">
665                                     <xsl:call-template name="subfieldSelect">
666                                         <xsl:with-param name="codes">i</xsl:with-param>
667                                     </xsl:call-template>
668                                 </xsl:if>
669                                 <xsl:text> </xsl:text>
670                                 <xsl:for-each select="marc:subfield">
671                                     <xsl:if test="contains('adfghklmnoprst',@code)">
672                                         <xsl:value-of select="text()"/>
673                                         <xsl:text> </xsl:text>
674                                     </xsl:if>
675                                 </xsl:for-each>
676                             </span>
677                         </li>
678                     </xsl:for-each>
679                 </ul>
680             </span>
681         </xsl:if>
682
683
684         <!-- #13382 Added Related works 700$i -->
685         <xsl:if test="marc:datafield[@tag=700][marc:subfield[@code='i']] or marc:datafield[@tag=710][marc:subfield[@code='i']] or marc:datafield[@tag=711][marc:subfield[@code='i']]">
686             <span class="results_summary related_works">
687                 <span class="label">Related works: </span>
688                 <ul class="resource_list">
689                     <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='i']] | marc:datafield[@tag=710][marc:subfield[@code='i']] | marc:datafield[@tag=711][marc:subfield[@code='i']]">
690                         <li>
691                             <xsl:variable name="str">
692                                 <xsl:call-template name="subfieldSelect">
693                                     <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
694                                 </xsl:call-template>
695                             </xsl:variable>
696                             <xsl:call-template name="chopPunctuation">
697                                 <xsl:with-param name="chopString">
698                                     <xsl:value-of select="$str"/>
699                                 </xsl:with-param>
700                             </xsl:call-template>
701                             <!-- add relator code too between brackets-->
702                             <xsl:if test="marc:subfield[@code='4' or @code='e']">
703                                 <span class="relatorcode">
704                                     <xsl:text> [</xsl:text>
705                                     <xsl:choose>
706                                         <xsl:when test="marc:subfield[@code='e']">
707                                             <xsl:for-each select="marc:subfield[@code='e']">
708                                                 <xsl:value-of select="."/>
709                                                 <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
710                                             </xsl:for-each>
711                                         </xsl:when>
712                                         <xsl:otherwise>
713                                             <xsl:for-each select="marc:subfield[@code='4']">
714                                                 <xsl:value-of select="."/>
715                                                 <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
716                                             </xsl:for-each>
717                                         </xsl:otherwise>
718                                     </xsl:choose>
719                                     <xsl:text>]</xsl:text>
720                                 </span>
721                             </xsl:if>
722                         </li>
723                     </xsl:for-each>
724                 </ul>
725             </span>
726         </xsl:if>
727
728             <!-- #13382 Added Contained Works 7xx@ind2=2 -->
729             <xsl:if test="marc:datafield[@tag=700][@ind2=2 and not(marc:subfield[@code='i'])] or marc:datafield[@tag=710][@ind2=2 and not(marc:subfield[@code='i'])] or marc:datafield[@tag=711][@ind2=2 and not(marc:subfield[@code='i'])]">
730                 <span class="results_summary contained_works">
731                     <span class="label">Contained works: </span>
732                     <ul class="resource_list">
733                         <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'])]">
734                             <li>
735                                 <xsl:variable name="str">
736                                     <xsl:call-template name="subfieldSelect">
737                                         <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
738                                     </xsl:call-template>
739                                 </xsl:variable>
740                                 <xsl:call-template name="chopPunctuation">
741                                     <xsl:with-param name="chopString">
742                                         <xsl:value-of select="$str"/>
743                                     </xsl:with-param>
744                                 </xsl:call-template>
745                                 <!-- add relator code too between brackets-->
746                                 <xsl:if test="marc:subfield[@code='4' or @code='e']">
747                                     <span class="relatorcode">
748                                         <xsl:text> [</xsl:text>
749                                         <xsl:choose>
750                                             <xsl:when test="marc:subfield[@code='e']">
751                                                 <xsl:for-each select="marc:subfield[@code='e']">
752                                                     <xsl:value-of select="."/>
753                                                     <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
754                                                 </xsl:for-each>
755                                             </xsl:when>
756                                             <xsl:otherwise>
757                                                 <xsl:for-each select="marc:subfield[@code='4']">
758                                                     <xsl:value-of select="."/>
759                                                     <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
760                                                 </xsl:for-each>
761                                             </xsl:otherwise>
762                                         </xsl:choose>
763                                         <xsl:text>]</xsl:text>
764                                     </span>
765                                 </xsl:if>
766                             </li>
767                         </xsl:for-each>
768                     </ul>
769                 </span>
770             </xsl:if>
771
772             <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
773                 <span class="results_summary subjects">
774                     <span class="label">Subject(s): </span>
775                     <ul class="resource_list">
776                         <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
777                             <li>
778                                 <span property="keywords">
779                                     <a>
780                                         <xsl:attribute name="class">subject</xsl:attribute>
781                                         <xsl:choose>
782                                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
783                                                 <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>
784                                             </xsl:when>
785                                             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
786                                             <xsl:when test="$TraceSubjectSubdivisions='1'">
787                                                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
788                                                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
789                                                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
790                                                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
791                                                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
792                                                         <xsl:with-param name="urlencode">1</xsl:with-param>
793                                                     </xsl:call-template>
794                                                 </xsl:attribute>
795                                             </xsl:when>
796                                             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
797                                             <xsl:otherwise>
798                                                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='a'],'()',''), true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
799                                             </xsl:otherwise>
800                                         </xsl:choose>
801                                         <xsl:call-template name="chopPunctuation">
802                                             <xsl:with-param name="chopString">
803                                                 <xsl:call-template name="subfieldSelect">
804                                                     <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
805                                                     <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
806                                                     <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
807                                                 </xsl:call-template>
808                                             </xsl:with-param>
809                                         </xsl:call-template>
810                                     </a>
811                                 </span>
812                                 <xsl:if test="marc:subfield[@code=9]">
813                                     <a class='authlink'>
814                                         <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
815                                         <xsl:element name="i">
816                                             <xsl:attribute name="class">fa fa-search</xsl:attribute>
817                                         </xsl:element>
818                                     </a>
819                                 </xsl:if>
820                             </li>
821                         </xsl:for-each>
822                     </ul>
823                 </span>
824             </xsl:if>
825
826         <!-- Genre/Form -->
827         <xsl:if test="marc:datafield[@tag=655]">
828             <span class="results_summary genre">
829                 <span class="label">Genre/Form: </span>
830                 <ul class="resource_list">
831                     <xsl:for-each select="marc:datafield[@tag=655]">
832                         <li>
833                             <a>
834                                 <xsl:choose>
835                                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
836                                         <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>
837                                     </xsl:when>
838                                     <xsl:when test="$TraceSubjectSubdivisions='1'">
839                                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
840                                             <xsl:with-param name="codes">avxyz</xsl:with-param>
841                                             <xsl:with-param name="delimeter"> AND </xsl:with-param>
842                                             <xsl:with-param name="prefix">(index-term-genre<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
843                                             <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
844                                             <xsl:with-param name="urlencode">1</xsl:with-param>
845                                         </xsl:call-template>
846                                         </xsl:attribute>
847                                     </xsl:when>
848                                     <xsl:otherwise>
849                                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=index-term-genre<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
850                                     </xsl:otherwise>
851                                 </xsl:choose>
852                                 <xsl:call-template name="subfieldSelect">
853                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
854                                     <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
855                                     <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
856                                 </xsl:call-template>
857                             </a>
858                             <xsl:if test="marc:subfield[@code=9]">
859                                 <xsl:text> </xsl:text>
860                                 <a class='authlink'>
861                                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
862                                     <xsl:element name="i">
863                                         <xsl:attribute name="class">fa fa-search</xsl:attribute>
864                                     </xsl:element>
865                                 </a>
866                             </xsl:if>
867                         </li>
868                     </xsl:for-each>
869                 </ul>
870             </span>
871         </xsl:if>
872
873 <!-- MARC21 776 Additional Physical Form Entry -->
874     <xsl:if test="marc:datafield[@tag=776]">
875         <span class="results_summary add_physical_form">
876             <span class="label">Additional physical formats: </span>
877             <xsl:for-each select="marc:datafield[@tag=776]">
878                 <xsl:variable name="linktext">
879                     <xsl:choose>
880                     <xsl:when test="marc:subfield[@code='t']">
881                         <xsl:value-of select="marc:subfield[@code='t']"/>
882                     </xsl:when>
883                     <xsl:when test="marc:subfield[@code='a']">
884                         <xsl:value-of select="marc:subfield[@code='a']"/>
885                     </xsl:when>
886                     <xsl:otherwise>
887                         <xsl:text>No title</xsl:text>
888                     </xsl:otherwise>
889                     </xsl:choose>
890                 </xsl:variable>
891                 <xsl:if test="@ind2=8 and marc:subfield[@code='i']">
892                     <xsl:call-template name="subfieldSelect">
893                         <xsl:with-param name="codes">i</xsl:with-param>
894                     </xsl:call-template>
895                     <xsl:text>: </xsl:text>
896                 </xsl:if>
897                 <xsl:choose>
898                 <xsl:when test="marc:subfield[@code='w']">
899                     <a>
900                     <xsl:attribute name="href">
901                         <xsl:text>/cgi-bin/koha/opac-search.pl?q=control-number:</xsl:text>
902                         <xsl:call-template name="extractControlNumber">
903                             <xsl:with-param name="subfieldW">
904                                 <xsl:value-of select="marc:subfield[@code='w']"/>
905                             </xsl:with-param>
906                         </xsl:call-template>
907                     </xsl:attribute>
908                     <xsl:value-of select="$linktext"/>
909                     </a>
910                 </xsl:when>
911                 <xsl:otherwise>
912                     <xsl:value-of select="$linktext"/>
913                 </xsl:otherwise>
914                 </xsl:choose>
915                 <xsl:if test="position() != last()">
916                     <xsl:text>; </xsl:text>
917                 </xsl:if>
918             </xsl:for-each>
919         </span>
920     </xsl:if>
921
922 <!-- MARC21 777 - Issued With Entry -->
923     <xsl:if test="marc:datafield[@tag=777]">
924         <xsl:for-each select="marc:datafield[@tag=777]">
925             <xsl:if test="@ind1 != 1">
926                 <span class="results_summary issued_with">
927                     <span class="label">
928                         <xsl:choose>
929                             <xsl:when test="@ind2=8 and marc:subfield[@code='i']">
930                                 <xsl:value-of select="marc:subfield[@code='i']"/>
931                             </xsl:when>
932                             <xsl:otherwise>
933                                 <xsl:text>Issued with:</xsl:text>
934                             </xsl:otherwise>
935                         </xsl:choose>
936                         <xsl:text> </xsl:text>
937                     </span>
938                     <xsl:variable name="f777">
939                         <xsl:call-template name="chopPunctuation">
940                             <xsl:with-param name="chopString">
941                                 <xsl:call-template name="subfieldSelect">
942                                     <xsl:with-param name="codes">a_t</xsl:with-param>
943                                 </xsl:call-template>
944                             </xsl:with-param>
945                         </xsl:call-template>
946                     </xsl:variable>
947                     <xsl:choose>
948                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
949                             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
950                             <xsl:value-of select="translate($f777, '()', '')"/>
951                             </a>
952                         </xsl:when>
953                         <xsl:otherwise>
954                             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(marc:subfield[@code='t'], true())"/></xsl:attribute>
955                             <xsl:value-of select="$f777"/>
956                             </a>
957                         </xsl:otherwise>
958                     </xsl:choose>
959                     <xsl:if test="marc:subfield[@code='g']">
960                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
961                     </xsl:if>
962                 </span>
963                 <xsl:if test="marc:subfield[@code='n']">
964                     <xsl:text> </xsl:text><span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
965                 </xsl:if>
966             </xsl:if>
967         </xsl:for-each>
968     </xsl:if>
969
970 <!-- DDC classification -->
971     <xsl:if test="marc:datafield[@tag=082]">
972         <span class="results_summary ddc">
973             <span class="label">DDC classification: </span>
974             <ul class="resource_list">
975                 <xsl:for-each select="marc:datafield[@tag=082]">
976                     <li>
977                         <xsl:call-template name="subfieldSelect">
978                             <xsl:with-param name="codes">a2b</xsl:with-param>
979                             <xsl:with-param name="delimeter"><xsl:text>&#160;</xsl:text></xsl:with-param>
980                         </xsl:call-template>
981                     </li>
982                 </xsl:for-each>
983             </ul>
984         </span>
985     </xsl:if>
986
987 <!-- LOC classification -->
988     <xsl:if test="marc:datafield[@tag=050]">
989         <span class="results_summary loc">
990             <span class="label">LOC classification: </span>
991             <ul class="resource_list">
992                 <xsl:for-each select="marc:datafield[@tag=050]">
993                     <li>
994                         <xsl:call-template name="subfieldSelect">
995                             <xsl:with-param name="codes">ab</xsl:with-param>
996                             <xsl:with-param name="delimeter"><xsl:text>&#160;</xsl:text></xsl:with-param>
997                         </xsl:call-template>
998                     </li>
999                 </xsl:for-each>
1000             </ul>
1001         </span>
1002     </xsl:if>
1003
1004 <!-- NLM classification -->
1005     <xsl:if test="marc:datafield[@tag=060]">
1006         <span class="results_summary nlm">
1007             <span class="label">NLM classification: </span>
1008             <ul class="resource_list">
1009                 <xsl:for-each select="marc:datafield[@tag=060]">
1010                     <li>
1011                     <xsl:call-template name="subfieldSelect">
1012                         <xsl:with-param name="codes">a</xsl:with-param>
1013                         <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
1014                     </xsl:call-template>
1015                     </li>
1016                 </xsl:for-each>
1017             </ul>
1018         </span>
1019     </xsl:if>
1020
1021 <!-- Other classification -->
1022     <xsl:if test="marc:datafield[@tag=084]">
1023         <span class="results_summary oc">
1024             <span class="label">Other classification: </span>
1025             <ul class="resource_list">
1026                 <xsl:for-each select="marc:datafield[@tag=084]">
1027                     <li>
1028                         <xsl:call-template name="subfieldSelect">
1029                         <xsl:with-param name="codes">a</xsl:with-param>
1030                             <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
1031                         </xsl:call-template>
1032                     </li>
1033                 </xsl:for-each>
1034             </ul>
1035        </span>
1036     </xsl:if>
1037
1038
1039     <!-- Image processing code added here, takes precedence over text links including y3z text   -->
1040     <xsl:if test="marc:datafield[@tag=856]">
1041         <span class="results_summary online_resources">
1042             <span class="label">Online resources: </span>
1043                 <ul class="resource_list">
1044                     <xsl:for-each select="marc:datafield[@tag=856]">
1045                         <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
1046                         <li>
1047                             <a property="url">
1048                                 <xsl:choose>
1049                                     <xsl:when test="$OPACTrackClicks='track'">
1050                                         <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1051                                     </xsl:when>
1052                                     <xsl:when test="$OPACTrackClicks='anonymous'">
1053                                         <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1054                                     </xsl:when>
1055                                     <xsl:otherwise>
1056                                         <xsl:attribute name="href">
1057                                             <xsl:call-template name="AddMissingProtocol">
1058                                                 <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/>
1059                                                 <xsl:with-param name="indicator1" select="@ind1"/>
1060                                                 <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/>
1061                                             </xsl:call-template>
1062                                             <xsl:value-of select="marc:subfield[@code='u']"/>
1063                                         </xsl:attribute>
1064                                     </xsl:otherwise>
1065                                 </xsl:choose>
1066                                 <xsl:if test="$OPACURLOpenInNewWindow='1'">
1067                                     <xsl:attribute name="target">_blank</xsl:attribute>
1068                                 </xsl:if>
1069                                 <xsl:choose>
1070                                     <xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
1071                                         <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
1072                                     </xsl:when>
1073                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1074                                         <xsl:call-template name="subfieldSelect">
1075                                             <xsl:with-param name="codes">y3z</xsl:with-param>
1076                                         </xsl:call-template>
1077                                     </xsl:when>
1078                                     <xsl:when test="$URLLinkText!=''">
1079                                         <xsl:value-of select="$URLLinkText"/>
1080                                     </xsl:when>
1081                                     <xsl:otherwise>
1082                                         <xsl:text>Click here to access online</xsl:text>
1083                                     </xsl:otherwise>
1084                                 </xsl:choose>
1085                             </a>
1086                         </li>
1087                     </xsl:for-each>
1088                 </ul>
1089             </span>
1090         </xsl:if>
1091
1092         <!--  787 Other Relationship Entry  -->
1093         <xsl:if test="marc:datafield[@tag=787]">
1094         <span class="results_summary other_relationship_entry"><span class="label">Other related works: </span>
1095         <xsl:for-each select="marc:datafield[@tag=787]">
1096             <span class="other_relationship_entry">
1097                 <xsl:variable name="f787">
1098                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1099                     <xsl:with-param name="codes">a_t</xsl:with-param>
1100                     </xsl:call-template></xsl:with-param></xsl:call-template>
1101                 </xsl:variable>
1102                 <xsl:if test="marc:subfield[@code='i']">
1103                     <xsl:call-template name="subfieldSelect">
1104                         <xsl:with-param name="codes">i</xsl:with-param>
1105                     </xsl:call-template>
1106                     <xsl:text>: </xsl:text>
1107                 </xsl:if>
1108                 <xsl:choose>
1109                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1110                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
1111                         <xsl:value-of select="$f787"/>
1112                     </a>
1113                 </xsl:when>
1114                 <xsl:otherwise>
1115                     <xsl:variable name="relation_query">
1116                         <xsl:text>ti,phr:(</xsl:text>
1117                         <xsl:call-template name="quote_search_term">
1118                             <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param>
1119                         </xsl:call-template>
1120                         <xsl:text>)</xsl:text>
1121                         <xsl:if test="marc:subfield[@code='a']">
1122                             <xsl:text> AND au:(</xsl:text>
1123                             <xsl:call-template name="quote_search_term">
1124                                 <xsl:with-param name="term">
1125                                     <xsl:value-of select="marc:subfield[@code='a']"/>
1126                                 </xsl:with-param>
1127                             </xsl:call-template>
1128                             <xsl:text>)</xsl:text>
1129                         </xsl:if>
1130                     </xsl:variable>
1131                     <a>
1132                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" />
1133                     </xsl:attribute>
1134                         <xsl:value-of select="$f787"/>
1135                     </a>
1136                 </xsl:otherwise>
1137                 </xsl:choose>
1138                 <xsl:choose>
1139                     <xsl:when test="position()=last()"></xsl:when>
1140                     <xsl:otherwise><span class="separator"><xsl:text>; </xsl:text></span></xsl:otherwise>
1141                 </xsl:choose>
1142             </span>
1143         </xsl:for-each>
1144         </span>
1145         </xsl:if>
1146
1147         <!-- 530 -->
1148         <xsl:if test="marc:datafield[@tag=530]">
1149             <span class="results_summary additionalforms">
1150                 <span class="label">Available additional physical forms:</span>
1151                 <ul class="resource_list">
1152                     <xsl:for-each select="marc:datafield[@tag=530]">
1153                         <li>
1154                             <xsl:call-template name="subfieldSelect">
1155                                 <xsl:with-param name="codes">abcd</xsl:with-param>
1156                             </xsl:call-template>
1157                             <xsl:if test="marc:subfield[@code='u']">
1158                                 <xsl:for-each select="marc:subfield[@code='u']">
1159                                     <xsl:text> </xsl:text>
1160                                     <a>
1161                                         <xsl:attribute name="href"><xsl:value-of select="text()"/></xsl:attribute>
1162                                         <xsl:if test="$OPACURLOpenInNewWindow='1'">
1163                                             <xsl:attribute name="target">_blank</xsl:attribute>
1164                                         </xsl:if>
1165                                         <xsl:value-of select="text()"/>
1166                                     </a>
1167                                 </xsl:for-each>
1168                             </xsl:if>
1169                         </li>
1170                     </xsl:for-each>
1171                 </ul>
1172             </span>
1173         </xsl:if>
1174
1175         <!-- 505 - Formatted contents note -->
1176         <xsl:if test="marc:datafield[@tag=505]">
1177             <div class="results_summary contents">
1178                 <xsl:for-each select="marc:datafield[@tag=505]">
1179                     <xsl:if test="position()=1">
1180                         <xsl:choose>
1181                         <xsl:when test="@ind1=1">
1182                             <span class="label">Incomplete contents:</span>
1183                         </xsl:when>
1184                         <xsl:when test="@ind1=2">
1185                             <span class="label">Partial contents:</span>
1186                         </xsl:when>
1187                         <xsl:otherwise>
1188                             <span class="label">Contents:</span>
1189                         </xsl:otherwise>
1190                         </xsl:choose>
1191                     </xsl:if>
1192                     <div class='contentblock' property='description'>
1193                         <xsl:choose>
1194                             <xsl:when test="@ind2=0">
1195                                 <xsl:call-template name="subfieldSelectSpan">
1196                                     <xsl:with-param name="newline">1</xsl:with-param>
1197                                     <xsl:with-param name="codes">trug</xsl:with-param>
1198                                 </xsl:call-template>
1199                             </xsl:when>
1200                             <xsl:otherwise>
1201                                 <xsl:call-template name="subfieldSelectSpan">
1202                                     <xsl:with-param name="newline">1</xsl:with-param>
1203                                     <xsl:with-param name="codes">atrug</xsl:with-param>
1204                                 </xsl:call-template>
1205                             </xsl:otherwise>
1206                         </xsl:choose>
1207                     </div>
1208                 </xsl:for-each>
1209             </div>
1210         </xsl:if>
1211
1212         <!-- 583 -->
1213         <xsl:if test="marc:datafield[@tag=583 and not(@ind1=0)]">
1214             <span class="results_summary actionnote">
1215                 <span class="label">Action note: </span>
1216                 <ul class="resource_list">
1217                     <xsl:for-each select="marc:datafield[@tag=583 and not(@ind1=0)]">
1218                         <li>
1219                             <xsl:choose>
1220                                 <xsl:when test="marc:subfield[@code='z']">
1221                                     <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
1222                                 </xsl:when>
1223                                 <xsl:otherwise>
1224                                     <xsl:call-template name="subfieldSelect">
1225                                         <xsl:with-param name="codes">abcdefghijklnou</xsl:with-param>
1226                                     </xsl:call-template>
1227                                 </xsl:otherwise>
1228                             </xsl:choose>
1229                         </li>
1230                     </xsl:for-each>
1231                 </ul>
1232             </span>
1233         </xsl:if>
1234
1235         <!-- 508 -->
1236         <xsl:if test="marc:datafield[@tag=508]">
1237             <span class="results_summary prod_credits">
1238                 <span class="label">Production credits: </span>
1239                 <ul class="resource_list">
1240                     <xsl:for-each select="marc:datafield[@tag=508]">
1241                         <li>
1242                             <xsl:call-template name="subfieldSelectSpan">
1243                                 <xsl:with-param name="codes">a</xsl:with-param>
1244                             </xsl:call-template>
1245                         </li>
1246                     </xsl:for-each>
1247                 </ul>
1248             </span>
1249         </xsl:if>
1250
1251         <!-- 586 -->
1252         <xsl:if test="marc:datafield[@tag=586]">
1253             <span class="results_summary awardsnote">
1254                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
1255                     <span class="label">Awards: </span>
1256                 </xsl:if>
1257                 <ul class="resource_list">
1258                     <xsl:for-each select="marc:datafield[@tag=586]">
1259                         <li>
1260                             <xsl:value-of select="marc:subfield[@code='a']"/>
1261                         </li>
1262                     </xsl:for-each>
1263                 </ul>
1264             </span>
1265         </xsl:if>
1266
1267         <xsl:call-template name="host-item-entries">
1268             <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
1269         </xsl:call-template>
1270
1271         <xsl:for-each select="marc:datafield[@tag=511]">
1272             <span class="results_summary perf_note">
1273                 <span class="label">
1274                     <xsl:if test="@ind1=1"><xsl:text>Cast: </xsl:text></xsl:if>
1275                 </span>
1276                 <xsl:call-template name="subfieldSelect">
1277                     <xsl:with-param name="codes">a</xsl:with-param>
1278                 </xsl:call-template>
1279             </span>
1280         </xsl:for-each>
1281
1282         <xsl:if test="marc:datafield[@tag=502]">
1283             <span class="results_summary diss_note">
1284                 <span class="label">Dissertation note: </span>
1285                 <xsl:for-each select="marc:datafield[@tag=502]">
1286                     <xsl:call-template name="subfieldSelect">
1287                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1288                     </xsl:call-template>
1289                 </xsl:for-each>
1290                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1291             </span>
1292         </xsl:if>
1293
1294         <!-- 520 - Summary, etc. -->
1295         <xsl:for-each select="marc:datafield[@tag=520]">
1296             <span class="results_summary summary">
1297                 <span class="label">
1298                     <xsl:choose>
1299                         <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
1300                         <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
1301                         <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
1302                         <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
1303                         <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
1304                         <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
1305                     </xsl:choose>
1306                 </span>
1307                 <xsl:call-template name="subfieldSelect">
1308                     <xsl:with-param name="codes">abc</xsl:with-param>
1309                 </xsl:call-template>
1310                 <xsl:if test="marc:subfield[@code='u']">
1311                     <xsl:for-each select="marc:subfield[@code='u']">
1312                         <xsl:text> </xsl:text>
1313                         <a>
1314                             <xsl:attribute name="href"><xsl:value-of select="text()"/></xsl:attribute>
1315                             <xsl:value-of select="text()"/>
1316                         </a>
1317                     </xsl:for-each>
1318                 </xsl:if>
1319             </span>
1320         </xsl:for-each>
1321
1322         <!-- Content Warning -->
1323         <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/>
1324         <xsl:if test="marc:datafield[@tag=$ContentWarningField]">
1325            <span class="results_summary content_warning">
1326                <span class="label">Content warning: </span>
1327                <xsl:for-each select="marc:datafield[@tag=$ContentWarningField]">
1328                    <xsl:choose>
1329                        <xsl:when test="marc:subfield[@code='u']">
1330                            <a>
1331                                <xsl:attribute name="href">
1332                                    <xsl:value-of select="marc:subfield[@code='u']"/>
1333                                </xsl:attribute>
1334                                <xsl:choose>
1335                                    <xsl:when test="marc:subfield[@code='a']">
1336                                        <xsl:value-of select="marc:subfield[@code='a']"/>
1337                                    </xsl:when>
1338                                    <xsl:otherwise>
1339                                        <xsl:value-of select="marc:subfield[@code='u']"/>
1340                                    </xsl:otherwise>
1341                                </xsl:choose>
1342                            </a>
1343                            <xsl:text> </xsl:text>
1344                        </xsl:when>
1345                        <xsl:when test="not(marc:subfield[@code='u']) and marc:subfield[@code='a']">
1346                            <xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text>
1347                        </xsl:when>
1348                    </xsl:choose>
1349                    <xsl:call-template name="subfieldSelect">
1350                         <xsl:with-param name="codes">bcdefghijklmnopqrstvwyz</xsl:with-param>
1351                    </xsl:call-template>
1352                    <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1353                </xsl:for-each>
1354            </span>
1355         </xsl:if>
1356
1357         <!-- 866 textual holdings -->
1358         <xsl:if test="marc:datafield[@tag=866]">
1359             <span class="results_summary holdings_note basic_bibliographic_unit"><span class="label">Holdings: </span>
1360                 <xsl:for-each select="marc:datafield[@tag=866]">
1361                     <span class="holdings_note_data">
1362                         <xsl:call-template name="subfieldSelect">
1363                             <xsl:with-param name="codes">az</xsl:with-param>
1364                         </xsl:call-template>
1365                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1366                     </span>
1367                 </xsl:for-each>
1368             </span>
1369         </xsl:if>
1370
1371         <!-- 867 textual holdings -->
1372         <xsl:if test="marc:datafield[@tag=867]">
1373             <span class="results_summary holdings_note supplementary_material"><span class="label">Supplements: </span>
1374                 <xsl:for-each select="marc:datafield[@tag=867]">
1375                     <span class="holdings_note_data">
1376                         <xsl:call-template name="subfieldSelect">
1377                             <xsl:with-param name="codes">az</xsl:with-param>
1378                         </xsl:call-template>
1379                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1380                     </span>
1381                 </xsl:for-each>
1382             </span>
1383         </xsl:if>
1384
1385         <!-- 868 textual holdings -->
1386         <xsl:if test="marc:datafield[@tag=868]">
1387             <span class="results_summary holdings_note indexes"><span class="label">Indexes: </span>
1388                 <xsl:for-each select="marc:datafield[@tag=868]">
1389                     <span class="holdings_note_data">
1390                         <xsl:call-template name="subfieldSelect">
1391                             <xsl:with-param name="codes">az</xsl:with-param>
1392                         </xsl:call-template>
1393                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1394                     </span>
1395                 </xsl:for-each>
1396             </span>
1397         </xsl:if>
1398
1399         <!-- 765 - Original language entry -->
1400         <xsl:for-each select="marc:datafield[@tag=765]">
1401             <span class="results_summary original_language_entry">
1402                 <xsl:choose>
1403                     <xsl:when test="@ind2!=8 or not(marc:subfield[@code='i'])">
1404                         <!-- fallback to this label too if 765$i is empty -->
1405                         <span class="label">Translation of: </span>
1406                     </xsl:when>
1407                     <xsl:otherwise>
1408                         <span class="label">
1409                             <xsl:value-of select="marc:subfield[@code='i']"/>
1410                             <xsl:text>: </xsl:text>
1411                         </span>
1412                     </xsl:otherwise>
1413                 </xsl:choose>
1414                 <span class="original_language_entry_data">
1415                     <xsl:variable name="href">
1416                         <!-- call template to get href of search URL -->
1417                         <xsl:call-template name="GetCnumSearchURL">
1418                             <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
1419                             <xsl:with-param name="opac_url" select="1"/>
1420                         </xsl:call-template>
1421                     </xsl:variable>
1422                     <xsl:variable name="f765">
1423                         <xsl:call-template name="subfieldSelect">
1424                             <xsl:with-param name="codes">tad</xsl:with-param>
1425                             <xsl:with-param name="delimeter">, </xsl:with-param>
1426                         </xsl:call-template>
1427                     </xsl:variable>
1428                     <xsl:choose>
1429                         <xsl:when test="$href">
1430                             <a>
1431                                 <xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>
1432                                 <xsl:value-of select="$f765"/>
1433                             </a>
1434                         </xsl:when>
1435                         <xsl:otherwise>
1436                             <xsl:value-of select="$f765"/>
1437                         </xsl:otherwise>
1438                     </xsl:choose>
1439                 </span>
1440             </span>
1441         </xsl:for-each>
1442         <!-- End of 765 - Original language entry -->
1443
1444         <!-- 770 - Supplement/Special issue entry -->
1445         <xsl:if test="marc:datafield[@tag=770]">
1446             <span class="results_summary supplement">
1447                 <span class="label">Supplement: </span>
1448                 <ul class="resource_list">
1449                     <xsl:for-each select="marc:datafield[@tag=770]">
1450                         <li>
1451                             <xsl:if test="marc:subfield[@code='i']">
1452                                 <span class="770_rel_info">
1453                                     <xsl:call-template name="subfieldSelect">
1454                                         <xsl:with-param name="codes">i</xsl:with-param>
1455                                     </xsl:call-template>
1456                                     <xsl:text> </xsl:text>
1457                                 </span>
1458                             </xsl:if>
1459                             <a>
1460                                 <xsl:choose>
1461                                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1462                                         <xsl:attribute name="href">
1463                                             /cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template>
1464                                         </xsl:attribute>
1465                                     </xsl:when>
1466                                     <xsl:otherwise>
1467                                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
1468                                     </xsl:otherwise>
1469                                 </xsl:choose>
1470                                 <xsl:choose>
1471                                     <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1472                                         <xsl:call-template name="subfieldSelect">
1473                                             <xsl:with-param name="codes">a_t</xsl:with-param>
1474                                         </xsl:call-template>
1475                                     </xsl:when>
1476                                 </xsl:choose>
1477                             </a>
1478                             <xsl:text> </xsl:text>
1479                             <xsl:call-template name="subfieldSelect">
1480                                 <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1481                             </xsl:call-template>
1482                         </li>
1483                     </xsl:for-each>
1484                 </ul>
1485             </span>
1486         </xsl:if>
1487
1488         <!-- 772 - Supplement parent entry -->
1489         <xsl:if test="marc:datafield[@tag=772]">
1490             <span class="results_summary supplement_parent">
1491                 <span class="label">Supplement to: </span>
1492                 <ul class="resource_list">
1493                     <xsl:for-each select="marc:datafield[@tag=772]">
1494                         <li>
1495                             <xsl:if test="marc:subfield[@code='i']">
1496                                 <span class="772_rel_info">
1497                                     <xsl:call-template name="subfieldSelect">
1498                                         <xsl:with-param name="codes">i</xsl:with-param>
1499                                     </xsl:call-template>
1500                                     <xsl:text> </xsl:text>
1501                                 </span>
1502                             </xsl:if>
1503                             <a>
1504                                 <xsl:choose>
1505                                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1506                                         <xsl:attribute name="href">
1507                                             /cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template>
1508                                         </xsl:attribute>
1509                                     </xsl:when>
1510                                     <xsl:otherwise>
1511                                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
1512                                     </xsl:otherwise>
1513                                 </xsl:choose>
1514                                 <xsl:choose>
1515                                     <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1516                                         <xsl:call-template name="subfieldSelect">
1517                                             <xsl:with-param name="codes">a_t</xsl:with-param>
1518                                         </xsl:call-template>
1519                                     </xsl:when>
1520                                 </xsl:choose>
1521                             </a>
1522                             <xsl:call-template name="subfieldSelect">
1523                                 <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1524                             </xsl:call-template>
1525                         </li>
1526                     </xsl:for-each>
1527                 </ul>
1528             </span>
1529         </xsl:if>
1530
1531         <!--  775 Other Edition  -->
1532         <xsl:if test="marc:datafield[@tag=775]">
1533         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1534         <xsl:for-each select="marc:datafield[@tag=775]">
1535             <xsl:variable name="f775">
1536                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1537                 <xsl:with-param name="codes">a_t</xsl:with-param>
1538                 </xsl:call-template></xsl:with-param></xsl:call-template>
1539             </xsl:variable>
1540             <xsl:if test="marc:subfield[@code='i']">
1541                 <xsl:call-template name="subfieldSelect">
1542                     <xsl:with-param name="codes">i</xsl:with-param>
1543                 </xsl:call-template>
1544                 <xsl:text>: </xsl:text>
1545             </xsl:if>
1546             <a>
1547             <xsl:choose>
1548             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1549                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
1550             </xsl:when>
1551             <xsl:otherwise>
1552                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f775, '()', ''), true())"/></xsl:attribute>
1553             </xsl:otherwise>
1554             </xsl:choose>
1555             <xsl:call-template name="subfieldSelect">
1556                 <xsl:with-param name="codes">a_t</xsl:with-param>
1557             </xsl:call-template>
1558             </a>
1559             <xsl:choose>
1560                 <xsl:when test="position()=last()"></xsl:when>
1561                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1562             </xsl:choose>
1563         </xsl:for-each>
1564         </span>
1565         </xsl:if>
1566
1567         <!-- 780 -->
1568         <xsl:if test="marc:datafield[@tag=780]">
1569             <xsl:for-each select="marc:datafield[@tag=780]">
1570                 <xsl:if test="@ind1=0">
1571                     <span class="results_summary preceeding_entry">
1572                         <xsl:choose>
1573                             <xsl:when test="@ind2=0">
1574                                 <span class="label">Continues:</span>
1575                             </xsl:when>
1576                             <xsl:when test="@ind2=1">
1577                                 <span class="label">Continues in part:</span>
1578                             </xsl:when>
1579                             <xsl:when test="@ind2=2">
1580                                 <span class="label">Supersedes:</span>
1581                             </xsl:when>
1582                             <xsl:when test="@ind2=3">
1583                                 <span class="label">Supersedes in part:</span>
1584                             </xsl:when>
1585                             <xsl:when test="@ind2=4">
1586                                 <span class="label">Formed by the union: ... and: ...</span>
1587                             </xsl:when>
1588                             <xsl:when test="@ind2=5">
1589                                 <span class="label">Absorbed:</span>
1590                             </xsl:when>
1591                             <xsl:when test="@ind2=6">
1592                                 <span class="label">Absorbed in part:</span>
1593                             </xsl:when>
1594                             <xsl:when test="@ind2=7">
1595                                 <span class="label">Separated from:</span>
1596                             </xsl:when>
1597                         </xsl:choose>
1598                         <xsl:text> </xsl:text>
1599
1600                         <xsl:if test="marc:subfield[@code='i']">
1601                             <span class="780_rel_info">
1602                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1603                                     <xsl:text> </xsl:text>
1604                             </span>
1605                         </xsl:if>
1606
1607                         <xsl:variable name="f780">
1608                             <xsl:call-template name="subfieldSelect">
1609                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1610                             </xsl:call-template>
1611                         </xsl:variable>
1612
1613                         <xsl:choose>
1614                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1615                                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
1616                                     <xsl:value-of select="$f780"/>
1617                                 </a>
1618                             </xsl:when>
1619                             <xsl:otherwise>
1620                                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute>
1621                                     <xsl:value-of select="$f780"/>
1622                                 </a>
1623                             </xsl:otherwise>
1624                         </xsl:choose>
1625                     </span>
1626
1627                     <xsl:if test="marc:subfield[@code='n']">
1628                         <span class="results_summary preceeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1629                     </xsl:if>
1630
1631                 </xsl:if>
1632             </xsl:for-each>
1633         </xsl:if>
1634
1635         <!-- 785 -->
1636         <xsl:if test="marc:datafield[@tag=785]">
1637             <xsl:for-each select="marc:datafield[@tag=785]">
1638                 <xsl:if test="@ind1=0">
1639                     <span class="results_summary succeeding_entry">
1640                         <xsl:choose>
1641                             <xsl:when test="@ind2=0">
1642                                 <span class="label">Continued by:</span>
1643                             </xsl:when>
1644                             <xsl:when test="@ind2=1">
1645                                 <span class="label">Continued in part by:</span>
1646                             </xsl:when>
1647                             <xsl:when test="@ind2=2">
1648                                 <span class="label">Superseded by:</span>
1649                             </xsl:when>
1650                             <xsl:when test="@ind2=3">
1651                                 <span class="label">Superseded in part by:</span>
1652                             </xsl:when>
1653                             <xsl:when test="@ind2=4">
1654                                 <span class="label">Absorbed by:</span>
1655                             </xsl:when>
1656                             <xsl:when test="@ind2=5">
1657                                 <span class="label">Absorbed in part by:</span>
1658                             </xsl:when>
1659                             <xsl:when test="@ind2=6">
1660                                 <span class="label">Split into .. and ...:</span>
1661                             </xsl:when>
1662                             <xsl:when test="@ind2=7">
1663                                 <span class="label">Merged with ... to form ...</span>
1664                             </xsl:when>
1665                             <xsl:when test="@ind2=8">
1666                                 <span class="label">Changed back to:</span>
1667                             </xsl:when>
1668                         </xsl:choose>
1669                         <xsl:text> </xsl:text>
1670
1671                         <xsl:if test="marc:subfield[@code='i']">
1672                             <span class="785_rel_info">
1673                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1674                                 <xsl:text> </xsl:text>
1675                             </span>
1676                         </xsl:if>
1677
1678                         <xsl:variable name="f785">
1679                             <xsl:call-template name="subfieldSelect">
1680                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1681                             </xsl:call-template>
1682                         </xsl:variable>
1683
1684                         <xsl:choose>
1685                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1686                                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
1687                                     <xsl:value-of select="$f785"/>
1688                                 </a>
1689                             </xsl:when>
1690                             <xsl:otherwise>
1691                                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute>
1692                                     <xsl:value-of select="$f785"/>
1693                                 </a>
1694                             </xsl:otherwise>
1695                         </xsl:choose>
1696                     </span>
1697
1698                     <xsl:if test="marc:subfield[@code='n']">
1699                         <span class="results_summary succeeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1700                     </xsl:if>
1701
1702                 </xsl:if>
1703             </xsl:for-each>
1704         </xsl:if>
1705
1706         <!-- OpenURL -->
1707         <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1708         <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1709         <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1710         <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
1711
1712         <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
1713           <xsl:variable name="openurltext">
1714             <xsl:choose>
1715               <xsl:when test="$OpenURLText != ''">
1716                 <xsl:value-of select="$OpenURLText" />
1717               </xsl:when>
1718               <xsl:otherwise>
1719                 <xsl:text>OpenURL</xsl:text>
1720               </xsl:otherwise>
1721             </xsl:choose>
1722           </xsl:variable>
1723
1724           <span class="results_summary"><a>
1725             <xsl:attribute name="href">
1726               <xsl:value-of select="$OpenURLResolverURL" />
1727             </xsl:attribute>
1728             <xsl:attribute name="title">
1729               <xsl:value-of select="$openurltext" />
1730             </xsl:attribute>
1731             <xsl:attribute name="class">
1732               <xsl:text>OpenURL</xsl:text>
1733             </xsl:attribute>
1734             <xsl:if test="$OPACURLOpenInNewWindow='1'">
1735               <xsl:attribute name="target">
1736                 <xsl:text>_blank</xsl:text>
1737               </xsl:attribute>
1738             </xsl:if>
1739             <xsl:choose>
1740               <xsl:when test="$OpenURLImageLocation != ''">
1741                 <img>
1742                   <xsl:attribute name="src">
1743                     <xsl:value-of select="$OpenURLImageLocation" />
1744                   </xsl:attribute>
1745                 </img>
1746               </xsl:when>
1747               <xsl:otherwise>
1748                 <xsl:value-of select="$openurltext" />
1749               </xsl:otherwise>
1750             </xsl:choose>
1751           </a></span>
1752         </xsl:if>
1753         <!-- End of OpenURL -->
1754
1755         <xsl:variable name="OPACShowMusicalInscripts" select="marc:sysprefs/marc:syspref[@name='OPACShowMusicalInscripts']" />
1756         <xsl:variable name="OPACPlayMusicalInscripts" select="marc:sysprefs/marc:syspref[@name='OPACPlayMusicalInscripts']" />
1757
1758         <xsl:if test="$OPACShowMusicalInscripts = 1 and marc:datafield[@tag=031]">
1759             <xsl:for-each select="marc:datafield[@tag=031]">
1760
1761                 <span class="results_summary musical_inscripts">
1762                     <xsl:if test="marc:subfield[@code='u']">
1763                         <span class="uri">
1764                             <a>
1765                                 <xsl:attribute name="href">
1766                                     <xsl:value-of select="marc:subfield[@code='u']"/>
1767                                 </xsl:attribute>
1768                                 <xsl:text>Audio file</xsl:text>
1769                             </a>
1770                         </span>
1771                     </xsl:if>
1772                     <xsl:if test="marc:subfield[@code='2'] and marc:subfield[@code='2']/text() = 'pe' and marc:subfield[@code='g'] and marc:subfield[@code='n'] and marc:subfield[@code='o'] and marc:subfield[@code='p']">
1773                         <div class="inscript" data-system="pae">
1774                             <xsl:attribute name="data-clef">
1775                                 <xsl:value-of select="marc:subfield[@code='g']"/>
1776                             </xsl:attribute>
1777                             <xsl:attribute name="data-keysig">
1778                                 <xsl:value-of select="marc:subfield[@code='n']"/>
1779                             </xsl:attribute>
1780                             <xsl:attribute name="data-timesig">
1781                                 <xsl:value-of select="marc:subfield[@code='o']"/>
1782                             </xsl:attribute>
1783                             <xsl:attribute name="data-notation">
1784                                 <xsl:value-of select="marc:subfield[@code='p']"/>
1785                             </xsl:attribute>
1786                         </div>
1787                         <xsl:if test="$OPACPlayMusicalInscripts = 1">
1788                             <div class="audio_controls hide">
1789                                 <button class="btn play_btn">
1790                                     <i id="carticon" class="fa fa-play"></i>
1791                                     <xsl:text> Play this sample</xsl:text>
1792                                 </button>
1793                             </div>
1794                         </xsl:if>
1795                     </xsl:if>
1796                 </span>
1797             </xsl:for-each>
1798             <xsl:if test="$OPACPlayMusicalInscripts = 1">
1799                 <div class="results_summary">
1800                     <span class="inscript_audio hide"></span>
1801                 </div>
1802             </xsl:if>
1803         </xsl:if>
1804
1805     </xsl:element>
1806     </xsl:template>
1807
1808     <xsl:template name="showAuthor">
1809         <xsl:param name="authorfield" />
1810         <xsl:param name="UseAuthoritiesForTracings" />
1811         <xsl:param name="AuthorLinkSortBy"/>
1812         <xsl:param name="AuthorLinkSortOrder"/>
1813         <xsl:param name="materialTypeLabel" />
1814         <xsl:param name="theme" />
1815         <xsl:if test="count($authorfield)&gt;0">
1816         <span class="results_summary author h3">
1817             <xsl:for-each select="$authorfield">
1818                 <xsl:choose>
1819                     <xsl:when test="position()&gt;1"/>
1820                     <!-- #13383 -->
1821                     <xsl:when test="@tag&lt;700"><span class="byAuthor">By: </span></xsl:when>
1822                     <!--#13382 Changed Additional author to contributor -->
1823                     <xsl:otherwise>Contributor(s): </xsl:otherwise>
1824                 </xsl:choose>
1825            </xsl:for-each>
1826             <ul class="resource_list">
1827             <xsl:for-each select="$authorfield">
1828             <li>
1829             <xsl:choose>
1830                 <xsl:when test="not(@tag=111) or @tag=700 or @tag=710 or @tag=711"/>
1831                 <xsl:when test="marc:subfield[@code='n']">
1832                     <xsl:text> </xsl:text>
1833                     <xsl:call-template name="subfieldSelect">
1834                         <xsl:with-param name="codes">n</xsl:with-param>
1835                     </xsl:call-template>
1836                     <xsl:text> </xsl:text>
1837                 </xsl:when>
1838             </xsl:choose>
1839             <a>
1840                 <xsl:choose>
1841                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1842                         <xsl:attribute name="href">
1843                             <xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
1844                             <xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/>
1845                             <xsl:if test="$AuthorLinkSortBy!='default'">
1846                                 <xsl:text>&amp;sort_by=</xsl:text>
1847                                 <xsl:value-of select="$AuthorLinkSortBy"/>
1848                                 <xsl:text>_</xsl:text>
1849                                 <xsl:value-of select="$AuthorLinkSortOrder" />
1850                             </xsl:if>
1851                         </xsl:attribute>
1852                     </xsl:when>
1853                     <xsl:otherwise>
1854                         <xsl:attribute name="href">
1855                             <xsl:text>/cgi-bin/koha/opac-search.pl?q=au:"</xsl:text>
1856                             <xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>
1857                             <xsl:text>"</xsl:text>
1858                             <xsl:if test="$AuthorLinkSortBy!='default'">
1859                                 <xsl:text>&amp;sort_by=</xsl:text>
1860                                 <xsl:value-of select="$AuthorLinkSortBy"/>
1861                                 <xsl:text>_</xsl:text>
1862                                 <xsl:value-of select="$AuthorLinkSortOrder" />
1863                             </xsl:if>
1864                         </xsl:attribute>
1865                     </xsl:otherwise>
1866                 </xsl:choose>
1867                 <xsl:attribute name="class">contributors</xsl:attribute>
1868                 <span resource="#record"><span>
1869                     <xsl:choose>
1870                         <xsl:when test="substring(@tag, 1, 1)='1'">
1871                             <xsl:choose>
1872                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="property">byArtist</xsl:attribute></xsl:when>
1873                                 <xsl:otherwise><xsl:attribute name="property">author</xsl:attribute></xsl:otherwise>
1874                             </xsl:choose>
1875                         </xsl:when>
1876                         <xsl:otherwise><xsl:attribute name="property">contributor</xsl:attribute></xsl:otherwise>
1877                     </xsl:choose>
1878                     <xsl:choose>
1879                         <xsl:when test="substring(@tag, 2, 1)='0'">
1880                             <xsl:choose>
1881                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="typeof">MusicGroup</xsl:attribute></xsl:when>
1882                                 <xsl:otherwise><xsl:attribute name="typeof">Person</xsl:attribute></xsl:otherwise>
1883                             </xsl:choose>
1884                         </xsl:when>
1885                         <xsl:otherwise><xsl:attribute name="typeof">Organization</xsl:attribute></xsl:otherwise>
1886                     </xsl:choose>
1887                 <span property="name">
1888                 <xsl:choose>
1889                     <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1890                         <!-- #13383 -->
1891                         <xsl:call-template name="chopPunctuation">
1892                             <xsl:with-param name="chopString">
1893                                 <xsl:call-template name="subfieldSelect">
1894                                     <xsl:with-param name="codes">
1895                                         <xsl:choose>
1896                                             <!-- #13383 include subfield e for field 111, Display only name portion in 1XX  -->
1897                                             <xsl:when test="@tag=111">aeq</xsl:when>
1898                                             <xsl:when test="@tag=110">ab</xsl:when>
1899                                             <xsl:otherwise>abcjq</xsl:otherwise>
1900                                         </xsl:choose>
1901                                     </xsl:with-param>
1902                                 </xsl:call-template>
1903                             </xsl:with-param>
1904                             <xsl:with-param name="punctuation">
1905                                 <xsl:text>:,;/ </xsl:text>
1906                             </xsl:with-param>
1907                         </xsl:call-template>
1908                     <!-- Display only name and title portion in 110 field -->
1909                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1910                     <span class="titleportion">
1911                     <xsl:choose>
1912                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1913                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1914                     </xsl:choose>
1915                     <xsl:call-template name="chopPunctuation">
1916                         <xsl:with-param name="chopString">
1917                         <xsl:call-template name="subfieldSelect">
1918                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1919                         </xsl:call-template>
1920                         </xsl:with-param>
1921                     </xsl:call-template>
1922                     </span>
1923                     </xsl:if>
1924                     <!-- Display only name and title portion in 111 field -->
1925             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1926                     <span class="titleportion">
1927                     <xsl:choose>
1928                         <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>
1929                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1930                     </xsl:choose>
1931
1932                     <xsl:call-template name="chopPunctuation">
1933                         <xsl:with-param name="chopString">
1934                         <xsl:call-template name="subfieldSelect">
1935                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1936                         </xsl:call-template>
1937                         </xsl:with-param>
1938                     </xsl:call-template>
1939                     </span>
1940             </xsl:if>
1941             <!-- Display only dates in 100 field -->
1942                         <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1943                         <span class="authordates">
1944                         <xsl:text>, </xsl:text>
1945                         <xsl:call-template name="chopPunctuation">
1946                             <xsl:with-param name="chopString">
1947                             <xsl:call-template name="subfieldSelect">
1948                                <xsl:with-param name="codes">d</xsl:with-param>
1949                             </xsl:call-template>
1950                             </xsl:with-param>
1951                         </xsl:call-template>
1952                         </span>
1953                         </xsl:if>
1954                     </xsl:when>
1955                     <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1956                     <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1957                     <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1958                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1959                     <xsl:if test="@tag=710 or @tag=711">
1960                     <xsl:call-template name="chopPunctuation">
1961                         <xsl:with-param name="chopString">
1962                             <xsl:call-template name="subfieldSelect">
1963                             <xsl:with-param name="codes">
1964                             <xsl:choose>
1965                                 <xsl:when test="@tag=711">aeq</xsl:when>
1966                                 <xsl:otherwise>ab</xsl:otherwise>
1967                             </xsl:choose>
1968                             </xsl:with-param>
1969                             </xsl:call-template>
1970                         </xsl:with-param>
1971                         <xsl:with-param name="punctuation">
1972                             <xsl:text>:,;/ </xsl:text>
1973                         </xsl:with-param>
1974                     </xsl:call-template>
1975                     <!-- Display only name and title portion in 711 field -->
1976                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1977                     <span class="titleportion">
1978                     <xsl:choose>
1979                         <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>
1980                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1981                     </xsl:choose>
1982
1983                     <xsl:call-template name="chopPunctuation">
1984                         <xsl:with-param name="chopString">
1985                         <xsl:call-template name="subfieldSelect">
1986                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1987                         </xsl:call-template>
1988                         </xsl:with-param>
1989                     </xsl:call-template>
1990                     </span>
1991                     </xsl:if>
1992                     <!-- Display only name and title portion in 710 field -->
1993                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1994                     <span class="titleportion">
1995                     <xsl:choose>
1996                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1997                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1998                     </xsl:choose>
1999                     <xsl:call-template name="chopPunctuation">
2000                         <xsl:with-param name="chopString">
2001                         <xsl:call-template name="subfieldSelect">
2002                             <xsl:with-param name="codes">cdnt</xsl:with-param>
2003                         </xsl:call-template>
2004                         </xsl:with-param>
2005                     </xsl:call-template>
2006                     </span>
2007                     </xsl:if>
2008
2009                     </xsl:if>
2010                         <!-- Display only name portion in 700 field -->
2011                         <xsl:if test="@tag=700">
2012                            <xsl:call-template name="chopPunctuation">
2013                                <xsl:with-param name="chopString">
2014                                <xsl:call-template name="subfieldSelect">
2015                                   <xsl:with-param name="codes">abcq</xsl:with-param>
2016                                </xsl:call-template>
2017                                </xsl:with-param>
2018                         </xsl:call-template>
2019                         </xsl:if>
2020                         <!-- Display class "authordates" in 700 field -->
2021                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
2022                         <span class="authordates">
2023                         <xsl:text>, </xsl:text>
2024                         <xsl:call-template name="chopPunctuation">
2025                             <xsl:with-param name="chopString">
2026                             <xsl:call-template name="subfieldSelect">
2027                                <xsl:with-param name="codes">d</xsl:with-param>
2028                             </xsl:call-template>
2029                             </xsl:with-param>
2030                         </xsl:call-template>
2031                         </span>
2032                         </xsl:if>
2033                         <!-- Display class "titleportion" in 700 field -->
2034                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
2035                         <xsl:if test="@tag=700 and $titleportionfields">
2036                         <span class="titleportion">
2037                         <xsl:text>. </xsl:text>
2038                         <xsl:call-template name="chopPunctuation">
2039                             <xsl:with-param name="chopString">
2040                             <xsl:call-template name="subfieldSelect">
2041                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
2042                             </xsl:call-template>
2043                             </xsl:with-param>
2044                         </xsl:call-template>
2045                         </span>
2046                         </xsl:if>
2047
2048                     </xsl:when>
2049                 </xsl:choose>
2050                 </span></span></span>
2051
2052                 <!-- #13383 include relator code j for field 111 also include 711$e 'Subordinate unit' -->
2053                 <xsl:if test="(@tag!=111 and @tag!=711 and marc:subfield[@code='4' or @code='e']) or ((@tag=111 or @tag=711) and marc:subfield[@code='4' or @code='j'])">
2054
2055                     <span class="relatorcode">
2056                         <xsl:text> [</xsl:text>
2057                         <xsl:choose>
2058                             <xsl:when test="@tag=111 or @tag=711">
2059                                 <xsl:choose>
2060                                     <!-- Prefer j over 4 for 111 and 711 -->
2061                                     <xsl:when test="marc:subfield[@code='j']">
2062                                         <xsl:for-each select="marc:subfield[@code='j']">
2063                                             <xsl:value-of select="."/>
2064                                             <xsl:if test="position() != last()">, </xsl:if>
2065                                         </xsl:for-each>
2066                                     </xsl:when>
2067                                     <xsl:otherwise>
2068                                         <xsl:for-each select="marc:subfield[@code=4]">
2069                                             <xsl:value-of select="."/>
2070                                             <xsl:if test="position() != last()">, </xsl:if>
2071                                         </xsl:for-each>
2072                                     </xsl:otherwise>
2073                                 </xsl:choose>
2074                             </xsl:when>
2075                             <!-- Prefer e over 4 on 100 and 110-->
2076                             <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
2077                                 <xsl:for-each select="marc:subfield[@code='e']">
2078                                     <xsl:value-of select="."/>
2079                                     <xsl:if test="position() != last()">, </xsl:if>
2080                                 </xsl:for-each>
2081                             </xsl:when>
2082                             <xsl:otherwise>
2083                                 <xsl:for-each select="marc:subfield[@code=4]">
2084                                     <xsl:value-of select="."/>
2085                                     <xsl:if test="position() != last()">, </xsl:if>
2086                                 </xsl:for-each>
2087                             </xsl:otherwise>
2088                         </xsl:choose>
2089                         <xsl:text>]</xsl:text>
2090                     </span>
2091                 </xsl:if>
2092             </a>
2093             <xsl:if test="marc:subfield[@code=9]">
2094                 <a class='authlink'>
2095                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
2096                     <xsl:element name="i">
2097                         <xsl:attribute name="class">fa fa-search</xsl:attribute>
2098                     </xsl:element>
2099                 </a>
2100             </xsl:if>
2101             </li>
2102             </xsl:for-each>
2103         </ul>
2104         </span>
2105         </xsl:if>
2106     </xsl:template>
2107
2108     <xsl:template name="nameABCQ">
2109             <xsl:call-template name="chopPunctuation">
2110                 <xsl:with-param name="chopString">
2111                     <xsl:call-template name="subfieldSelect">
2112                         <xsl:with-param name="codes">abcq</xsl:with-param>
2113                     </xsl:call-template>
2114                 </xsl:with-param>
2115                 <xsl:with-param name="punctuation">
2116                     <xsl:text>:,;/ </xsl:text>
2117                 </xsl:with-param>
2118             </xsl:call-template>
2119     </xsl:template>
2120
2121     <xsl:template name="nameABCDN">
2122             <xsl:call-template name="chopPunctuation">
2123                 <xsl:with-param name="chopString">
2124                     <xsl:call-template name="subfieldSelect">
2125                         <xsl:with-param name="codes">abcdn</xsl:with-param>
2126                     </xsl:call-template>
2127                 </xsl:with-param>
2128                 <xsl:with-param name="punctuation">
2129                     <xsl:text>:,;/ </xsl:text>
2130                 </xsl:with-param>
2131             </xsl:call-template>
2132     </xsl:template>
2133
2134     <xsl:template name="nameACDEQ">
2135             <xsl:call-template name="subfieldSelect">
2136                 <xsl:with-param name="codes">acdeq</xsl:with-param>
2137             </xsl:call-template>
2138     </xsl:template>
2139
2140     <xsl:template name="specialSubfieldSelect">
2141         <xsl:param name="anyCodes"/>
2142         <xsl:param name="axis"/>
2143         <xsl:param name="beforeCodes"/>
2144         <xsl:param name="afterCodes"/>
2145         <xsl:variable name="str">
2146             <xsl:for-each select="marc:subfield">
2147                 <xsl:if test="contains($anyCodes, @code)      or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis])      or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
2148                     <xsl:value-of select="text()"/>
2149                     <xsl:text> </xsl:text>
2150                 </xsl:if>
2151             </xsl:for-each>
2152         </xsl:variable>
2153         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
2154     </xsl:template>
2155
2156     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
2157     <xsl:template name="subfieldSelectSubject">
2158         <xsl:param name="codes"/>
2159         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
2160         <xsl:param name="subdivCodes"/>
2161         <xsl:param name="subdivDelimiter"/>
2162         <xsl:param name="prefix"/>
2163         <xsl:param name="suffix"/>
2164         <xsl:param name="urlencode"/>
2165         <xsl:variable name="str">
2166             <xsl:for-each select="marc:subfield">
2167                 <xsl:if test="contains($codes, @code)">
2168                     <xsl:if test="contains($subdivCodes, @code)">
2169                         <xsl:value-of select="$subdivDelimiter"/>
2170                     </xsl:if>
2171                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
2172                 </xsl:if>
2173             </xsl:for-each>
2174         </xsl:variable>
2175         <xsl:choose>
2176             <xsl:when test="$urlencode=1">
2177                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
2178             </xsl:when>
2179             <xsl:otherwise>
2180                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
2181             </xsl:otherwise>
2182         </xsl:choose>
2183     </xsl:template>
2184 </xsl:stylesheet>