Bug 16728: Add MARC21 777 - Issued with entry to staff and OPAC detail pages
[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'">Text</xsl:when>
77                         <xsl:when test="$leader7='i' or $leader7='s'">
78                             <xsl:choose>
79                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
80                                 <xsl:otherwise>Series</xsl:otherwise>
81                             </xsl:choose>
82                         </xsl:when>
83                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
84                     </xsl:choose>
85                 </xsl:when>
86                 <xsl:when test="$leader6='t'">Text</xsl:when>
87                 <xsl:when test="$leader6='o'">Kit</xsl:when>
88                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
89                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
90                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
91                 <xsl:when test="$leader6='g'">Film</xsl:when>
92                 <xsl:when test="$leader6='k'">Picture</xsl:when>
93                 <xsl:when test="$leader6='r'">Object</xsl:when>
94                 <xsl:when test="$leader6='j'">Music</xsl:when>
95                 <xsl:when test="$leader6='i'">Sound</xsl:when>
96                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
97             </xsl:choose>
98         </xsl:variable>
99
100         <!-- 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 information -->
324         <xsl:variable name="leader7_class">
325             <xsl:choose>
326                 <!--xsl:when test="$leader7='a'">analytic_mcp</xsl:when-->
327                 <!--xsl:when test="$leader7='b'">analytic_scp</xsl:when-->
328                 <xsl:when test="$leader7='c'">analytic_collection</xsl:when>
329                 <xsl:when test="$leader7='d'">analytic_subunit</xsl:when>
330                 <xsl:when test="$leader7='i'">analytic_ires</xsl:when>
331                 <xsl:when test="$leader7='m'">analytic_monograph</xsl:when>
332                 <xsl:when test="$leader7='s'">analytic_serial</xsl:when>
333                 <xsl:otherwise>analytic_undefined</xsl:otherwise>
334             </xsl:choose>
335         </xsl:variable>
336
337         <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
338         <xsl:if test="$show_analytics_link='1'">
339             <xsl:element name="span">
340                 <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
341                 <span class="label">Analytics: </span>
342                 <a>
343                 <xsl:choose>
344                     <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
345                         <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>
346                     </xsl:when>
347                     <xsl:otherwise>
348                         <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>
349                     </xsl:otherwise>
350                 </xsl:choose>
351                 <xsl:text>Show analytics</xsl:text>
352                 </a>
353             </xsl:element>
354         </xsl:if>
355
356         <!-- Volumes of sets and traced series -->
357         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
358         <span class="results_summary volumes"><span class="label">Volumes: </span>
359             <a>
360             <xsl:choose>
361             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
362                 <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>
363             </xsl:when>
364             <xsl:otherwise>
365                 <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>
366             </xsl:otherwise>
367             </xsl:choose>
368             <xsl:text>Show volumes</xsl:text>
369             </a>
370         </span>
371         </xsl:if>
372
373         <!-- Set -->
374         <xsl:if test="$leader19='c'">
375         <span class="results_summary set"><span class="label">Set: </span>
376         <xsl:for-each select="marc:datafield[@tag=773]">
377             <a>
378             <xsl:choose>
379             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
380                 <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>
381             </xsl:when>
382             <xsl:otherwise>
383                 <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>
384             </xsl:otherwise>
385             </xsl:choose>
386             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
387             </a>
388             <xsl:choose>
389                 <xsl:when test="position()=last()"></xsl:when>
390                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
391             </xsl:choose>
392         </xsl:for-each>
393         </span>
394         </xsl:if>
395
396         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
397         <xsl:if test="$display880">
398             <xsl:call-template name="m880Select">
399                 <xsl:with-param name="basetags">260</xsl:with-param>
400                 <xsl:with-param name="codes">abcg</xsl:with-param>
401                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
402                 <xsl:with-param name="label">Publisher: </xsl:with-param>
403             </xsl:call-template>
404         </xsl:if>
405
406         <!-- Publisher info and RDA related info from tags 260, 264 -->
407         <xsl:choose>
408             <xsl:when test="marc:datafield[@tag=264]">
409                 <xsl:call-template name="showRDAtag264">
410                    <xsl:with-param name="show_url">1</xsl:with-param>
411                 </xsl:call-template>
412             </xsl:when>
413             <xsl:when test="marc:datafield[@tag=260]">
414                 <span class="results_summary publisher"><span class="label">Publisher: </span>
415                     <xsl:for-each select="marc:datafield[@tag=260]">
416                         <xsl:if test="marc:subfield[@code='a']">
417                             <xsl:call-template name="subfieldSelect">
418                                 <xsl:with-param name="codes">a</xsl:with-param>
419                             </xsl:call-template>
420                         </xsl:if>
421                         <xsl:text> </xsl:text>
422                         <xsl:if test="marc:subfield[@code='b']">
423                         <a>
424                             <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>
425                             <xsl:call-template name="subfieldSelect">
426                                 <xsl:with-param name="codes">b</xsl:with-param>
427                             </xsl:call-template>
428                        </a>
429                        </xsl:if>
430                        <xsl:text> </xsl:text>
431                         <xsl:call-template name="chopPunctuation">
432                           <xsl:with-param name="chopString">
433                             <xsl:call-template name="subfieldSelect">
434                                 <xsl:with-param name="codes">cg</xsl:with-param>
435                             </xsl:call-template>
436                            </xsl:with-param>
437                        </xsl:call-template>
438                             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
439                     </xsl:for-each>
440                 </span>
441             </xsl:when>
442         </xsl:choose>
443
444         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
445         <xsl:if test="$display880">
446             <xsl:call-template name="m880Select">
447                 <xsl:with-param name="basetags">250</xsl:with-param>
448                 <xsl:with-param name="codes">ab</xsl:with-param>
449                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
450                 <xsl:with-param name="label">Edition: </xsl:with-param>
451             </xsl:call-template>
452         </xsl:if>
453         
454         <xsl:if test="marc:datafield[@tag=250]">
455         <span class="results_summary edition"><span class="label">Edition: </span>
456             <xsl:for-each select="marc:datafield[@tag=250]">
457                 <xsl:call-template name="chopPunctuation">
458                   <xsl:with-param name="chopString">
459                     <xsl:call-template name="subfieldSelect">
460                         <xsl:with-param name="codes">ab</xsl:with-param>
461                     </xsl:call-template>
462                    </xsl:with-param>
463                </xsl:call-template>
464                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
465             </xsl:for-each>
466         </span>
467         </xsl:if>
468
469         <!-- Description: Alternate Graphic Representation (MARC 880) -->
470         <xsl:if test="$display880">
471             <xsl:call-template name="m880Select">
472                 <xsl:with-param name="basetags">300</xsl:with-param>
473                 <xsl:with-param name="codes">abceg</xsl:with-param>
474                 <xsl:with-param name="class">results_summary description</xsl:with-param>
475                 <xsl:with-param name="label">Description: </xsl:with-param>
476             </xsl:call-template>
477         </xsl:if>
478         
479         <xsl:if test="marc:datafield[@tag=300]">
480         <span class="results_summary description"><span class="label">Description: </span>
481             <xsl:for-each select="marc:datafield[@tag=300]">
482                 <xsl:call-template name="chopPunctuation">
483                   <xsl:with-param name="chopString">
484                     <xsl:call-template name="subfieldSelect">
485                         <xsl:with-param name="codes">abcefg</xsl:with-param>
486                     </xsl:call-template>
487                    </xsl:with-param>
488                </xsl:call-template>
489                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
490             </xsl:for-each>
491         </span>
492        </xsl:if>
493
494         <!-- Content Type -->
495         <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
496             <span class="results_summary" id="content_type">
497                 <xsl:if test="marc:datafield[@tag=336]">
498                     <span class="label">Content type: </span>
499                     <xsl:for-each select="marc:datafield[@tag=336]">
500                         <xsl:call-template name="subfieldSelect">
501                             <xsl:with-param name="codes">a</xsl:with-param>
502                             <xsl:with-param name="delimeter">, </xsl:with-param>
503                         </xsl:call-template>
504                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
505                     </xsl:for-each>
506                 </xsl:if>
507                 <xsl:text> </xsl:text>
508                 <!-- Media Type -->
509                 <xsl:if test="marc:datafield[@tag=337]">
510                     <span class="label">Media type: </span>
511                     <xsl:for-each select="marc:datafield[@tag=337]">
512                         <xsl:call-template name="subfieldSelect">
513                             <xsl:with-param name="codes">a</xsl:with-param>
514                             <xsl:with-param name="delimeter">, </xsl:with-param>
515                         </xsl:call-template>
516                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
517                     </xsl:for-each>
518                 </xsl:if>
519                 <xsl:text> </xsl:text>
520                 <!-- Media Type -->
521                 <xsl:if test="marc:datafield[@tag=338]">
522                     <span class="label">Carrier type: </span>
523                     <xsl:for-each select="marc:datafield[@tag=338]">
524                         <xsl:call-template name="subfieldSelect">
525                             <xsl:with-param name="codes">a</xsl:with-param>
526                             <xsl:with-param name="delimeter">, </xsl:with-param>
527                         </xsl:call-template>
528                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
529                     </xsl:for-each>
530                 </xsl:if>
531             </span>
532         </xsl:if>
533
534         <!-- 385 - Audience -->
535         <xsl:if test="marc:datafield[@tag=385]">
536             <span class="results_summary audience">
537                 <span class="label">Audience: </span>
538                 <xsl:for-each select="marc:datafield[@tag=385]">
539                     <xsl:if test="marc:subfield[@code='m']">
540                         <xsl:call-template name="chopPunctuation">
541                             <xsl:with-param name="chopString">
542                                 <xsl:call-template name="subfieldSelect">
543                                     <xsl:with-param name="codes">m</xsl:with-param>
544                                 </xsl:call-template>
545                             </xsl:with-param>
546                         </xsl:call-template>
547                         <xsl:text>: </xsl:text>
548                     </xsl:if>
549                         <xsl:call-template name="chopPunctuation">
550                             <xsl:with-param name="chopString">
551                                 <xsl:call-template name="subfieldSelect">
552                                     <xsl:with-param name="codes">a</xsl:with-param>
553                                     <xsl:with-param name="delimeter">, </xsl:with-param>
554                                 </xsl:call-template>
555                             </xsl:with-param>
556                         </xsl:call-template>
557                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise></xsl:choose>
558                 </xsl:for-each>
559             </span>
560         </xsl:if>
561
562         <xsl:call-template name="showISBNISSN"/>
563
564         <xsl:if test="marc:datafield[@tag=013]">
565             <span class="results_summary patent_info">
566                 <span class="label">Patent information: </span>
567                 <xsl:for-each select="marc:datafield[@tag=013]">
568                     <xsl:call-template name="subfieldSelect">
569                         <xsl:with-param name="codes">acdef</xsl:with-param>
570                         <xsl:with-param name="delimeter">, </xsl:with-param>
571                     </xsl:call-template>
572                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
573                 </xsl:for-each>
574             </span>
575         </xsl:if>
576
577         <xsl:if test="marc:datafield[@tag=088]">
578             <span class="results_summary report_number">
579                 <span class="label">Report number: </span>
580                 <xsl:for-each select="marc:datafield[@tag=088]">
581                     <xsl:call-template name="subfieldSelect">
582                         <xsl:with-param name="codes">a</xsl:with-param>
583                     </xsl:call-template>
584                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
585                 </xsl:for-each>
586             </span>
587         </xsl:if>
588
589         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
590         <xsl:if test="$display880">
591             <xsl:call-template name="m880Select">
592                 <xsl:with-param name="basetags">246</xsl:with-param>
593                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
594                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
595                 <xsl:with-param name="label">Other title: </xsl:with-param>
596             </xsl:call-template>
597         </xsl:if>
598
599         <xsl:if test="marc:datafield[@tag=246]">
600             <span class="results_summary other_title"><span class="label">Other title: </span>
601                 <xsl:for-each select="marc:datafield[@tag=246]">
602                     <xsl:if test="marc:subfield[@code='i']">
603                             <xsl:call-template name="subfieldSelect">
604                                     <xsl:with-param name="codes">i</xsl:with-param>
605                             </xsl:call-template>
606                     </xsl:if>
607                        <xsl:text> </xsl:text>
608                     <xsl:call-template name="chopPunctuation">
609                         <xsl:with-param name="chopString">
610                             <xsl:call-template name="subfieldSelect">
611                                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
612                             </xsl:call-template>
613                         </xsl:with-param>
614                     </xsl:call-template>
615                     <xsl:if test="@ind1=1 and not(marc:subfield[@code='i'])">
616                         <xsl:choose>
617                             <xsl:when test="@ind2=0"> [Portion of title]</xsl:when>
618                             <xsl:when test="@ind2=1"> [Parallel title]</xsl:when>
619                             <xsl:when test="@ind2=2"> [Distinctive title]</xsl:when>
620                             <xsl:when test="@ind2=3"> [Other title]</xsl:when>
621                             <xsl:when test="@ind2=4"> [Cover title]</xsl:when>
622                             <xsl:when test="@ind2=5"> [Added title page title]</xsl:when>
623                             <xsl:when test="@ind2=6"> [Caption title]</xsl:when>
624                             <xsl:when test="@ind2=7"> [Running title]</xsl:when>
625                             <xsl:when test="@ind2=8"> [Spine title]</xsl:when>
626                         </xsl:choose>
627                     </xsl:if>
628                     <!-- #13386 added separator | -->
629                     <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>
630                 </xsl:for-each>
631             </span>
632         </xsl:if>
633
634         <xsl:if test="marc:datafield[@tag=242]">
635         <span class="results_summary translated_title"><span class="label">Title translated: </span>
636             <xsl:for-each select="marc:datafield[@tag=242]">
637                 <xsl:call-template name="chopPunctuation">
638                   <xsl:with-param name="chopString">
639                     <xsl:call-template name="subfieldSelect">
640                         <xsl:with-param name="codes">abchnp</xsl:with-param>
641                     </xsl:call-template>
642                    </xsl:with-param>
643                </xsl:call-template>
644                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
645             </xsl:for-each>
646         </span>
647        </xsl:if>
648
649         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
650         <xsl:if test="$display880">
651             <xsl:call-template name="m880Select">
652                 <xsl:with-param name="basetags">130,240</xsl:with-param>
653                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
654                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
655                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
656             </xsl:call-template>
657         </xsl:if>
658
659         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
660             <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
661                 <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
662                     <xsl:if test="marc:subfield[@code='i']">
663                             <xsl:call-template name="subfieldSelect">
664                                     <xsl:with-param name="codes">i</xsl:with-param>
665                             </xsl:call-template>
666                     </xsl:if>
667                     <xsl:text> </xsl:text>
668                     <xsl:for-each select="marc:subfield">
669                         <xsl:if test="contains('adfghklmnoprst',@code)">
670                             <xsl:value-of select="text()"/>
671                             <xsl:text> </xsl:text>
672                         </xsl:if>
673                     </xsl:for-each>
674                     <xsl:if test="position() != last()">
675                         <span class="separator"><xsl:text> | </xsl:text></span>
676                     </xsl:if>
677                 </xsl:for-each>
678             </span>
679         </xsl:if>
680
681         <!-- #13382 Added Related works 700$i -->
682         <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']]">
683             <span class="results_summary related_works"><span class="label">Related works: </span>
684                 <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']]">
685                     <xsl:variable name="str">
686                         <xsl:call-template name="subfieldSelect">
687                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
688                         </xsl:call-template>
689                     </xsl:variable>
690                     <xsl:call-template name="chopPunctuation">
691                         <xsl:with-param name="chopString">
692                             <xsl:value-of select="$str"/>
693                         </xsl:with-param>
694                     </xsl:call-template>
695                     <!-- add relator code too between brackets-->
696                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
697                         <span class="relatorcode">
698                             <xsl:text> [</xsl:text>
699                             <xsl:choose>
700                                 <xsl:when test="marc:subfield[@code='e']">
701                                     <xsl:for-each select="marc:subfield[@code='e']">
702                                         <xsl:value-of select="."/>
703                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
704                                     </xsl:for-each>
705                                 </xsl:when>
706                                 <xsl:otherwise>
707                                     <xsl:for-each select="marc:subfield[@code='4']">
708                                         <xsl:value-of select="."/>
709                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
710                                     </xsl:for-each>
711                                 </xsl:otherwise>
712                             </xsl:choose>
713                             <xsl:text>]</xsl:text>
714                         </span>
715                     </xsl:if>
716                     <xsl:choose>
717                         <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
718                     </xsl:choose>
719                 </xsl:for-each>
720             </span>
721         </xsl:if>
722
723         <!-- #13382 Added Contained Works 7xx@ind2=2 -->
724         <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'])]">
725             <span class="results_summary contained_works"><span class="label">Contained works: </span>
726                 <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'])]">
727                     <xsl:variable name="str">
728                         <xsl:call-template name="subfieldSelect">
729                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
730                         </xsl:call-template>
731                     </xsl:variable>
732                     <xsl:call-template name="chopPunctuation">
733                         <xsl:with-param name="chopString">
734                             <xsl:value-of select="$str"/>
735                         </xsl:with-param>
736                     </xsl:call-template>
737                     <!-- add relator code too between brackets-->
738                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
739                         <span class="relatorcode">
740                             <xsl:text> [</xsl:text>
741                             <xsl:choose>
742                                 <xsl:when test="marc:subfield[@code='e']">
743                                     <xsl:for-each select="marc:subfield[@code='e']">
744                                         <xsl:value-of select="."/>
745                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
746                                     </xsl:for-each>
747                                 </xsl:when>
748                                 <xsl:otherwise>
749                                     <xsl:for-each select="marc:subfield[@code='4']">
750                                         <xsl:value-of select="."/>
751                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
752                                     </xsl:for-each>
753                                 </xsl:otherwise>
754                             </xsl:choose>
755                             <xsl:text>]</xsl:text>
756                         </span>
757                     </xsl:if>
758                     <xsl:choose>
759                         <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
760                     </xsl:choose>
761                 </xsl:for-each>
762             </span>
763         </xsl:if>
764
765
766         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
767             <span class="results_summary subjects"><span class="label">Subject(s): </span>
768             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
769             <a>
770             <xsl:choose>
771             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
772             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
773                 <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>
774             </xsl:when>
775             <xsl:when test="$TraceSubjectSubdivisions='1'">
776                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
777                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
778                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
779                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
780                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
781                         <xsl:with-param name="urlencode">1</xsl:with-param>
782                     </xsl:call-template>
783                 </xsl:attribute>
784             </xsl:when>
785
786             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
787             <xsl:otherwise>
788                 <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>
789             </xsl:otherwise>
790             </xsl:choose>
791
792             <xsl:call-template name="chopPunctuation">
793                 <xsl:with-param name="chopString">
794                     <xsl:call-template name="subfieldSelect">
795                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
796                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
797                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
798                     </xsl:call-template>
799                 </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
816             <xsl:choose>
817             <xsl:when test="position()=last()"></xsl:when>
818             <xsl:otherwise> | </xsl:otherwise>
819             </xsl:choose>
820
821             </xsl:for-each>
822             </span>
823         </xsl:if>
824
825         <!-- Genre/Form -->
826         <xsl:if test="marc:datafield[@tag=655]">
827             <span class="results_summary genre"><span class="label">Genre/Form: </span>
828                 <xsl:for-each select="marc:datafield[@tag=655]">
829                     <a>
830                         <xsl:choose>
831                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
832                                 <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>
833                             </xsl:when>
834                             <xsl:when test="$TraceSubjectSubdivisions='1'">
835                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
836                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
837                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
838                                     <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
839                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
840                                     <xsl:with-param name="urlencode">1</xsl:with-param>
841                                 </xsl:call-template>
842                                 </xsl:attribute>
843                             </xsl:when>
844                             <xsl:otherwise>
845                                 <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>
846                             </xsl:otherwise>
847                         </xsl:choose>
848                     <xsl:call-template name="subfieldSelect">
849                         <xsl:with-param name="codes">avxyz</xsl:with-param>
850                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
851                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
852                     </xsl:call-template>
853                     </a>
854
855                     <xsl:if test="marc:subfield[@code=9]">
856                         <xsl:text> </xsl:text>
857                         <a class='authlink'>
858                             <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>
859                             <xsl:element name="img">
860                                 <xsl:attribute name="src">/intranet-tmpl/prog/img/filefind.png</xsl:attribute>
861                                 <xsl:attribute name="alt"></xsl:attribute>
862                                 <xsl:attribute name="height">15</xsl:attribute>
863                                 <xsl:attribute name="width">15</xsl:attribute>
864                             </xsl:element>
865                         </a>
866                     </xsl:if>
867                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
868                 </xsl:for-each>
869             </span>
870         </xsl:if>
871
872 <!-- MARC21 776 Additional Physical Form Entry -->
873     <xsl:if test="marc:datafield[@tag=776]">
874         <span class="results_summary add_physical_form">
875             <span class="label">Additional physical formats: </span>
876             <xsl:for-each select="marc:datafield[@tag=776]">
877                 <xsl:variable name="linktext">
878                     <xsl:choose>
879                     <xsl:when test="marc:subfield[@code='t']">
880                         <xsl:value-of select="marc:subfield[@code='t']"/>
881                     </xsl:when>
882                     <xsl:when test="marc:subfield[@code='a']">
883                         <xsl:value-of select="marc:subfield[@code='a']"/>
884                     </xsl:when>
885                     <xsl:otherwise>
886                         <xsl:text>No title</xsl:text>
887                     </xsl:otherwise>
888                     </xsl:choose>
889                 </xsl:variable>
890                 <xsl:if test="@ind2=8 and marc:subfield[@code='i']">
891                     <xsl:call-template name="subfieldSelect">
892                         <xsl:with-param name="codes">i</xsl:with-param>
893                     </xsl:call-template>
894                     <xsl:text>: </xsl:text>
895                 </xsl:if>
896                 <xsl:choose>
897                 <xsl:when test="marc:subfield[@code='w']">
898                     <a>
899                     <xsl:attribute name="href">
900                         <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=control-number:</xsl:text>
901                         <xsl:call-template name="extractControlNumber">
902                             <xsl:with-param name="subfieldW">
903                                 <xsl:value-of select="marc:subfield[@code='w']"/>
904                             </xsl:with-param>
905                         </xsl:call-template>
906                     </xsl:attribute>
907                     <xsl:value-of select="$linktext"/>
908                     </a>
909                 </xsl:when>
910                 <xsl:otherwise>
911                     <xsl:value-of select="$linktext"/>
912                 </xsl:otherwise>
913                 </xsl:choose>
914                 <xsl:if test="position() != last()">
915                     <xsl:text>; </xsl:text>
916                 </xsl:if>
917             </xsl:for-each>
918         </span>
919     </xsl:if>
920
921 <!-- MARC21 777 - Issued With Entry -->
922     <xsl:if test="marc:datafield[@tag=777]">
923         <xsl:for-each select="marc:datafield[@tag=777]">
924             <xsl:if test="@ind1 != 1">
925                 <span class="results_summary issued_with">
926                     <span class="label">
927                         <xsl:choose>
928                             <xsl:when test="@ind2=8 and marc:subfield[@code='i']">
929                                 <xsl:value-of select="marc:subfield[@code='i']"/>
930                             </xsl:when>
931                             <xsl:otherwise>
932                                 <xsl:text>Issued with:</xsl:text>
933                             </xsl:otherwise>
934                         </xsl:choose>
935                         <xsl:text> </xsl:text>
936                     </span>
937                     <xsl:variable name="f777">
938                         <xsl:call-template name="chopPunctuation">
939                             <xsl:with-param name="chopString">
940                                 <xsl:call-template name="subfieldSelect">
941                                     <xsl:with-param name="codes">a_t</xsl:with-param>
942                                 </xsl:call-template>
943                             </xsl:with-param>
944                         </xsl:call-template>
945                     </xsl:variable>
946                     <xsl:choose>
947                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
948                             <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>
949                             <xsl:value-of select="translate($f777, '()', '')"/>
950                             </a>
951                         </xsl:when>
952                         <xsl:otherwise>
953                             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(marc:subfield[@code='t'], true())"/></xsl:attribute>
954                             <xsl:value-of select="$f777"/>
955                             </a>
956                         </xsl:otherwise>
957                     </xsl:choose>
958                     <xsl:if test="marc:subfield[@code='g']">
959                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
960                     </xsl:if>
961                 </span>
962                 <xsl:if test="marc:subfield[@code='n']">
963                     <xsl:text> </xsl:text><span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
964                 </xsl:if>
965             </xsl:if>
966         </xsl:for-each>
967     </xsl:if>
968
969 <!-- DDC classification -->
970     <xsl:if test="marc:datafield[@tag=082]">
971         <span class="results_summary ddc">
972             <span class="label">DDC classification: </span>
973             <xsl:for-each select="marc:datafield[@tag=082]">
974                 <xsl:call-template name="subfieldSelect">
975                     <xsl:with-param name="codes">a</xsl:with-param>
976                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
977                 </xsl:call-template>
978                 <xsl:choose>
979                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
980                     <xsl:otherwise> | </xsl:otherwise>
981                 </xsl:choose>
982             </xsl:for-each>
983         </span>
984     </xsl:if>
985
986 <!-- LOC classification -->
987     <xsl:if test="marc:datafield[@tag=050]">
988         <span class="results_summary loc">
989             <span class="label">LOC classification: </span>
990             <xsl:for-each select="marc:datafield[@tag=050]">
991                 <xsl:call-template name="subfieldSelect">
992                     <xsl:with-param name="codes">ab</xsl:with-param>
993                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
994                 </xsl:call-template>
995             </xsl:for-each>
996         </span>
997     </xsl:if>
998
999 <!-- NLM classification -->
1000     <xsl:if test="marc:datafield[@tag=060]">
1001         <span class="results_summary nlm">
1002             <span class="label">NLM classification: </span>
1003             <xsl:for-each select="marc:datafield[@tag=060]">
1004                 <xsl:call-template name="subfieldSelect">
1005                     <xsl:with-param name="codes">a</xsl:with-param>
1006                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
1007                 </xsl:call-template>
1008                 <xsl:if test="not(position()=last())"><xsl:text> | </xsl:text></xsl:if>
1009             </xsl:for-each>
1010         </span>
1011     </xsl:if>
1012
1013 <!-- Other classification -->
1014     <xsl:if test="marc:datafield[@tag=084]">
1015        <span class="results_summary oc">
1016            <span class="label">Other classification: </span>
1017           <xsl:for-each select="marc:datafield[@tag=084]">
1018                 <xsl:call-template name="subfieldSelect">
1019                    <xsl:with-param name="codes">a</xsl:with-param>
1020                    <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
1021                 </xsl:call-template>
1022                 <xsl:choose>
1023                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
1024                    <xsl:otherwise> | </xsl:otherwise>
1025                 </xsl:choose>
1026           </xsl:for-each>
1027        </span>
1028     </xsl:if>
1029
1030     <xsl:if test="marc:datafield[@tag=856]">
1031         <span class="results_summary online_resources"><span class="label">Online resources: </span>
1032         <xsl:for-each select="marc:datafield[@tag=856]">
1033             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
1034             <a>
1035                 <xsl:attribute name="href">
1036                     <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
1037                         <xsl:choose>
1038                             <xsl:when test="@ind1=7">
1039                                 <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
1040                             </xsl:when>
1041                             <xsl:when test="@ind1=1">
1042                                 <xsl:text>ftp://</xsl:text>
1043                             </xsl:when>
1044                             <xsl:otherwise>
1045                                 <xsl:text>http://</xsl:text>
1046                             </xsl:otherwise>
1047                         </xsl:choose>
1048                     </xsl:if>
1049                     <xsl:value-of select="marc:subfield[@code='u']"/>
1050                 </xsl:attribute>
1051                 <xsl:choose>
1052                     <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')">
1053                         <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>
1054                     </xsl:when>
1055                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1056                         <xsl:call-template name="subfieldSelect">
1057                             <xsl:with-param name="codes">y3z</xsl:with-param>
1058                         </xsl:call-template>
1059                     </xsl:when>
1060                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
1061                         <xsl:choose>
1062                             <xsl:when test="$URLLinkText!=''">
1063                                 <xsl:value-of select="$URLLinkText"/>
1064                             </xsl:when>
1065                             <xsl:otherwise>
1066                                 <xsl:text>Click here to access online</xsl:text>
1067                             </xsl:otherwise>
1068                         </xsl:choose>
1069                     </xsl:when>
1070                 </xsl:choose>
1071             </a>
1072             <xsl:choose>
1073                 <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
1074                 <xsl:otherwise> | </xsl:otherwise>
1075             </xsl:choose>
1076
1077         </xsl:for-each>
1078         </span>
1079     </xsl:if>
1080
1081         <!-- 505 - Formatted contents note -->
1082         <xsl:if test="marc:datafield[@tag=505]">
1083             <div class="results_summary contents">
1084             <xsl:choose>
1085                 <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
1086                     <span class="label">Contents:</span>
1087                 </xsl:when>
1088                 <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
1089                     <span class="label">Incomplete contents:</span>
1090                 </xsl:when>
1091                 <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
1092                     <span class="label">Partial contents:</span>
1093                 </xsl:when>
1094             </xsl:choose>
1095                 <xsl:for-each select="marc:datafield[@tag=505]">
1096                     <div class='contentblock'>
1097                         <xsl:choose>
1098                         <xsl:when test="@ind2=0">
1099                             <xsl:call-template name="subfieldSelectSpan">
1100                                 <xsl:with-param name="newline">1</xsl:with-param>
1101                                 <xsl:with-param name="codes">trug</xsl:with-param>
1102                             </xsl:call-template>
1103                         </xsl:when>
1104                         <xsl:otherwise>
1105                             <xsl:call-template name="subfieldSelectSpan">
1106                                 <xsl:with-param name="newline">1</xsl:with-param>
1107                                 <xsl:with-param name="codes">atrug</xsl:with-param>
1108                             </xsl:call-template>
1109                         </xsl:otherwise>
1110                         </xsl:choose>
1111                     </div>
1112                 </xsl:for-each>
1113             </div>
1114         </xsl:if>
1115
1116         <!-- 586 -->
1117         <xsl:if test="marc:datafield[@tag=586]">
1118             <span class="results_summary awardsnote">
1119                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
1120                     <span class="label">Awards: </span>
1121                 </xsl:if>
1122                 <xsl:for-each select="marc:datafield[@tag=586]">
1123                     <xsl:value-of select="marc:subfield[@code='a']"/>
1124                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1125                 </xsl:for-each>
1126             </span>
1127         </xsl:if>
1128
1129         <!-- 508 -->
1130         <xsl:if test="marc:datafield[@tag=508]">
1131             <span class="results_summary prod_credits">
1132                 <span class="label">Production credits: </span>
1133                 <xsl:for-each select="marc:datafield[@tag=508]">
1134                     <xsl:call-template name="subfieldSelectSpan">
1135                         <xsl:with-param name="codes">a</xsl:with-param>
1136                     </xsl:call-template>
1137                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1138                 </xsl:for-each>
1139             </span>
1140         </xsl:if>
1141
1142          <!-- 583 -->
1143          <xsl:if test="marc:datafield[@tag=583]">
1144             <span class="results_summary actionnote">
1145                 <span class="label">Action note: </span>
1146                 <xsl:for-each select="marc:datafield[@tag=583]">
1147                     <xsl:choose>
1148                         <xsl:when test="marc:subfield[@code='z']">
1149                             <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
1150                         </xsl:when>
1151                         <xsl:otherwise>
1152                             <xsl:call-template name="subfieldSelect">
1153                                 <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
1154                             </xsl:call-template>
1155                         </xsl:otherwise>
1156                     </xsl:choose>
1157                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1158                 </xsl:for-each>
1159             </span>
1160          </xsl:if>
1161
1162         <!-- 773 -->
1163         <xsl:if test="marc:datafield[@tag=773]">
1164             <xsl:for-each select="marc:datafield[@tag=773]">
1165                 <xsl:if test="@ind1 !=1">
1166                     <span class="results_summary in"><span class="label">
1167                     <xsl:choose>
1168                         <xsl:when test="@ind2=' '">
1169                             In:
1170                         </xsl:when>
1171                         <xsl:when test="@ind2=8">
1172                             <xsl:if test="marc:subfield[@code='i']">
1173                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1174                             </xsl:if>
1175                         </xsl:when>
1176                     </xsl:choose>
1177                     </span>
1178                     <xsl:variable name="f773">
1179                         <xsl:call-template name="chopPunctuation">
1180                             <xsl:with-param name="chopString">
1181                                 <xsl:call-template name="subfieldSelect">
1182                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1183                                 </xsl:call-template>
1184                             </xsl:with-param>
1185                         </xsl:call-template>
1186                     </xsl:variable>
1187                     <xsl:choose>
1188                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1189                             <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>
1190                             <xsl:value-of select="translate($f773, '()', '')"/>
1191                             </a>
1192                         </xsl:when>
1193                         <xsl:when test="marc:subfield[@code='0']">
1194                             <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>
1195                             <xsl:value-of select="$f773"/>
1196                             </a>
1197                         </xsl:when>
1198                         <xsl:otherwise>
1199                             <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>
1200                             <xsl:value-of select="$f773"/>
1201                             </a>
1202                         </xsl:otherwise>
1203                     </xsl:choose>
1204                     <xsl:if test="marc:subfield[@code='g']">
1205                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
1206                     </xsl:if>
1207                     </span>
1208
1209                     <xsl:if test="marc:subfield[@code='n']">
1210                         <span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1211                     </xsl:if>
1212
1213                 </xsl:if>
1214             </xsl:for-each>
1215         </xsl:if>
1216
1217         <xsl:if test="marc:datafield[@tag=502]">
1218             <span class="results_summary diss_note">
1219                 <span class="label">Dissertation note: </span>
1220                 <xsl:for-each select="marc:datafield[@tag=502]">
1221                     <xsl:call-template name="subfieldSelect">
1222                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1223                     </xsl:call-template>
1224                 </xsl:for-each>
1225                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1226             </span>
1227         </xsl:if>
1228
1229         <!-- 866 textual holdings -->
1230         <xsl:if test="marc:datafield[@tag=866]">
1231             <span class="results_summary holdings_note basic_bibliographic_unit"><span class="label">Holdings: </span>
1232                 <xsl:for-each select="marc:datafield[@tag=866]">
1233                     <span class="holdings_note_data">
1234                         <xsl:call-template name="subfieldSelect">
1235                             <xsl:with-param name="codes">axz</xsl:with-param>
1236                         </xsl:call-template>
1237                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1238                     </span>
1239                 </xsl:for-each>
1240             </span>
1241         </xsl:if>
1242
1243         <!-- 867 textual holdings -->
1244         <xsl:if test="marc:datafield[@tag=867]">
1245             <span class="results_summary holdings_note supplementary_material"><span class="label">Supplements: </span>
1246                 <xsl:for-each select="marc:datafield[@tag=867]">
1247                     <span class="holdings_note_data">
1248                         <xsl:call-template name="subfieldSelect">
1249                             <xsl:with-param name="codes">axz</xsl:with-param>
1250                         </xsl:call-template>
1251                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1252                     </span>
1253                 </xsl:for-each>
1254             </span>
1255         </xsl:if>
1256
1257         <!-- 868 textual holdings -->
1258         <xsl:if test="marc:datafield[@tag=868]">
1259             <span class="results_summary holdings_note indexes"><span class="label">Indexes: </span>
1260                 <xsl:for-each select="marc:datafield[@tag=868]">
1261                     <span class="holdings_note_data">
1262                         <xsl:call-template name="subfieldSelect">
1263                             <xsl:with-param name="codes">axz</xsl:with-param>
1264                         </xsl:call-template>
1265                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1266                     </span>
1267                 </xsl:for-each>
1268             </span>
1269         </xsl:if>
1270
1271
1272         <!--  775 Other Edition  -->
1273         <xsl:if test="marc:datafield[@tag=775]">
1274         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1275         <xsl:for-each select="marc:datafield[@tag=775]">
1276             <xsl:variable name="f775">
1277                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1278                 <xsl:with-param name="codes">a_t</xsl:with-param>
1279                 </xsl:call-template></xsl:with-param></xsl:call-template>
1280             </xsl:variable>
1281             <xsl:if test="marc:subfield[@code='i']">
1282                 <xsl:call-template name="subfieldSelect">
1283                     <xsl:with-param name="codes">i</xsl:with-param>
1284                 </xsl:call-template>
1285                 <xsl:text>: </xsl:text>
1286             </xsl:if>
1287             <a>
1288             <xsl:choose>
1289             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1290                 <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>
1291             </xsl:when>
1292             <xsl:otherwise>
1293                 <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>
1294             </xsl:otherwise>
1295             </xsl:choose>
1296             <xsl:call-template name="subfieldSelect">
1297                 <xsl:with-param name="codes">a_t</xsl:with-param>
1298             </xsl:call-template>
1299             </a>
1300             <xsl:choose>
1301                 <xsl:when test="position()=last()"></xsl:when>
1302                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1303             </xsl:choose>
1304         </xsl:for-each>
1305         </span>
1306         </xsl:if>
1307
1308         <!-- 780 -->
1309         <xsl:if test="marc:datafield[@tag=780]">
1310             <xsl:for-each select="marc:datafield[@tag=780]">
1311                 <xsl:if test="@ind1=0">
1312                     <span class="results_summary preceeding_entry">
1313                         <xsl:choose>
1314                             <xsl:when test="@ind2=0">
1315                                <span class="label">Continues:</span>
1316                             </xsl:when>
1317                             <xsl:when test="@ind2=1">
1318                                <span class="label">Continues in part:</span>
1319                             </xsl:when>
1320                             <xsl:when test="@ind2=2">
1321                                <span class="label">Supersedes:</span>
1322                             </xsl:when>
1323                             <xsl:when test="@ind2=3">
1324                                <span class="label">Supersedes in part:</span>
1325                             </xsl:when>
1326                             <xsl:when test="@ind2=4">
1327                                <span class="label">Formed by the union: ... and: ...</span>
1328                             </xsl:when>
1329                             <xsl:when test="@ind2=5">
1330                                <span class="label">Absorbed:</span>
1331                             </xsl:when>
1332                             <xsl:when test="@ind2=6">
1333                                <span class="label">Absorbed in part:</span>
1334                             </xsl:when>
1335                             <xsl:when test="@ind2=7">
1336                                <span class="label">Separated from:</span>
1337                             </xsl:when>
1338                         </xsl:choose>
1339                         <xsl:text> </xsl:text>
1340
1341                         <xsl:if test="marc:subfield[@code='i']">
1342                             <span class="780_rel_info">
1343                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1344                                 <xsl:text> </xsl:text>
1345                             </span>
1346                         </xsl:if>
1347
1348                         <xsl:variable name="f780">
1349                             <xsl:call-template name="subfieldSelect">
1350                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1351                             </xsl:call-template>
1352                         </xsl:variable>
1353                         <xsl:choose>
1354                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1355                                 <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>
1356                                     <xsl:value-of select="$f780"/>
1357                                 </a>
1358                             </xsl:when>
1359                             <xsl:otherwise>
1360                                 <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>
1361                                     <xsl:value-of select="$f780"/>
1362                                 </a>
1363                             </xsl:otherwise>
1364                         </xsl:choose>
1365                     </span>
1366
1367                     <xsl:if test="marc:subfield[@code='n']">
1368                         <span class="results_summary preceeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1369                     </xsl:if>
1370
1371                 </xsl:if>
1372             </xsl:for-each>
1373         </xsl:if>
1374
1375         <!-- 785 -->
1376         <xsl:if test="marc:datafield[@tag=785]">
1377             <xsl:for-each select="marc:datafield[@tag=785]">
1378                 <xsl:if test="@ind1=0">
1379                     <span class="results_summary succeeding_entry">
1380                         <xsl:choose>
1381                             <xsl:when test="@ind2=0">
1382                                 <span class="label">Continued by:</span>
1383                             </xsl:when>
1384                             <xsl:when test="@ind2=1">
1385                                 <span class="label">Continued in part by:</span>
1386                             </xsl:when>
1387                             <xsl:when test="@ind2=2">
1388                                 <span class="label">Superseded by:</span>
1389                             </xsl:when>
1390                             <xsl:when test="@ind2=3">
1391                                 <span class="label">Superseded in part by:</span>
1392                             </xsl:when>
1393                             <xsl:when test="@ind2=4">
1394                                 <span class="label">Absorbed by:</span>
1395                             </xsl:when>
1396                             <xsl:when test="@ind2=5">
1397                                 <span class="label">Absorbed in part by:</span>
1398                             </xsl:when>
1399                             <xsl:when test="@ind2=6">
1400                                 <span class="label">Split into .. and ...:</span>
1401                             </xsl:when>
1402                             <xsl:when test="@ind2=7">
1403                                 <span class="label">Merged with ... to form ...</span>
1404                             </xsl:when>
1405                             <xsl:when test="@ind2=8">
1406                                 <span class="label">Changed back to:</span>
1407                             </xsl:when>
1408                         </xsl:choose>
1409                         <xsl:text> </xsl:text>
1410
1411                         <xsl:if test="marc:subfield[@code='i']">
1412                             <span class="785_rel_info">
1413                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1414                                 <xsl:text> </xsl:text>
1415                             </span>
1416                         </xsl:if>
1417
1418                         <xsl:variable name="f785">
1419                             <xsl:call-template name="subfieldSelect">
1420                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1421                             </xsl:call-template>
1422                         </xsl:variable>
1423
1424                         <xsl:choose>
1425                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1426                                 <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>
1427                                     <xsl:value-of select="$f785"/>
1428                                 </a>
1429                             </xsl:when>
1430                             <xsl:otherwise>
1431                                 <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>
1432                                     <xsl:value-of select="$f785"/>
1433                                 </a>
1434                             </xsl:otherwise>
1435                         </xsl:choose>
1436
1437                     </span>
1438                 </xsl:if>
1439             </xsl:for-each>
1440         </xsl:if>
1441
1442         <xsl:if test="$OPACBaseURL!=''">
1443         <span class="results_summary opac_view"><span class="label">OPAC view: </span>
1444             <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>.
1445         </span>
1446         </xsl:if>
1447
1448     </xsl:template>
1449
1450     <xsl:template name="nameABCQ">
1451             <xsl:call-template name="chopPunctuation">
1452                 <xsl:with-param name="chopString">
1453                     <xsl:call-template name="subfieldSelect">
1454                         <xsl:with-param name="codes">abcq</xsl:with-param>
1455                     </xsl:call-template>
1456                 </xsl:with-param>
1457                 <xsl:with-param name="punctuation">
1458                     <xsl:text>:,;/ </xsl:text>
1459                 </xsl:with-param>
1460             </xsl:call-template>
1461     </xsl:template>
1462
1463     <xsl:template name="nameABCDN">
1464             <xsl:call-template name="chopPunctuation">
1465                 <xsl:with-param name="chopString">
1466                     <xsl:call-template name="subfieldSelect">
1467                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1468                     </xsl:call-template>
1469                 </xsl:with-param>
1470                 <xsl:with-param name="punctuation">
1471                     <xsl:text>:,;/ </xsl:text>
1472                 </xsl:with-param>
1473             </xsl:call-template>
1474     </xsl:template>
1475
1476     <xsl:template name="nameACDEQ">
1477             <xsl:call-template name="subfieldSelect">
1478                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1479             </xsl:call-template>
1480     </xsl:template>
1481
1482     <xsl:template name="part">
1483         <xsl:variable name="partNumber">
1484             <xsl:call-template name="specialSubfieldSelect">
1485                 <xsl:with-param name="axis">n</xsl:with-param>
1486                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1487                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1488             </xsl:call-template>
1489         </xsl:variable>
1490         <xsl:variable name="partName">
1491             <xsl:call-template name="specialSubfieldSelect">
1492                 <xsl:with-param name="axis">p</xsl:with-param>
1493                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1494                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1495             </xsl:call-template>
1496         </xsl:variable>
1497         <xsl:if test="string-length(normalize-space($partNumber))">
1498                 <xsl:call-template name="chopPunctuation">
1499                     <xsl:with-param name="chopString" select="$partNumber"/>
1500                 </xsl:call-template>
1501         </xsl:if>
1502         <xsl:if test="string-length(normalize-space($partName))">
1503                 <xsl:call-template name="chopPunctuation">
1504                     <xsl:with-param name="chopString" select="$partName"/>
1505                 </xsl:call-template>
1506         </xsl:if>
1507     </xsl:template>
1508
1509     <xsl:template name="specialSubfieldSelect">
1510         <xsl:param name="anyCodes"/>
1511         <xsl:param name="axis"/>
1512         <xsl:param name="beforeCodes"/>
1513         <xsl:param name="afterCodes"/>
1514         <xsl:variable name="str">
1515             <xsl:for-each select="marc:subfield">
1516                 <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])">
1517                     <xsl:value-of select="text()"/>
1518                     <xsl:text> </xsl:text>
1519                 </xsl:if>
1520             </xsl:for-each>
1521         </xsl:variable>
1522         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1523     </xsl:template>
1524
1525     <xsl:template name="showAuthor">
1526         <xsl:param name="authorfield"/>
1527     <xsl:param name="UseAuthoritiesForTracings"/>
1528         <xsl:if test="count($authorfield)&gt;0">
1529         <h5 class="author">
1530         <xsl:for-each select="$authorfield">
1531         <xsl:choose>
1532           <xsl:when test="position()&gt;1"/>
1533           <!-- #13383 -->
1534           <xsl:when test="@tag&lt;700"><span class="byAuthor">By: </span></xsl:when>
1535           <!--#13382 Changed Additional author to contributor -->
1536           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1537         </xsl:choose>
1538         <a>
1539         <xsl:choose>
1540             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1541                 <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>
1542             </xsl:when>
1543             <xsl:otherwise>
1544             <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>
1545             </xsl:otherwise>
1546         </xsl:choose>
1547         <xsl:choose>
1548             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1549                 <!-- #13383 -->
1550                 <xsl:call-template name="chopPunctuation">
1551                     <xsl:with-param name="chopString">
1552                         <xsl:call-template name="subfieldSelect">
1553                             <xsl:with-param name="codes">
1554                                 <xsl:choose>
1555                                     <!-- #13383 include subfield e for field 111, Display only name portion in 1XX -->
1556                                     <xsl:when test="@tag=111">aeq</xsl:when>
1557                                     <xsl:when test="@tag=110">ab</xsl:when>
1558                                     <xsl:otherwise>abcjq</xsl:otherwise>
1559                                 </xsl:choose>
1560                             </xsl:with-param>
1561                         </xsl:call-template>
1562                     </xsl:with-param>
1563                     <xsl:with-param name="punctuation">
1564                         <xsl:text>:,;/ </xsl:text>
1565                     </xsl:with-param>
1566                 </xsl:call-template>
1567                     <!-- Display only name and title portion in 110 field -->
1568                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1569                     <span class="titleportion">
1570                     <xsl:choose>
1571                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1572                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1573                     </xsl:choose>
1574                     <xsl:call-template name="chopPunctuation">
1575                         <xsl:with-param name="chopString">
1576                         <xsl:call-template name="subfieldSelect">
1577                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1578                         </xsl:call-template>
1579                         </xsl:with-param>
1580                     </xsl:call-template>
1581                     </span>
1582                     </xsl:if>
1583                     <!-- Display only name and title portion in 111 field -->
1584             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1585                     <span class="titleportion">
1586                     <xsl:choose>
1587                         <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>
1588                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1589                     </xsl:choose>
1590
1591                     <xsl:call-template name="chopPunctuation">
1592                         <xsl:with-param name="chopString">
1593                         <xsl:call-template name="subfieldSelect">
1594                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1595                         </xsl:call-template>
1596                         </xsl:with-param>
1597                     </xsl:call-template>
1598                     </span>
1599             </xsl:if>
1600             <!-- Display only dates in 100 field -->
1601             <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1602                 <span class="authordates">
1603                 <xsl:text>, </xsl:text>
1604                 <xsl:call-template name="chopPunctuation">
1605                     <xsl:with-param name="chopString">
1606                         <xsl:call-template name="subfieldSelect">
1607                            <xsl:with-param name="codes">d</xsl:with-param>
1608                         </xsl:call-template>
1609                         </xsl:with-param>
1610                     </xsl:call-template>
1611                     </span>
1612             </xsl:if>
1613
1614             </xsl:when>
1615             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1616             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1617             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1618                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1619                     <xsl:if test="@tag=710 or @tag=711">
1620                     <xsl:call-template name="chopPunctuation">
1621                         <xsl:with-param name="chopString">
1622                             <xsl:call-template name="subfieldSelect">
1623                             <xsl:with-param name="codes">
1624                             <xsl:choose>
1625                                 <xsl:when test="@tag=711">aeq</xsl:when>
1626                                 <xsl:otherwise>ab</xsl:otherwise>
1627                             </xsl:choose>
1628                             </xsl:with-param>
1629                             </xsl:call-template>
1630                         </xsl:with-param>
1631                         <xsl:with-param name="punctuation">
1632                             <xsl:text>:,;/ </xsl:text>
1633                         </xsl:with-param>
1634                     </xsl:call-template>
1635                     <!-- Display only name and title portion in 711 field -->
1636                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1637                     <span class="titleportion">
1638                     <xsl:choose>
1639                         <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>
1640                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1641                     </xsl:choose>
1642
1643                     <xsl:call-template name="chopPunctuation">
1644                         <xsl:with-param name="chopString">
1645                         <xsl:call-template name="subfieldSelect">
1646                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1647                         </xsl:call-template>
1648                         </xsl:with-param>
1649                     </xsl:call-template>
1650                     </span>
1651                     </xsl:if>
1652                     <!-- Display only name and title portion in 710 field -->
1653                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1654                     <span class="titleportion">
1655                     <xsl:choose>
1656                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1657                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1658                     </xsl:choose>
1659                     <xsl:call-template name="chopPunctuation">
1660                         <xsl:with-param name="chopString">
1661                         <xsl:call-template name="subfieldSelect">
1662                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1663                         </xsl:call-template>
1664                         </xsl:with-param>
1665                     </xsl:call-template>
1666                     </span>
1667                     </xsl:if>
1668
1669                     </xsl:if>
1670                         <!-- Display only name portion in 700 field -->
1671                         <xsl:if test="@tag=700">
1672                            <xsl:call-template name="chopPunctuation">
1673                                <xsl:with-param name="chopString">
1674                                <xsl:call-template name="subfieldSelect">
1675                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1676                                </xsl:call-template>
1677                                </xsl:with-param>
1678                         </xsl:call-template>
1679                         </xsl:if>
1680                         <!-- Display class "authordates" in 700 field -->
1681                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1682                         <span class="authordates">
1683                         <xsl:text>, </xsl:text>
1684                         <xsl:call-template name="chopPunctuation">
1685                             <xsl:with-param name="chopString">
1686                             <xsl:call-template name="subfieldSelect">
1687                                <xsl:with-param name="codes">d</xsl:with-param>
1688                             </xsl:call-template>
1689                             </xsl:with-param>
1690                         </xsl:call-template>
1691                         </span>
1692                         </xsl:if>
1693                         <!-- Display class "titleportion" in 700 field -->
1694                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1695                         <xsl:if test="@tag=700 and $titleportionfields">
1696                         <span class="titleportion">
1697                         <xsl:text>. </xsl:text>
1698                         <xsl:call-template name="chopPunctuation">
1699                             <xsl:with-param name="chopString">
1700                             <xsl:call-template name="subfieldSelect">
1701                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1702                             </xsl:call-template>
1703                             </xsl:with-param>
1704                         </xsl:call-template>
1705                         </span>
1706                         </xsl:if>
1707
1708         </xsl:when>
1709         </xsl:choose>
1710
1711     <!-- add relator code too between brackets-->
1712     <!-- #13383 include relator code j for field 111 -->
1713             <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'])">
1714                 <span class="relatorcode">
1715                     <xsl:text> [</xsl:text>
1716                     <xsl:choose>
1717                         <xsl:when test="@tag=111 or @tag=711">
1718                             <xsl:choose>
1719                                 <!-- Prefer j over 4 for fields 111 and 711-->
1720                                 <xsl:when test="marc:subfield[@code='j']">
1721                                     <xsl:for-each select="marc:subfield[@code='j']">
1722                                         <xsl:value-of select="."/>
1723                                         <xsl:if test="position() != last()">, </xsl:if>
1724                                     </xsl:for-each>
1725                                 </xsl:when>
1726                                 <xsl:otherwise>
1727                                     <xsl:for-each select="marc:subfield[@code=4]">
1728                                         <xsl:value-of select="."/>
1729                                         <xsl:if test="position() != last()">, </xsl:if>
1730                                     </xsl:for-each>
1731                                 </xsl:otherwise>
1732                             </xsl:choose>
1733                         </xsl:when>
1734                         <!-- Prefer e over 4 for fields 111 and 711-->
1735                         <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1736                             <xsl:for-each select="marc:subfield[@code='e']">
1737                                 <xsl:value-of select="."/>
1738                                 <xsl:if test="position() != last()">, </xsl:if>
1739                             </xsl:for-each>
1740                         </xsl:when>
1741                         <xsl:otherwise>
1742                             <xsl:for-each select="marc:subfield[@code=4]">
1743                                 <xsl:value-of select="."/>
1744                                 <xsl:if test="position() != last()">, </xsl:if>
1745                             </xsl:for-each>
1746                         </xsl:otherwise>
1747                     </xsl:choose>
1748                     <xsl:text>]</xsl:text>
1749                 </span>
1750             </xsl:if>
1751         </a>
1752         <xsl:choose>
1753             <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1754         </xsl:choose>
1755         </xsl:for-each>
1756         </h5>
1757
1758         </xsl:if>
1759     </xsl:template>
1760
1761     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1762     <xsl:template name="subfieldSelectSubject">
1763         <xsl:param name="codes"/>
1764         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1765         <xsl:param name="subdivCodes"/>
1766         <xsl:param name="subdivDelimiter"/>
1767         <xsl:param name="prefix"/>
1768         <xsl:param name="suffix"/>
1769         <xsl:param name="urlencode"/>
1770         <xsl:variable name="str">
1771             <xsl:for-each select="marc:subfield">
1772                 <xsl:if test="contains($codes, @code)">
1773                     <xsl:if test="contains($subdivCodes, @code)">
1774                         <xsl:value-of select="$subdivDelimiter"/>
1775                     </xsl:if>
1776                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1777                 </xsl:if>
1778             </xsl:for-each>
1779         </xsl:variable>
1780         <xsl:choose>
1781             <xsl:when test="$urlencode=1">
1782                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
1783             </xsl:when>
1784             <xsl:otherwise>
1785                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1786             </xsl:otherwise>
1787         </xsl:choose>
1788     </xsl:template>
1789
1790 </xsl:stylesheet>