Bug 16522: (follow-up) MARC display templates and get_marc_host fixes
[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:text> </xsl:text>
690                 <a class='authlink'>
691                     <xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
692                     <xsl:element name="i">
693                         <xsl:attribute name="class">fa fa-search</xsl:attribute>
694                         <xsl:attribute name="aria-label">View authority record</xsl:attribute>
695                     </xsl:element>
696                 </a>
697             </xsl:if>
698
699             <xsl:choose>
700             <xsl:when test="position()=last()"></xsl:when>
701             <xsl:otherwise> | </xsl:otherwise>
702             </xsl:choose>
703
704             </xsl:for-each>
705             </span>
706         </xsl:if>
707
708         <!-- Genre/Form -->
709         <xsl:if test="marc:datafield[@tag=655]">
710             <span class="results_summary genre"><span class="label">Genre/Form: </span>
711                 <xsl:for-each select="marc:datafield[@tag=655]">
712                     <a>
713                         <xsl:choose>
714                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
715                                 <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>
716                             </xsl:when>
717                             <xsl:when test="$TraceSubjectSubdivisions='1'">
718                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
719                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
720                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
721                                     <xsl:with-param name="prefix">(index-term-genre<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
722                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
723                                     <xsl:with-param name="urlencode">1</xsl:with-param>
724                                 </xsl:call-template>
725                                 </xsl:attribute>
726                             </xsl:when>
727                             <xsl:otherwise>
728                                 <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>
729                             </xsl:otherwise>
730                         </xsl:choose>
731                     <xsl:call-template name="subfieldSelect">
732                         <xsl:with-param name="codes">avxyz</xsl:with-param>
733                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
734                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
735                     </xsl:call-template>
736                     </a>
737
738                     <xsl:if test="marc:subfield[@code=9]">
739                         <xsl:text> </xsl:text>
740                         <a class='authlink'>
741                             <xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
742                             <xsl:element name="i">
743                                 <xsl:attribute name="class">fa fa-search</xsl:attribute>
744                                 <xsl:attribute name="aria-label">View authority record</xsl:attribute>
745                             </xsl:element>
746                         </a>
747                     </xsl:if>
748                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
749                 </xsl:for-each>
750             </span>
751         </xsl:if>
752
753 <!-- MARC21 776 Additional Physical Form Entry -->
754     <xsl:if test="marc:datafield[@tag=776]">
755         <span class="results_summary add_physical_form">
756             <span class="label">Additional physical formats: </span>
757             <xsl:for-each select="marc:datafield[@tag=776]">
758                 <xsl:variable name="linktext">
759                     <xsl:choose>
760                     <xsl:when test="marc:subfield[@code='t']">
761                         <xsl:value-of select="marc:subfield[@code='t']"/>
762                     </xsl:when>
763                     <xsl:when test="marc:subfield[@code='a']">
764                         <xsl:value-of select="marc:subfield[@code='a']"/>
765                     </xsl:when>
766                     <xsl:otherwise>
767                         <xsl:text>No title</xsl:text>
768                     </xsl:otherwise>
769                     </xsl:choose>
770                 </xsl:variable>
771                 <xsl:if test="@ind2=8 and marc:subfield[@code='i']">
772                     <xsl:call-template name="subfieldSelect">
773                         <xsl:with-param name="codes">i</xsl:with-param>
774                     </xsl:call-template>
775                     <xsl:text>: </xsl:text>
776                 </xsl:if>
777                 <xsl:choose>
778                 <xsl:when test="marc:subfield[@code='w']">
779                     <a>
780                     <xsl:attribute name="href">
781                         <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=control-number:</xsl:text>
782                         <xsl:call-template name="extractControlNumber">
783                             <xsl:with-param name="subfieldW">
784                                 <xsl:value-of select="marc:subfield[@code='w']"/>
785                             </xsl:with-param>
786                         </xsl:call-template>
787                     </xsl:attribute>
788                     <xsl:value-of select="$linktext"/>
789                     </a>
790                 </xsl:when>
791                 <xsl:otherwise>
792                     <xsl:value-of select="$linktext"/>
793                 </xsl:otherwise>
794                 </xsl:choose>
795                 <xsl:if test="position() != last()">
796                     <xsl:text>; </xsl:text>
797                 </xsl:if>
798             </xsl:for-each>
799         </span>
800     </xsl:if>
801
802 <!-- MARC21 777 - Issued With Entry -->
803     <xsl:if test="marc:datafield[@tag=777]">
804         <xsl:for-each select="marc:datafield[@tag=777]">
805             <xsl:if test="@ind1 != 1">
806                 <span class="results_summary issued_with">
807                     <span class="label">
808                         <xsl:choose>
809                             <xsl:when test="@ind2=8 and marc:subfield[@code='i']">
810                                 <xsl:value-of select="marc:subfield[@code='i']"/>
811                             </xsl:when>
812                             <xsl:otherwise>
813                                 <xsl:text>Issued with:</xsl:text>
814                             </xsl:otherwise>
815                         </xsl:choose>
816                         <xsl:text> </xsl:text>
817                     </span>
818                     <xsl:variable name="f777">
819                         <xsl:call-template name="chopPunctuation">
820                             <xsl:with-param name="chopString">
821                                 <xsl:call-template name="subfieldSelect">
822                                     <xsl:with-param name="codes">a_t</xsl:with-param>
823                                 </xsl:call-template>
824                             </xsl:with-param>
825                         </xsl:call-template>
826                     </xsl:variable>
827                     <xsl:choose>
828                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
829                             <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>
830                             <xsl:value-of select="translate($f777, '()', '')"/>
831                             </a>
832                         </xsl:when>
833                         <xsl:otherwise>
834                             <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>
835                             <xsl:value-of select="$f777"/>
836                             </a>
837                         </xsl:otherwise>
838                     </xsl:choose>
839                     <xsl:if test="marc:subfield[@code='g']">
840                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
841                     </xsl:if>
842                 </span>
843                 <xsl:if test="marc:subfield[@code='n']">
844                     <xsl:text> </xsl:text><span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
845                 </xsl:if>
846             </xsl:if>
847         </xsl:for-each>
848     </xsl:if>
849
850 <!-- Publisher or Distributor Number -->
851     <xsl:if test="marc:datafield[@tag=028]">
852         <span class="results_summary publisher_number ">
853             <span class="label">Publisher number: </span>
854             <xsl:for-each select="marc:datafield[@tag=028]">
855                 <xsl:call-template name="subfieldSelect">
856                     <xsl:with-param name="codes">abq</xsl:with-param>
857                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
858                 </xsl:call-template>
859             </xsl:for-each>
860         </span>
861     </xsl:if>
862
863 <!-- DDC classification -->
864     <xsl:if test="marc:datafield[@tag=082]">
865         <span class="results_summary ddc">
866             <span class="label">DDC classification: </span>
867             <xsl:for-each select="marc:datafield[@tag=082]">
868                 <xsl:call-template name="subfieldSelect">
869                     <xsl:with-param name="codes">a</xsl:with-param>
870                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
871                 </xsl:call-template>
872                 <xsl:choose>
873                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
874                     <xsl:otherwise> | </xsl:otherwise>
875                 </xsl:choose>
876             </xsl:for-each>
877         </span>
878     </xsl:if>
879
880 <!-- LOC classification -->
881     <xsl:if test="marc:datafield[@tag=050]">
882         <span class="results_summary loc">
883             <span class="label">LOC classification: </span>
884             <xsl:for-each select="marc:datafield[@tag=050]">
885                 <xsl:call-template name="subfieldSelect">
886                     <xsl:with-param name="codes">ab</xsl:with-param>
887                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
888                 </xsl:call-template>
889             </xsl:for-each>
890         </span>
891     </xsl:if>
892
893 <!-- NLM classification -->
894     <xsl:if test="marc:datafield[@tag=060]">
895         <span class="results_summary nlm">
896             <span class="label">NLM classification: </span>
897             <xsl:for-each select="marc:datafield[@tag=060]">
898                 <xsl:call-template name="subfieldSelect">
899                     <xsl:with-param name="codes">a</xsl:with-param>
900                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
901                 </xsl:call-template>
902                 <xsl:if test="not(position()=last())"><xsl:text> | </xsl:text></xsl:if>
903             </xsl:for-each>
904         </span>
905     </xsl:if>
906
907 <!-- Other classification -->
908     <xsl:if test="marc:datafield[@tag=084]">
909        <span class="results_summary oc">
910            <span class="label">Other classification: </span>
911           <xsl:for-each select="marc:datafield[@tag=084]">
912                 <xsl:call-template name="subfieldSelect">
913                    <xsl:with-param name="codes">a</xsl:with-param>
914                    <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
915                 </xsl:call-template>
916                 <xsl:choose>
917                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
918                    <xsl:otherwise> | </xsl:otherwise>
919                 </xsl:choose>
920           </xsl:for-each>
921        </span>
922     </xsl:if>
923
924     <xsl:if test="marc:datafield[@tag=856]">
925         <span class="results_summary online_resources"><span class="label">Online resources: </span>
926         <xsl:for-each select="marc:datafield[@tag=856]">
927             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
928             <a>
929                 <xsl:attribute name="href">
930                     <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
931                         <xsl:choose>
932                             <xsl:when test="@ind1=7">
933                                 <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
934                             </xsl:when>
935                             <xsl:when test="@ind1=1">
936                                 <xsl:text>ftp://</xsl:text>
937                             </xsl:when>
938                             <xsl:otherwise>
939                                 <xsl:text>http://</xsl:text>
940                             </xsl:otherwise>
941                         </xsl:choose>
942                     </xsl:if>
943                     <xsl:value-of select="marc:subfield[@code='u']"/>
944                 </xsl:attribute>
945                 <xsl:choose>
946                     <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')">
947                         <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>
948                     </xsl:when>
949                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
950                         <xsl:call-template name="subfieldSelect">
951                             <xsl:with-param name="codes">y3z</xsl:with-param>
952                         </xsl:call-template>
953                     </xsl:when>
954                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
955                         <xsl:choose>
956                             <xsl:when test="$URLLinkText!=''">
957                                 <xsl:value-of select="$URLLinkText"/>
958                             </xsl:when>
959                             <xsl:otherwise>
960                                 <xsl:text>Click here to access online</xsl:text>
961                             </xsl:otherwise>
962                         </xsl:choose>
963                     </xsl:when>
964                 </xsl:choose>
965             </a>
966             <xsl:choose>
967                 <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
968                 <xsl:otherwise> | </xsl:otherwise>
969             </xsl:choose>
970
971         </xsl:for-each>
972         </span>
973     </xsl:if>
974
975         <!-- 505 - Formatted contents note -->
976         <xsl:if test="marc:datafield[@tag=505]">
977             <div class="results_summary contents">
978             <xsl:choose>
979                 <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
980                     <span class="label">Contents:</span>
981                 </xsl:when>
982                 <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
983                     <span class="label">Incomplete contents:</span>
984                 </xsl:when>
985                 <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
986                     <span class="label">Partial contents:</span>
987                 </xsl:when>
988             </xsl:choose>
989                 <xsl:for-each select="marc:datafield[@tag=505]">
990                     <div class='contentblock'>
991                         <xsl:choose>
992                         <xsl:when test="@ind2=0">
993                             <xsl:call-template name="subfieldSelectSpan">
994                                 <xsl:with-param name="newline">1</xsl:with-param>
995                                 <xsl:with-param name="codes">trug</xsl:with-param>
996                             </xsl:call-template>
997                         </xsl:when>
998                         <xsl:otherwise>
999                             <xsl:call-template name="subfieldSelectSpan">
1000                                 <xsl:with-param name="newline">1</xsl:with-param>
1001                                 <xsl:with-param name="codes">atrug</xsl:with-param>
1002                             </xsl:call-template>
1003                         </xsl:otherwise>
1004                         </xsl:choose>
1005                     </div>
1006                 </xsl:for-each>
1007             </div>
1008         </xsl:if>
1009
1010         <!-- 586 -->
1011         <xsl:if test="marc:datafield[@tag=586]">
1012             <span class="results_summary awardsnote">
1013                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
1014                     <span class="label">Awards: </span>
1015                 </xsl:if>
1016                 <xsl:for-each select="marc:datafield[@tag=586]">
1017                     <xsl:value-of select="marc:subfield[@code='a']"/>
1018                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1019                 </xsl:for-each>
1020             </span>
1021         </xsl:if>
1022
1023         <!-- 508 -->
1024         <xsl:if test="marc:datafield[@tag=508]">
1025             <span class="results_summary prod_credits">
1026                 <span class="label">Production credits: </span>
1027                 <xsl:for-each select="marc:datafield[@tag=508]">
1028                     <xsl:call-template name="subfieldSelectSpan">
1029                         <xsl:with-param name="codes">a</xsl:with-param>
1030                     </xsl:call-template>
1031                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1032                 </xsl:for-each>
1033             </span>
1034         </xsl:if>
1035
1036          <!-- 583 -->
1037          <xsl:if test="marc:datafield[@tag=583]">
1038             <span class="results_summary actionnote">
1039                 <span class="label">Action note: </span>
1040                 <xsl:for-each select="marc:datafield[@tag=583]">
1041                     <xsl:choose>
1042                         <xsl:when test="marc:subfield[@code='z']">
1043                             <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
1044                         </xsl:when>
1045                         <xsl:otherwise>
1046                             <xsl:call-template name="subfieldSelect">
1047                                 <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
1048                             </xsl:call-template>
1049                         </xsl:otherwise>
1050                     </xsl:choose>
1051                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1052                 </xsl:for-each>
1053             </span>
1054          </xsl:if>
1055
1056         <xsl:call-template name="host-item-entries">
1057             <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
1058         </xsl:call-template>
1059
1060         <xsl:if test="marc:datafield[@tag=502]">
1061             <span class="results_summary diss_note">
1062                 <span class="label">Dissertation note: </span>
1063                 <xsl:for-each select="marc:datafield[@tag=502]">
1064                     <xsl:call-template name="subfieldSelect">
1065                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1066                     </xsl:call-template>
1067                 </xsl:for-each>
1068                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1069             </span>
1070         </xsl:if>
1071
1072         <!-- 866 textual holdings -->
1073         <xsl:if test="marc:datafield[@tag=866]">
1074             <span class="results_summary holdings_note basic_bibliographic_unit"><span class="label">Holdings: </span>
1075                 <xsl:for-each select="marc:datafield[@tag=866]">
1076                     <span class="holdings_note_data">
1077                         <xsl:call-template name="subfieldSelect">
1078                             <xsl:with-param name="codes">axz</xsl:with-param>
1079                         </xsl:call-template>
1080                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1081                     </span>
1082                 </xsl:for-each>
1083             </span>
1084         </xsl:if>
1085
1086         <!-- 867 textual holdings -->
1087         <xsl:if test="marc:datafield[@tag=867]">
1088             <span class="results_summary holdings_note supplementary_material"><span class="label">Supplements: </span>
1089                 <xsl:for-each select="marc:datafield[@tag=867]">
1090                     <span class="holdings_note_data">
1091                         <xsl:call-template name="subfieldSelect">
1092                             <xsl:with-param name="codes">axz</xsl:with-param>
1093                         </xsl:call-template>
1094                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1095                     </span>
1096                 </xsl:for-each>
1097             </span>
1098         </xsl:if>
1099
1100         <!-- 868 textual holdings -->
1101         <xsl:if test="marc:datafield[@tag=868]">
1102             <span class="results_summary holdings_note indexes"><span class="label">Indexes: </span>
1103                 <xsl:for-each select="marc:datafield[@tag=868]">
1104                     <span class="holdings_note_data">
1105                         <xsl:call-template name="subfieldSelect">
1106                             <xsl:with-param name="codes">axz</xsl:with-param>
1107                         </xsl:call-template>
1108                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1109                     </span>
1110                 </xsl:for-each>
1111             </span>
1112         </xsl:if>
1113
1114         <!-- 770 - Supplement/Special issue entry -->
1115         <xsl:if test="marc:datafield[@tag=770]">
1116             <span class="results_summary supplement"><span class="label">Supplement: </span>
1117                 <xsl:for-each select="marc:datafield[@tag=770]">
1118                     <xsl:if test="marc:subfield[@code='i']">
1119                         <span class="770_rel_info">
1120                             <xsl:call-template name="subfieldSelect">
1121                                 <xsl:with-param name="codes">i</xsl:with-param>
1122                             </xsl:call-template>
1123                             <xsl:text> </xsl:text>
1124                         </span>
1125                     </xsl:if>
1126                     <a>
1127                         <xsl:choose>
1128                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1129                                 <xsl:attribute name="href">
1130                                     /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>
1131                                 </xsl:attribute>
1132                             </xsl:when>
1133                             <xsl:otherwise>
1134                                 <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>
1135                             </xsl:otherwise>
1136                         </xsl:choose>
1137                         <xsl:choose>
1138                             <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1139                                 <xsl:call-template name="subfieldSelect">
1140                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1141                                 </xsl:call-template>
1142                             </xsl:when>
1143                         </xsl:choose>
1144                     </a>
1145                     <xsl:text> </xsl:text>
1146                     <xsl:call-template name="subfieldSelect">
1147                         <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1148                     </xsl:call-template>
1149                     <xsl:choose>
1150                         <xsl:when test="position()=last()"></xsl:when>
1151                         <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
1152                     </xsl:choose>
1153                 </xsl:for-each>
1154             </span>
1155         </xsl:if>
1156
1157         <!-- 772 - Supplement parent entry -->
1158         <xsl:if test="marc:datafield[@tag=772]">
1159             <span class="results_summary supplement_parent"><span class="label">Supplement to: </span>
1160                 <xsl:for-each select="marc:datafield[@tag=772]">
1161                     <xsl:if test="marc:subfield[@code='i']">
1162                         <span class="772_rel_info">
1163                             <xsl:call-template name="subfieldSelect">
1164                                 <xsl:with-param name="codes">i</xsl:with-param>
1165                             </xsl:call-template>
1166                             <xsl:text> </xsl:text>
1167                         </span>
1168                     </xsl:if>
1169                     <a>
1170                         <xsl:choose>
1171                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1172                                 <xsl:attribute name="href">
1173                                     /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>
1174                                 </xsl:attribute>
1175                             </xsl:when>
1176                             <xsl:otherwise>
1177                                 <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>
1178                             </xsl:otherwise>
1179                         </xsl:choose>
1180                         <xsl:choose>
1181                             <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1182                                 <xsl:call-template name="subfieldSelect">
1183                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1184                                 </xsl:call-template>
1185                             </xsl:when>
1186                         </xsl:choose>
1187                     </a>
1188                     <xsl:call-template name="subfieldSelect">
1189                         <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1190                     </xsl:call-template>
1191                     <xsl:choose>
1192                         <xsl:when test="position()=last()"></xsl:when>
1193                         <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
1194                     </xsl:choose>
1195                 </xsl:for-each>
1196             </span>
1197         </xsl:if>
1198
1199         <!--  775 Other Edition  -->
1200         <xsl:if test="marc:datafield[@tag=775]">
1201         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1202         <xsl:for-each select="marc:datafield[@tag=775]">
1203             <xsl:variable name="f775">
1204                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1205                 <xsl:with-param name="codes">a_t</xsl:with-param>
1206                 </xsl:call-template></xsl:with-param></xsl:call-template>
1207             </xsl:variable>
1208             <xsl:if test="marc:subfield[@code='i']">
1209                 <xsl:call-template name="subfieldSelect">
1210                     <xsl:with-param name="codes">i</xsl:with-param>
1211                 </xsl:call-template>
1212                 <xsl:text>: </xsl:text>
1213             </xsl:if>
1214             <a>
1215             <xsl:choose>
1216             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1217                 <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>
1218             </xsl:when>
1219             <xsl:otherwise>
1220                 <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>
1221             </xsl:otherwise>
1222             </xsl:choose>
1223             <xsl:call-template name="subfieldSelect">
1224                 <xsl:with-param name="codes">a_t</xsl:with-param>
1225             </xsl:call-template>
1226             </a>
1227             <xsl:choose>
1228                 <xsl:when test="position()=last()"></xsl:when>
1229                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1230             </xsl:choose>
1231         </xsl:for-each>
1232         </span>
1233         </xsl:if>
1234
1235         <!-- 780 -->
1236         <xsl:if test="marc:datafield[@tag=780]">
1237             <xsl:for-each select="marc:datafield[@tag=780]">
1238                 <xsl:if test="@ind1=0">
1239                     <span class="results_summary preceeding_entry">
1240                         <xsl:choose>
1241                             <xsl:when test="@ind2=0">
1242                                <span class="label">Continues:</span>
1243                             </xsl:when>
1244                             <xsl:when test="@ind2=1">
1245                                <span class="label">Continues in part:</span>
1246                             </xsl:when>
1247                             <xsl:when test="@ind2=2">
1248                                <span class="label">Supersedes:</span>
1249                             </xsl:when>
1250                             <xsl:when test="@ind2=3">
1251                                <span class="label">Supersedes in part:</span>
1252                             </xsl:when>
1253                             <xsl:when test="@ind2=4">
1254                                <span class="label">Formed by the union: ... and: ...</span>
1255                             </xsl:when>
1256                             <xsl:when test="@ind2=5">
1257                                <span class="label">Absorbed:</span>
1258                             </xsl:when>
1259                             <xsl:when test="@ind2=6">
1260                                <span class="label">Absorbed in part:</span>
1261                             </xsl:when>
1262                             <xsl:when test="@ind2=7">
1263                                <span class="label">Separated from:</span>
1264                             </xsl:when>
1265                         </xsl:choose>
1266                         <xsl:text> </xsl:text>
1267
1268                         <xsl:if test="marc:subfield[@code='i']">
1269                             <span class="780_rel_info">
1270                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1271                                 <xsl:text> </xsl:text>
1272                             </span>
1273                         </xsl:if>
1274
1275                         <xsl:variable name="f780">
1276                             <xsl:call-template name="subfieldSelect">
1277                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1278                             </xsl:call-template>
1279                         </xsl:variable>
1280                         <xsl:choose>
1281                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1282                                 <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>
1283                                     <xsl:value-of select="$f780"/>
1284                                 </a>
1285                             </xsl:when>
1286                             <xsl:otherwise>
1287                                 <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>
1288                                     <xsl:value-of select="$f780"/>
1289                                 </a>
1290                             </xsl:otherwise>
1291                         </xsl:choose>
1292                     </span>
1293
1294                     <xsl:if test="marc:subfield[@code='n']">
1295                         <span class="results_summary preceeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1296                     </xsl:if>
1297
1298                 </xsl:if>
1299             </xsl:for-each>
1300         </xsl:if>
1301
1302         <!-- 785 -->
1303         <xsl:if test="marc:datafield[@tag=785]">
1304             <xsl:for-each select="marc:datafield[@tag=785]">
1305                 <xsl:if test="@ind1=0">
1306                     <span class="results_summary succeeding_entry">
1307                         <xsl:choose>
1308                             <xsl:when test="@ind2=0">
1309                                 <span class="label">Continued by:</span>
1310                             </xsl:when>
1311                             <xsl:when test="@ind2=1">
1312                                 <span class="label">Continued in part by:</span>
1313                             </xsl:when>
1314                             <xsl:when test="@ind2=2">
1315                                 <span class="label">Superseded by:</span>
1316                             </xsl:when>
1317                             <xsl:when test="@ind2=3">
1318                                 <span class="label">Superseded in part by:</span>
1319                             </xsl:when>
1320                             <xsl:when test="@ind2=4">
1321                                 <span class="label">Absorbed by:</span>
1322                             </xsl:when>
1323                             <xsl:when test="@ind2=5">
1324                                 <span class="label">Absorbed in part by:</span>
1325                             </xsl:when>
1326                             <xsl:when test="@ind2=6">
1327                                 <span class="label">Split into .. and ...:</span>
1328                             </xsl:when>
1329                             <xsl:when test="@ind2=7">
1330                                 <span class="label">Merged with ... to form ...</span>
1331                             </xsl:when>
1332                             <xsl:when test="@ind2=8">
1333                                 <span class="label">Changed back to:</span>
1334                             </xsl:when>
1335                         </xsl:choose>
1336                         <xsl:text> </xsl:text>
1337
1338                         <xsl:if test="marc:subfield[@code='i']">
1339                             <span class="785_rel_info">
1340                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1341                                 <xsl:text> </xsl:text>
1342                             </span>
1343                         </xsl:if>
1344
1345                         <xsl:variable name="f785">
1346                             <xsl:call-template name="subfieldSelect">
1347                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1348                             </xsl:call-template>
1349                         </xsl:variable>
1350
1351                         <xsl:choose>
1352                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1353                                 <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>
1354                                     <xsl:value-of select="$f785"/>
1355                                 </a>
1356                             </xsl:when>
1357                             <xsl:otherwise>
1358                                 <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>
1359                                     <xsl:value-of select="$f785"/>
1360                                 </a>
1361                             </xsl:otherwise>
1362                         </xsl:choose>
1363
1364                     </span>
1365                 </xsl:if>
1366             </xsl:for-each>
1367         </xsl:if>
1368
1369         <!--  787 Other Relationship Entry  -->
1370         <xsl:if test="marc:datafield[@tag=787]">
1371         <span class="results_summary other_relationship_entry"><span class="label">Other related works: </span>
1372         <xsl:for-each select="marc:datafield[@tag=787]">
1373             <span class="other_relationship_entry">
1374                 <xsl:variable name="f787">
1375                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1376                     <xsl:with-param name="codes">a_t</xsl:with-param>
1377                     </xsl:call-template></xsl:with-param></xsl:call-template>
1378                 </xsl:variable>
1379                 <xsl:if test="marc:subfield[@code='i']">
1380                     <xsl:call-template name="subfieldSelect">
1381                         <xsl:with-param name="codes">i</xsl:with-param>
1382                     </xsl:call-template>
1383                     <xsl:text>: </xsl:text>
1384                 </xsl:if>
1385                 <xsl:choose>
1386                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1387                     <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>
1388                         <xsl:value-of select="$f787"/>
1389                     </a>
1390                 </xsl:when>
1391                 <xsl:otherwise>
1392                     <xsl:variable name="relation_query">
1393                         <xsl:text>ti,phr:(</xsl:text>
1394                         <xsl:call-template name="quote_search_term">
1395                             <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param>
1396                         </xsl:call-template>
1397                         <xsl:text>)</xsl:text>
1398                         <xsl:if test="marc:subfield[@code='a']">
1399                             <xsl:text> AND au:(</xsl:text>
1400                             <xsl:call-template name="quote_search_term">
1401                                 <xsl:with-param name="term">
1402                                     <xsl:value-of select="marc:subfield[@code='a']"/>
1403                                 </xsl:with-param>
1404                             </xsl:call-template>
1405                             <xsl:text>)</xsl:text>
1406                         </xsl:if>
1407                     </xsl:variable>
1408                     <a>
1409                     <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" />
1410                     </xsl:attribute>
1411                         <xsl:value-of select="$f787"/>
1412                     </a>
1413                 </xsl:otherwise>
1414                 </xsl:choose>
1415                 <xsl:choose>
1416                     <xsl:when test="position()=last()"></xsl:when>
1417                     <xsl:otherwise><span class="separator"><xsl:text>; </xsl:text></span></xsl:otherwise>
1418                 </xsl:choose>
1419             </span>
1420         </xsl:for-each>
1421         </span>
1422         </xsl:if>
1423
1424         <!-- Indicate if record is suppressed in OPAC -->
1425         <xsl:choose>
1426             <xsl:when test="$OpacSuppression = 1 and marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']">
1427                 <span class="results_summary suppressed_opac">
1428                     <span class="label">OPAC view: </span>
1429                     Suppressed in OPAC
1430                 </span>
1431             </xsl:when>
1432             <xsl:otherwise>
1433                 <xsl:if test="$OPACBaseURL!=''">
1434                     <span class="results_summary opac_view"><span class="label">OPAC view: </span>
1435                         <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>.
1436                     </span>
1437                 </xsl:if>
1438             </xsl:otherwise>
1439         </xsl:choose>
1440
1441
1442
1443     </xsl:template>
1444
1445     <xsl:template name="nameABCQ">
1446             <xsl:call-template name="chopPunctuation">
1447                 <xsl:with-param name="chopString">
1448                     <xsl:call-template name="subfieldSelect">
1449                         <xsl:with-param name="codes">abcq</xsl:with-param>
1450                     </xsl:call-template>
1451                 </xsl:with-param>
1452                 <xsl:with-param name="punctuation">
1453                     <xsl:text>:,;/ </xsl:text>
1454                 </xsl:with-param>
1455             </xsl:call-template>
1456     </xsl:template>
1457
1458     <xsl:template name="nameABCDN">
1459             <xsl:call-template name="chopPunctuation">
1460                 <xsl:with-param name="chopString">
1461                     <xsl:call-template name="subfieldSelect">
1462                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1463                     </xsl:call-template>
1464                 </xsl:with-param>
1465                 <xsl:with-param name="punctuation">
1466                     <xsl:text>:,;/ </xsl:text>
1467                 </xsl:with-param>
1468             </xsl:call-template>
1469     </xsl:template>
1470
1471     <xsl:template name="nameACDEQ">
1472             <xsl:call-template name="subfieldSelect">
1473                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1474             </xsl:call-template>
1475     </xsl:template>
1476
1477     <xsl:template name="specialSubfieldSelect">
1478         <xsl:param name="anyCodes"/>
1479         <xsl:param name="axis"/>
1480         <xsl:param name="beforeCodes"/>
1481         <xsl:param name="afterCodes"/>
1482         <xsl:variable name="str">
1483             <xsl:for-each select="marc:subfield">
1484                 <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])">
1485                     <xsl:value-of select="text()"/>
1486                     <xsl:text> </xsl:text>
1487                 </xsl:if>
1488             </xsl:for-each>
1489         </xsl:variable>
1490         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1491     </xsl:template>
1492
1493     <xsl:template name="showAuthor">
1494         <xsl:param name="authorfield"/>
1495     <xsl:param name="UseAuthoritiesForTracings"/>
1496         <xsl:if test="count($authorfield)&gt;0">
1497         <h5 class="author">
1498         <xsl:for-each select="$authorfield">
1499         <xsl:choose>
1500           <xsl:when test="position()&gt;1"/>
1501           <!-- #13383 -->
1502           <xsl:when test="@tag&lt;700"><span class="byAuthor">By: </span></xsl:when>
1503           <!--#13382 Changed Additional author to contributor -->
1504           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1505         </xsl:choose>
1506         <a>
1507         <xsl:choose>
1508             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1509                 <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>
1510             </xsl:when>
1511             <xsl:otherwise>
1512             <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>
1513             </xsl:otherwise>
1514         </xsl:choose>
1515         <xsl:choose>
1516             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1517                 <!-- #13383 -->
1518                 <xsl:call-template name="chopPunctuation">
1519                     <xsl:with-param name="chopString">
1520                         <xsl:call-template name="subfieldSelect">
1521                             <xsl:with-param name="codes">
1522                                 <xsl:choose>
1523                                     <!-- #13383 include subfield e for field 111, Display only name portion in 1XX -->
1524                                     <xsl:when test="@tag=111">aeq</xsl:when>
1525                                     <xsl:when test="@tag=110">ab</xsl:when>
1526                                     <xsl:otherwise>abcjq</xsl:otherwise>
1527                                 </xsl:choose>
1528                             </xsl:with-param>
1529                         </xsl:call-template>
1530                     </xsl:with-param>
1531                     <xsl:with-param name="punctuation">
1532                         <xsl:text>:,;/ </xsl:text>
1533                     </xsl:with-param>
1534                 </xsl:call-template>
1535                     <!-- Display only name and title portion in 110 field -->
1536                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1537                     <span class="titleportion">
1538                     <xsl:choose>
1539                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1540                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1541                     </xsl:choose>
1542                     <xsl:call-template name="chopPunctuation">
1543                         <xsl:with-param name="chopString">
1544                         <xsl:call-template name="subfieldSelect">
1545                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1546                         </xsl:call-template>
1547                         </xsl:with-param>
1548                     </xsl:call-template>
1549                     </span>
1550                     </xsl:if>
1551                     <!-- Display only name and title portion in 111 field -->
1552             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1553                     <span class="titleportion">
1554                     <xsl:choose>
1555                         <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>
1556                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1557                     </xsl:choose>
1558
1559                     <xsl:call-template name="chopPunctuation">
1560                         <xsl:with-param name="chopString">
1561                         <xsl:call-template name="subfieldSelect">
1562                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1563                         </xsl:call-template>
1564                         </xsl:with-param>
1565                     </xsl:call-template>
1566                     </span>
1567             </xsl:if>
1568             <!-- Display only dates in 100 field -->
1569             <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1570                 <span class="authordates">
1571                 <xsl:text>, </xsl:text>
1572                 <xsl:call-template name="chopPunctuation">
1573                     <xsl:with-param name="chopString">
1574                         <xsl:call-template name="subfieldSelect">
1575                            <xsl:with-param name="codes">d</xsl:with-param>
1576                         </xsl:call-template>
1577                         </xsl:with-param>
1578                     </xsl:call-template>
1579                     </span>
1580             </xsl:if>
1581
1582             </xsl:when>
1583             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1584             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1585             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1586                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1587                     <xsl:if test="@tag=710 or @tag=711">
1588                     <xsl:call-template name="chopPunctuation">
1589                         <xsl:with-param name="chopString">
1590                             <xsl:call-template name="subfieldSelect">
1591                             <xsl:with-param name="codes">
1592                             <xsl:choose>
1593                                 <xsl:when test="@tag=711">aeq</xsl:when>
1594                                 <xsl:otherwise>ab</xsl:otherwise>
1595                             </xsl:choose>
1596                             </xsl:with-param>
1597                             </xsl:call-template>
1598                         </xsl:with-param>
1599                         <xsl:with-param name="punctuation">
1600                             <xsl:text>:,;/ </xsl:text>
1601                         </xsl:with-param>
1602                     </xsl:call-template>
1603                     <!-- Display only name and title portion in 711 field -->
1604                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1605                     <span class="titleportion">
1606                     <xsl:choose>
1607                         <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>
1608                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1609                     </xsl:choose>
1610
1611                     <xsl:call-template name="chopPunctuation">
1612                         <xsl:with-param name="chopString">
1613                         <xsl:call-template name="subfieldSelect">
1614                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1615                         </xsl:call-template>
1616                         </xsl:with-param>
1617                     </xsl:call-template>
1618                     </span>
1619                     </xsl:if>
1620                     <!-- Display only name and title portion in 710 field -->
1621                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1622                     <span class="titleportion">
1623                     <xsl:choose>
1624                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1625                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1626                     </xsl:choose>
1627                     <xsl:call-template name="chopPunctuation">
1628                         <xsl:with-param name="chopString">
1629                         <xsl:call-template name="subfieldSelect">
1630                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1631                         </xsl:call-template>
1632                         </xsl:with-param>
1633                     </xsl:call-template>
1634                     </span>
1635                     </xsl:if>
1636
1637                     </xsl:if>
1638                         <!-- Display only name portion in 700 field -->
1639                         <xsl:if test="@tag=700">
1640                            <xsl:call-template name="chopPunctuation">
1641                                <xsl:with-param name="chopString">
1642                                <xsl:call-template name="subfieldSelect">
1643                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1644                                </xsl:call-template>
1645                                </xsl:with-param>
1646                         </xsl:call-template>
1647                         </xsl:if>
1648                         <!-- Display class "authordates" in 700 field -->
1649                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1650                         <span class="authordates">
1651                         <xsl:text>, </xsl:text>
1652                         <xsl:call-template name="chopPunctuation">
1653                             <xsl:with-param name="chopString">
1654                             <xsl:call-template name="subfieldSelect">
1655                                <xsl:with-param name="codes">d</xsl:with-param>
1656                             </xsl:call-template>
1657                             </xsl:with-param>
1658                         </xsl:call-template>
1659                         </span>
1660                         </xsl:if>
1661                         <!-- Display class "titleportion" in 700 field -->
1662                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1663                         <xsl:if test="@tag=700 and $titleportionfields">
1664                         <span class="titleportion">
1665                         <xsl:text>. </xsl:text>
1666                         <xsl:call-template name="chopPunctuation">
1667                             <xsl:with-param name="chopString">
1668                             <xsl:call-template name="subfieldSelect">
1669                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1670                             </xsl:call-template>
1671                             </xsl:with-param>
1672                         </xsl:call-template>
1673                         </span>
1674                         </xsl:if>
1675
1676         </xsl:when>
1677         </xsl:choose>
1678
1679     <!-- add relator code too between brackets-->
1680     <!-- #13383 include relator code j for field 111 -->
1681             <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'])">
1682                 <span class="relatorcode">
1683                     <xsl:text> [</xsl:text>
1684                     <xsl:choose>
1685                         <xsl:when test="@tag=111 or @tag=711">
1686                             <xsl:choose>
1687                                 <!-- Prefer j over 4 for fields 111 and 711-->
1688                                 <xsl:when test="marc:subfield[@code='j']">
1689                                     <xsl:for-each select="marc:subfield[@code='j']">
1690                                         <xsl:value-of select="."/>
1691                                         <xsl:if test="position() != last()">, </xsl:if>
1692                                     </xsl:for-each>
1693                                 </xsl:when>
1694                                 <xsl:otherwise>
1695                                     <xsl:for-each select="marc:subfield[@code=4]">
1696                                         <xsl:value-of select="."/>
1697                                         <xsl:if test="position() != last()">, </xsl:if>
1698                                     </xsl:for-each>
1699                                 </xsl:otherwise>
1700                             </xsl:choose>
1701                         </xsl:when>
1702                         <!-- Prefer e over 4 for fields 111 and 711-->
1703                         <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1704                             <xsl:for-each select="marc:subfield[@code='e']">
1705                                 <xsl:value-of select="."/>
1706                                 <xsl:if test="position() != last()">, </xsl:if>
1707                             </xsl:for-each>
1708                         </xsl:when>
1709                         <xsl:otherwise>
1710                             <xsl:for-each select="marc:subfield[@code=4]">
1711                                 <xsl:value-of select="."/>
1712                                 <xsl:if test="position() != last()">, </xsl:if>
1713                             </xsl:for-each>
1714                         </xsl:otherwise>
1715                     </xsl:choose>
1716                     <xsl:text>]</xsl:text>
1717                 </span>
1718             </xsl:if>
1719         </a>
1720         <xsl:if test="marc:subfield[@code=9]">
1721                 <xsl:text> </xsl:text>
1722                 <a class='authlink'>
1723                     <xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
1724                     <xsl:element name="i">
1725                         <xsl:attribute name="class">fa fa-search</xsl:attribute>
1726                         <xsl:attribute name="aria-label">View authority record</xsl:attribute>
1727                     </xsl:element>
1728                 </a>
1729         </xsl:if>
1730         <xsl:choose>
1731           <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1732         </xsl:choose>
1733         </xsl:for-each>
1734         </h5>
1735         </xsl:if>
1736     </xsl:template>
1737
1738     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1739     <xsl:template name="subfieldSelectSubject">
1740         <xsl:param name="codes"/>
1741         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1742         <xsl:param name="subdivCodes"/>
1743         <xsl:param name="subdivDelimiter"/>
1744         <xsl:param name="prefix"/>
1745         <xsl:param name="suffix"/>
1746         <xsl:param name="urlencode"/>
1747         <xsl:variable name="str">
1748             <xsl:for-each select="marc:subfield">
1749                 <xsl:if test="contains($codes, @code)">
1750                     <xsl:if test="contains($subdivCodes, @code)">
1751                         <xsl:value-of select="$subdivDelimiter"/>
1752                     </xsl:if>
1753                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1754                 </xsl:if>
1755             </xsl:for-each>
1756         </xsl:variable>
1757         <xsl:choose>
1758             <xsl:when test="$urlencode=1">
1759                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
1760             </xsl:when>
1761             <xsl:otherwise>
1762                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1763             </xsl:otherwise>
1764         </xsl:choose>
1765     </xsl:template>
1766
1767 </xsl:stylesheet>