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