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