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