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