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