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