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