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