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