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