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