Bug 19616: (follow-up) Breaking items according to punctuation
[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 <!-- DDC classification -->
922     <xsl:if test="marc:datafield[@tag=082]">
923         <span class="results_summary ddc">
924             <span class="label">DDC classification: </span>
925             <xsl:for-each select="marc:datafield[@tag=082]">
926                 <xsl:call-template name="subfieldSelect">
927                     <xsl:with-param name="codes">a</xsl:with-param>
928                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
929                 </xsl:call-template>
930                 <xsl:choose>
931                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
932                     <xsl:otherwise> | </xsl:otherwise>
933                 </xsl:choose>
934             </xsl:for-each>
935         </span>
936     </xsl:if>
937
938 <!-- LOC classification -->
939     <xsl:if test="marc:datafield[@tag=050]">
940         <span class="results_summary loc">
941             <span class="label">LOC classification: </span>
942             <xsl:for-each select="marc:datafield[@tag=050]">
943                 <xsl:call-template name="subfieldSelect">
944                     <xsl:with-param name="codes">ab</xsl:with-param>
945                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
946                 </xsl:call-template>
947             </xsl:for-each>
948         </span>
949     </xsl:if>
950
951 <!-- NLM classification -->
952     <xsl:if test="marc:datafield[@tag=060]">
953         <span class="results_summary nlm">
954             <span class="label">NLM classification: </span>
955             <xsl:for-each select="marc:datafield[@tag=060]">
956                 <xsl:call-template name="subfieldSelect">
957                     <xsl:with-param name="codes">a</xsl:with-param>
958                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
959                 </xsl:call-template>
960                 <xsl:if test="not(position()=last())"><xsl:text> | </xsl:text></xsl:if>
961             </xsl:for-each>
962         </span>
963     </xsl:if>
964
965 <!-- Other classification -->
966     <xsl:if test="marc:datafield[@tag=084]">
967        <span class="results_summary oc">
968            <span class="label">Other classification: </span>
969           <xsl:for-each select="marc:datafield[@tag=084]">
970                 <xsl:call-template name="subfieldSelect">
971                    <xsl:with-param name="codes">a</xsl:with-param>
972                    <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
973                 </xsl:call-template>
974                 <xsl:choose>
975                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
976                    <xsl:otherwise> | </xsl:otherwise>
977                 </xsl:choose>
978           </xsl:for-each>
979        </span>
980     </xsl:if>
981
982     <xsl:if test="marc:datafield[@tag=856]">
983         <span class="results_summary online_resources"><span class="label">Online resources: </span>
984         <xsl:for-each select="marc:datafield[@tag=856]">
985             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
986             <a>
987                 <xsl:attribute name="href">
988                     <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
989                         <xsl:choose>
990                             <xsl:when test="@ind1=7">
991                                 <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
992                             </xsl:when>
993                             <xsl:when test="@ind1=1">
994                                 <xsl:text>ftp://</xsl:text>
995                             </xsl:when>
996                             <xsl:otherwise>
997                                 <xsl:text>http://</xsl:text>
998                             </xsl:otherwise>
999                         </xsl:choose>
1000                     </xsl:if>
1001                     <xsl:value-of select="marc:subfield[@code='u']"/>
1002                 </xsl:attribute>
1003                 <xsl:choose>
1004                     <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')">
1005                         <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>
1006                     </xsl:when>
1007                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1008                         <xsl:call-template name="subfieldSelect">
1009                             <xsl:with-param name="codes">y3z</xsl:with-param>
1010                         </xsl:call-template>
1011                     </xsl:when>
1012                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
1013                         <xsl:choose>
1014                             <xsl:when test="$URLLinkText!=''">
1015                                 <xsl:value-of select="$URLLinkText"/>
1016                             </xsl:when>
1017                             <xsl:otherwise>
1018                                 <xsl:text>Click here to access online</xsl:text>
1019                             </xsl:otherwise>
1020                         </xsl:choose>
1021                     </xsl:when>
1022                 </xsl:choose>
1023             </a>
1024             <xsl:choose>
1025                 <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
1026                 <xsl:otherwise> | </xsl:otherwise>
1027             </xsl:choose>
1028
1029         </xsl:for-each>
1030         </span>
1031     </xsl:if>
1032
1033         <!-- 505 - Formatted contents note -->
1034         <xsl:if test="marc:datafield[@tag=505]">
1035             <div class="results_summary contents">
1036             <xsl:choose>
1037                 <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
1038                     <span class="label">Contents:</span>
1039                 </xsl:when>
1040                 <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
1041                     <span class="label">Incomplete contents:</span>
1042                 </xsl:when>
1043                 <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
1044                     <span class="label">Partial contents:</span>
1045                 </xsl:when>
1046             </xsl:choose>
1047                 <xsl:for-each select="marc:datafield[@tag=505]">
1048                     <div class='contentblock'>
1049                         <xsl:choose>
1050                         <xsl:when test="@ind2=0">
1051                             <xsl:call-template name="subfieldSelectSpan">
1052                                 <xsl:with-param name="newline">1</xsl:with-param>
1053                                 <xsl:with-param name="codes">trug</xsl:with-param>
1054                             </xsl:call-template>
1055                         </xsl:when>
1056                         <xsl:otherwise>
1057                             <xsl:call-template name="subfieldSelectSpan">
1058                                 <xsl:with-param name="newline">1</xsl:with-param>
1059                                 <xsl:with-param name="codes">atrug</xsl:with-param>
1060                             </xsl:call-template>
1061                         </xsl:otherwise>
1062                         </xsl:choose>
1063                     </div>
1064                 </xsl:for-each>
1065             </div>
1066         </xsl:if>
1067
1068         <!-- 586 -->
1069         <xsl:if test="marc:datafield[@tag=586]">
1070             <span class="results_summary awardsnote">
1071                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
1072                     <span class="label">Awards: </span>
1073                 </xsl:if>
1074                 <xsl:for-each select="marc:datafield[@tag=586]">
1075                     <xsl:value-of select="marc:subfield[@code='a']"/>
1076                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1077                 </xsl:for-each>
1078             </span>
1079         </xsl:if>
1080
1081         <!-- 508 -->
1082         <xsl:if test="marc:datafield[@tag=508]">
1083             <span class="results_summary prod_credits">
1084                 <span class="label">Production credits: </span>
1085                 <xsl:for-each select="marc:datafield[@tag=508]">
1086                     <xsl:call-template name="subfieldSelectSpan">
1087                         <xsl:with-param name="codes">a</xsl:with-param>
1088                     </xsl:call-template>
1089                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1090                 </xsl:for-each>
1091             </span>
1092         </xsl:if>
1093
1094          <!-- 583 -->
1095          <xsl:if test="marc:datafield[@tag=583]">
1096             <span class="results_summary actionnote">
1097                 <span class="label">Action note: </span>
1098                 <xsl:for-each select="marc:datafield[@tag=583]">
1099                     <xsl:choose>
1100                         <xsl:when test="marc:subfield[@code='z']">
1101                             <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
1102                         </xsl:when>
1103                         <xsl:otherwise>
1104                             <xsl:call-template name="subfieldSelect">
1105                                 <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
1106                             </xsl:call-template>
1107                         </xsl:otherwise>
1108                     </xsl:choose>
1109                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1110                 </xsl:for-each>
1111             </span>
1112          </xsl:if>
1113
1114         <!-- 773 -->
1115         <xsl:if test="marc:datafield[@tag=773]">
1116             <xsl:for-each select="marc:datafield[@tag=773]">
1117                 <xsl:if test="@ind1 !=1">
1118                     <span class="results_summary in"><span class="label">
1119                     <xsl:choose>
1120                         <xsl:when test="@ind2=' '">
1121                             In:
1122                         </xsl:when>
1123                         <xsl:when test="@ind2=8">
1124                             <xsl:if test="marc:subfield[@code='i']">
1125                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1126                             </xsl:if>
1127                         </xsl:when>
1128                     </xsl:choose>
1129                     </span>
1130                     <xsl:variable name="f773">
1131                         <xsl:call-template name="chopPunctuation">
1132                             <xsl:with-param name="chopString">
1133                                 <xsl:call-template name="subfieldSelect">
1134                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1135                                 </xsl:call-template>
1136                             </xsl:with-param>
1137                         </xsl:call-template>
1138                     </xsl:variable>
1139                     <xsl:choose>
1140                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1141                             <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>
1142                             <xsl:value-of select="translate($f773, '()', '')"/>
1143                             </a>
1144                         </xsl:when>
1145                         <xsl:when test="marc:subfield[@code='0']">
1146                             <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>
1147                             <xsl:value-of select="$f773"/>
1148                             </a>
1149                         </xsl:when>
1150                         <xsl:otherwise>
1151                             <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>
1152                             <xsl:value-of select="$f773"/>
1153                             </a>
1154                         </xsl:otherwise>
1155                     </xsl:choose>
1156                     <xsl:if test="marc:subfield[@code='g']">
1157                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
1158                     </xsl:if>
1159                     </span>
1160
1161                     <xsl:if test="marc:subfield[@code='n']">
1162                         <span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1163                     </xsl:if>
1164
1165                 </xsl:if>
1166             </xsl:for-each>
1167         </xsl:if>
1168
1169         <xsl:if test="marc:datafield[@tag=502]">
1170             <span class="results_summary diss_note">
1171                 <span class="label">Dissertation note: </span>
1172                 <xsl:for-each select="marc:datafield[@tag=502]">
1173                     <xsl:call-template name="subfieldSelect">
1174                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1175                     </xsl:call-template>
1176                 </xsl:for-each>
1177                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1178             </span>
1179         </xsl:if>
1180
1181         <!-- 866 textual holdings -->
1182         <xsl:if test="marc:datafield[@tag=866]">
1183             <span class="results_summary holdings_note basic_bibliographic_unit"><span class="label">Holdings: </span>
1184                 <xsl:for-each select="marc:datafield[@tag=866]">
1185                     <span class="holdings_note_data">
1186                         <xsl:call-template name="subfieldSelect">
1187                             <xsl:with-param name="codes">axz</xsl:with-param>
1188                         </xsl:call-template>
1189                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1190                     </span>
1191                 </xsl:for-each>
1192             </span>
1193         </xsl:if>
1194
1195         <!-- 867 textual holdings -->
1196         <xsl:if test="marc:datafield[@tag=867]">
1197             <span class="results_summary holdings_note supplementary_material"><span class="label">Supplements: </span>
1198                 <xsl:for-each select="marc:datafield[@tag=867]">
1199                     <span class="holdings_note_data">
1200                         <xsl:call-template name="subfieldSelect">
1201                             <xsl:with-param name="codes">axz</xsl:with-param>
1202                         </xsl:call-template>
1203                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1204                     </span>
1205                 </xsl:for-each>
1206             </span>
1207         </xsl:if>
1208
1209         <!-- 868 textual holdings -->
1210         <xsl:if test="marc:datafield[@tag=868]">
1211             <span class="results_summary holdings_note indexes"><span class="label">Indexes: </span>
1212                 <xsl:for-each select="marc:datafield[@tag=868]">
1213                     <span class="holdings_note_data">
1214                         <xsl:call-template name="subfieldSelect">
1215                             <xsl:with-param name="codes">axz</xsl:with-param>
1216                         </xsl:call-template>
1217                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1218                     </span>
1219                 </xsl:for-each>
1220             </span>
1221         </xsl:if>
1222
1223
1224         <!--  775 Other Edition  -->
1225         <xsl:if test="marc:datafield[@tag=775]">
1226         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1227         <xsl:for-each select="marc:datafield[@tag=775]">
1228             <xsl:variable name="f775">
1229                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1230                 <xsl:with-param name="codes">a_t</xsl:with-param>
1231                 </xsl:call-template></xsl:with-param></xsl:call-template>
1232             </xsl:variable>
1233             <xsl:if test="marc:subfield[@code='i']">
1234                 <xsl:call-template name="subfieldSelect">
1235                     <xsl:with-param name="codes">i</xsl:with-param>
1236                 </xsl:call-template>
1237                 <xsl:text>: </xsl:text>
1238             </xsl:if>
1239             <a>
1240             <xsl:choose>
1241             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1242                 <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>
1243             </xsl:when>
1244             <xsl:otherwise>
1245                 <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>
1246             </xsl:otherwise>
1247             </xsl:choose>
1248             <xsl:call-template name="subfieldSelect">
1249                 <xsl:with-param name="codes">a_t</xsl:with-param>
1250             </xsl:call-template>
1251             </a>
1252             <xsl:choose>
1253                 <xsl:when test="position()=last()"></xsl:when>
1254                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1255             </xsl:choose>
1256         </xsl:for-each>
1257         </span>
1258         </xsl:if>
1259
1260         <!-- 780 -->
1261         <xsl:if test="marc:datafield[@tag=780]">
1262             <xsl:for-each select="marc:datafield[@tag=780]">
1263                 <xsl:if test="@ind1=0">
1264                     <span class="results_summary preceeding_entry">
1265                         <xsl:choose>
1266                             <xsl:when test="@ind2=0">
1267                                <span class="label">Continues:</span>
1268                             </xsl:when>
1269                             <xsl:when test="@ind2=1">
1270                                <span class="label">Continues in part:</span>
1271                             </xsl:when>
1272                             <xsl:when test="@ind2=2">
1273                                <span class="label">Supersedes:</span>
1274                             </xsl:when>
1275                             <xsl:when test="@ind2=3">
1276                                <span class="label">Supersedes in part:</span>
1277                             </xsl:when>
1278                             <xsl:when test="@ind2=4">
1279                                <span class="label">Formed by the union: ... and: ...</span>
1280                             </xsl:when>
1281                             <xsl:when test="@ind2=5">
1282                                <span class="label">Absorbed:</span>
1283                             </xsl:when>
1284                             <xsl:when test="@ind2=6">
1285                                <span class="label">Absorbed in part:</span>
1286                             </xsl:when>
1287                             <xsl:when test="@ind2=7">
1288                                <span class="label">Separated from:</span>
1289                             </xsl:when>
1290                         </xsl:choose>
1291                         <xsl:text> </xsl:text>
1292
1293                         <xsl:if test="marc:subfield[@code='i']">
1294                             <span class="780_rel_info">
1295                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1296                                 <xsl:text> </xsl:text>
1297                             </span>
1298                         </xsl:if>
1299
1300                         <xsl:variable name="f780">
1301                             <xsl:call-template name="subfieldSelect">
1302                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1303                             </xsl:call-template>
1304                         </xsl:variable>
1305                         <xsl:choose>
1306                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1307                                 <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>
1308                                     <xsl:value-of select="$f780"/>
1309                                 </a>
1310                             </xsl:when>
1311                             <xsl:otherwise>
1312                                 <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>
1313                                     <xsl:value-of select="$f780"/>
1314                                 </a>
1315                             </xsl:otherwise>
1316                         </xsl:choose>
1317                     </span>
1318
1319                     <xsl:if test="marc:subfield[@code='n']">
1320                         <span class="results_summary preceeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1321                     </xsl:if>
1322
1323                 </xsl:if>
1324             </xsl:for-each>
1325         </xsl:if>
1326
1327         <!-- 785 -->
1328         <xsl:if test="marc:datafield[@tag=785]">
1329             <xsl:for-each select="marc:datafield[@tag=785]">
1330                 <xsl:if test="@ind1=0">
1331                     <span class="results_summary succeeding_entry">
1332                         <xsl:choose>
1333                             <xsl:when test="@ind2=0">
1334                                 <span class="label">Continued by:</span>
1335                             </xsl:when>
1336                             <xsl:when test="@ind2=1">
1337                                 <span class="label">Continued in part by:</span>
1338                             </xsl:when>
1339                             <xsl:when test="@ind2=2">
1340                                 <span class="label">Superseded by:</span>
1341                             </xsl:when>
1342                             <xsl:when test="@ind2=3">
1343                                 <span class="label">Superseded in part by:</span>
1344                             </xsl:when>
1345                             <xsl:when test="@ind2=4">
1346                                 <span class="label">Absorbed by:</span>
1347                             </xsl:when>
1348                             <xsl:when test="@ind2=5">
1349                                 <span class="label">Absorbed in part by:</span>
1350                             </xsl:when>
1351                             <xsl:when test="@ind2=6">
1352                                 <span class="label">Split into .. and ...:</span>
1353                             </xsl:when>
1354                             <xsl:when test="@ind2=7">
1355                                 <span class="label">Merged with ... to form ...</span>
1356                             </xsl:when>
1357                             <xsl:when test="@ind2=8">
1358                                 <span class="label">Changed back to:</span>
1359                             </xsl:when>
1360                         </xsl:choose>
1361                         <xsl:text> </xsl:text>
1362
1363                         <xsl:if test="marc:subfield[@code='i']">
1364                             <span class="785_rel_info">
1365                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1366                                 <xsl:text> </xsl:text>
1367                             </span>
1368                         </xsl:if>
1369
1370                         <xsl:variable name="f785">
1371                             <xsl:call-template name="subfieldSelect">
1372                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1373                             </xsl:call-template>
1374                         </xsl:variable>
1375
1376                         <xsl:choose>
1377                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1378                                 <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>
1379                                     <xsl:value-of select="$f785"/>
1380                                 </a>
1381                             </xsl:when>
1382                             <xsl:otherwise>
1383                                 <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>
1384                                     <xsl:value-of select="$f785"/>
1385                                 </a>
1386                             </xsl:otherwise>
1387                         </xsl:choose>
1388
1389                     </span>
1390                 </xsl:if>
1391             </xsl:for-each>
1392         </xsl:if>
1393
1394         <xsl:if test="$OPACBaseURL!=''">
1395         <span class="results_summary opac_view"><span class="label">OPAC view: </span>
1396             <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>.
1397         </span>
1398         </xsl:if>
1399
1400     </xsl:template>
1401
1402     <xsl:template name="nameABCQ">
1403             <xsl:call-template name="chopPunctuation">
1404                 <xsl:with-param name="chopString">
1405                     <xsl:call-template name="subfieldSelect">
1406                         <xsl:with-param name="codes">abcq</xsl:with-param>
1407                     </xsl:call-template>
1408                 </xsl:with-param>
1409                 <xsl:with-param name="punctuation">
1410                     <xsl:text>:,;/ </xsl:text>
1411                 </xsl:with-param>
1412             </xsl:call-template>
1413     </xsl:template>
1414
1415     <xsl:template name="nameABCDN">
1416             <xsl:call-template name="chopPunctuation">
1417                 <xsl:with-param name="chopString">
1418                     <xsl:call-template name="subfieldSelect">
1419                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1420                     </xsl:call-template>
1421                 </xsl:with-param>
1422                 <xsl:with-param name="punctuation">
1423                     <xsl:text>:,;/ </xsl:text>
1424                 </xsl:with-param>
1425             </xsl:call-template>
1426     </xsl:template>
1427
1428     <xsl:template name="nameACDEQ">
1429             <xsl:call-template name="subfieldSelect">
1430                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1431             </xsl:call-template>
1432     </xsl:template>
1433
1434     <xsl:template name="part">
1435         <xsl:variable name="partNumber">
1436             <xsl:call-template name="specialSubfieldSelect">
1437                 <xsl:with-param name="axis">n</xsl:with-param>
1438                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1439                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1440             </xsl:call-template>
1441         </xsl:variable>
1442         <xsl:variable name="partName">
1443             <xsl:call-template name="specialSubfieldSelect">
1444                 <xsl:with-param name="axis">p</xsl:with-param>
1445                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1446                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1447             </xsl:call-template>
1448         </xsl:variable>
1449         <xsl:if test="string-length(normalize-space($partNumber))">
1450                 <xsl:call-template name="chopPunctuation">
1451                     <xsl:with-param name="chopString" select="$partNumber"/>
1452                 </xsl:call-template>
1453         </xsl:if>
1454         <xsl:if test="string-length(normalize-space($partName))">
1455                 <xsl:call-template name="chopPunctuation">
1456                     <xsl:with-param name="chopString" select="$partName"/>
1457                 </xsl:call-template>
1458         </xsl:if>
1459     </xsl:template>
1460
1461     <xsl:template name="specialSubfieldSelect">
1462         <xsl:param name="anyCodes"/>
1463         <xsl:param name="axis"/>
1464         <xsl:param name="beforeCodes"/>
1465         <xsl:param name="afterCodes"/>
1466         <xsl:variable name="str">
1467             <xsl:for-each select="marc:subfield">
1468                 <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])">
1469                     <xsl:value-of select="text()"/>
1470                     <xsl:text> </xsl:text>
1471                 </xsl:if>
1472             </xsl:for-each>
1473         </xsl:variable>
1474         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1475     </xsl:template>
1476
1477     <xsl:template name="showAuthor">
1478         <xsl:param name="authorfield"/>
1479     <xsl:param name="UseAuthoritiesForTracings"/>
1480         <xsl:if test="count($authorfield)&gt;0">
1481         <h5 class="author">
1482         <xsl:for-each select="$authorfield">
1483         <xsl:choose>
1484           <xsl:when test="position()&gt;1"/>
1485           <!-- #13383 -->
1486           <xsl:when test="@tag&lt;700"><span class="byAuthor">By: </span></xsl:when>
1487           <!--#13382 Changed Additional author to contributor -->
1488           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1489         </xsl:choose>
1490         <a>
1491         <xsl:choose>
1492             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1493                 <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>
1494             </xsl:when>
1495             <xsl:otherwise>
1496             <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>
1497             </xsl:otherwise>
1498         </xsl:choose>
1499         <xsl:choose>
1500             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1501                 <!-- #13383 -->
1502                 <xsl:call-template name="chopPunctuation">
1503                     <xsl:with-param name="chopString">
1504                         <xsl:call-template name="subfieldSelect">
1505                             <xsl:with-param name="codes">
1506                                 <xsl:choose>
1507                                     <!-- #13383 include subfield e for field 111, Display only name portion in 1XX -->
1508                                     <xsl:when test="@tag=111">aeq</xsl:when>
1509                                     <xsl:when test="@tag=110">ab</xsl:when>
1510                                     <xsl:otherwise>abcjq</xsl:otherwise>
1511                                 </xsl:choose>
1512                             </xsl:with-param>
1513                         </xsl:call-template>
1514                     </xsl:with-param>
1515                     <xsl:with-param name="punctuation">
1516                         <xsl:text>:,;/ </xsl:text>
1517                     </xsl:with-param>
1518                 </xsl:call-template>
1519                     <!-- Display only name and title portion in 110 field -->
1520                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1521                     <span class="titleportion">
1522                     <xsl:choose>
1523                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1524                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1525                     </xsl:choose>
1526                     <xsl:call-template name="chopPunctuation">
1527                         <xsl:with-param name="chopString">
1528                         <xsl:call-template name="subfieldSelect">
1529                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1530                         </xsl:call-template>
1531                         </xsl:with-param>
1532                     </xsl:call-template>
1533                     </span>
1534                     </xsl:if>
1535                     <!-- Display only name and title portion in 111 field -->
1536             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1537                     <span class="titleportion">
1538                     <xsl:choose>
1539                         <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>
1540                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1541                     </xsl:choose>
1542
1543                     <xsl:call-template name="chopPunctuation">
1544                         <xsl:with-param name="chopString">
1545                         <xsl:call-template name="subfieldSelect">
1546                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1547                         </xsl:call-template>
1548                         </xsl:with-param>
1549                     </xsl:call-template>
1550                     </span>
1551             </xsl:if>
1552             <!-- Display only dates in 100 field -->
1553             <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1554                 <span class="authordates">
1555                 <xsl:text>, </xsl:text>
1556                 <xsl:call-template name="chopPunctuation">
1557                     <xsl:with-param name="chopString">
1558                         <xsl:call-template name="subfieldSelect">
1559                            <xsl:with-param name="codes">d</xsl:with-param>
1560                         </xsl:call-template>
1561                         </xsl:with-param>
1562                     </xsl:call-template>
1563                     </span>
1564             </xsl:if>
1565
1566             </xsl:when>
1567             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1568             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1569             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1570                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1571                     <xsl:if test="@tag=710 or @tag=711">
1572                     <xsl:call-template name="chopPunctuation">
1573                         <xsl:with-param name="chopString">
1574                             <xsl:call-template name="subfieldSelect">
1575                             <xsl:with-param name="codes">
1576                             <xsl:choose>
1577                                 <xsl:when test="@tag=711">aeq</xsl:when>
1578                                 <xsl:otherwise>ab</xsl:otherwise>
1579                             </xsl:choose>
1580                             </xsl:with-param>
1581                             </xsl:call-template>
1582                         </xsl:with-param>
1583                         <xsl:with-param name="punctuation">
1584                             <xsl:text>:,;/ </xsl:text>
1585                         </xsl:with-param>
1586                     </xsl:call-template>
1587                     <!-- Display only name and title portion in 711 field -->
1588                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1589                     <span class="titleportion">
1590                     <xsl:choose>
1591                         <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>
1592                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1593                     </xsl:choose>
1594
1595                     <xsl:call-template name="chopPunctuation">
1596                         <xsl:with-param name="chopString">
1597                         <xsl:call-template name="subfieldSelect">
1598                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1599                         </xsl:call-template>
1600                         </xsl:with-param>
1601                     </xsl:call-template>
1602                     </span>
1603                     </xsl:if>
1604                     <!-- Display only name and title portion in 710 field -->
1605                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1606                     <span class="titleportion">
1607                     <xsl:choose>
1608                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1609                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1610                     </xsl:choose>
1611                     <xsl:call-template name="chopPunctuation">
1612                         <xsl:with-param name="chopString">
1613                         <xsl:call-template name="subfieldSelect">
1614                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1615                         </xsl:call-template>
1616                         </xsl:with-param>
1617                     </xsl:call-template>
1618                     </span>
1619                     </xsl:if>
1620
1621                     </xsl:if>
1622                         <!-- Display only name portion in 700 field -->
1623                         <xsl:if test="@tag=700">
1624                            <xsl:call-template name="chopPunctuation">
1625                                <xsl:with-param name="chopString">
1626                                <xsl:call-template name="subfieldSelect">
1627                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1628                                </xsl:call-template>
1629                                </xsl:with-param>
1630                         </xsl:call-template>
1631                         </xsl:if>
1632                         <!-- Display class "authordates" in 700 field -->
1633                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1634                         <span class="authordates">
1635                         <xsl:text>, </xsl:text>
1636                         <xsl:call-template name="chopPunctuation">
1637                             <xsl:with-param name="chopString">
1638                             <xsl:call-template name="subfieldSelect">
1639                                <xsl:with-param name="codes">d</xsl:with-param>
1640                             </xsl:call-template>
1641                             </xsl:with-param>
1642                         </xsl:call-template>
1643                         </span>
1644                         </xsl:if>
1645                         <!-- Display class "titleportion" in 700 field -->
1646                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1647                         <xsl:if test="@tag=700 and $titleportionfields">
1648                         <span class="titleportion">
1649                         <xsl:text>. </xsl:text>
1650                         <xsl:call-template name="chopPunctuation">
1651                             <xsl:with-param name="chopString">
1652                             <xsl:call-template name="subfieldSelect">
1653                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1654                             </xsl:call-template>
1655                             </xsl:with-param>
1656                         </xsl:call-template>
1657                         </span>
1658                         </xsl:if>
1659
1660         </xsl:when>
1661         </xsl:choose>
1662
1663     <!-- add relator code too between brackets-->
1664     <!-- #13383 include relator code j for field 111 -->
1665             <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'])">
1666                 <span class="relatorcode">
1667                     <xsl:text> [</xsl:text>
1668                     <xsl:choose>
1669                         <xsl:when test="@tag=111 or @tag=711">
1670                             <xsl:choose>
1671                                 <!-- Prefer j over 4 for fields 111 and 711-->
1672                                 <xsl:when test="marc:subfield[@code='j']">
1673                                     <xsl:for-each select="marc:subfield[@code='j']">
1674                                         <xsl:value-of select="."/>
1675                                         <xsl:if test="position() != last()">, </xsl:if>
1676                                     </xsl:for-each>
1677                                 </xsl:when>
1678                                 <xsl:otherwise>
1679                                     <xsl:for-each select="marc:subfield[@code=4]">
1680                                         <xsl:value-of select="."/>
1681                                         <xsl:if test="position() != last()">, </xsl:if>
1682                                     </xsl:for-each>
1683                                 </xsl:otherwise>
1684                             </xsl:choose>
1685                         </xsl:when>
1686                         <!-- Prefer e over 4 for fields 111 and 711-->
1687                         <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1688                             <xsl:for-each select="marc:subfield[@code='e']">
1689                                 <xsl:value-of select="."/>
1690                                 <xsl:if test="position() != last()">, </xsl:if>
1691                             </xsl:for-each>
1692                         </xsl:when>
1693                         <xsl:otherwise>
1694                             <xsl:for-each select="marc:subfield[@code=4]">
1695                                 <xsl:value-of select="."/>
1696                                 <xsl:if test="position() != last()">, </xsl:if>
1697                             </xsl:for-each>
1698                         </xsl:otherwise>
1699                     </xsl:choose>
1700                     <xsl:text>]</xsl:text>
1701                 </span>
1702             </xsl:if>
1703         </a>
1704         <xsl:choose>
1705             <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1706         </xsl:choose>
1707         </xsl:for-each>
1708         </h5>
1709
1710         </xsl:if>
1711     </xsl:template>
1712
1713     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1714     <xsl:template name="subfieldSelectSubject">
1715         <xsl:param name="codes"/>
1716         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1717         <xsl:param name="subdivCodes"/>
1718         <xsl:param name="subdivDelimiter"/>
1719         <xsl:param name="prefix"/>
1720         <xsl:param name="suffix"/>
1721         <xsl:param name="urlencode"/>
1722         <xsl:variable name="str">
1723             <xsl:for-each select="marc:subfield">
1724                 <xsl:if test="contains($codes, @code)">
1725                     <xsl:if test="contains($subdivCodes, @code)">
1726                         <xsl:value-of select="$subdivDelimiter"/>
1727                     </xsl:if>
1728                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1729                 </xsl:if>
1730             </xsl:for-each>
1731         </xsl:variable>
1732         <xsl:choose>
1733             <xsl:when test="$urlencode=1">
1734                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
1735             </xsl:when>
1736             <xsl:otherwise>
1737                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1738             </xsl:otherwise>
1739         </xsl:choose>
1740     </xsl:template>
1741
1742 </xsl:stylesheet>