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