Bug 13650: Remove parens from links to fix searches
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
6 <!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com  -->
7 <xsl:stylesheet version="1.0"
8   xmlns:marc="http://www.loc.gov/MARC21/slim"
9   xmlns:items="http://www.koha-community.org/items"
10   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11   exclude-result-prefixes="marc items">
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="TracingQuotesLeft">
31            <xsl:choose>
32              <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
33              <xsl:otherwise>"</xsl:otherwise>
34            </xsl:choose>
35         </xsl:variable>
36         <xsl:variable name="TracingQuotesRight">
37           <xsl:choose>
38             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
39             <xsl:otherwise>"</xsl:otherwise>
40           </xsl:choose>
41         </xsl:variable>
42         <xsl:variable name="leader" select="marc:leader"/>
43         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
44         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
45         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
46         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
47         <xsl:variable name="materialTypeCode">
48             <xsl:choose>
49                 <xsl:when test="$leader19='a'">ST</xsl:when>
50                 <xsl:when test="$leader6='a'">
51                     <xsl:choose>
52                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
53                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
54                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
55                     </xsl:choose>
56                 </xsl:when>
57                 <xsl:when test="$leader6='t'">BK</xsl:when>
58                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
59                 <xsl:when test="$leader6='m'">CF</xsl:when>
60                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
61                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
62                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
63                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
64             </xsl:choose>
65         </xsl:variable>
66         <xsl:variable name="materialTypeLabel">
67             <xsl:choose>
68                 <xsl:when test="$leader19='a'">Set</xsl:when>
69                 <xsl:when test="$leader6='a'">
70                     <xsl:choose>
71                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
72                         <xsl:when test="$leader7='i' or $leader7='s'">
73                             <xsl:choose>
74                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
75                                 <xsl:otherwise>Series</xsl:otherwise>
76                             </xsl:choose>
77                         </xsl:when>
78                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
79                     </xsl:choose>
80                 </xsl:when>
81                 <xsl:when test="$leader6='t'">Book</xsl:when>
82                 <xsl:when test="$leader6='o'">Kit</xsl:when>                            
83                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
84                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
85                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
86                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual material</xsl:when>
87                 <xsl:when test="$leader6='j'">Music</xsl:when>
88                 <xsl:when test="$leader6='i'">Sound</xsl:when>
89                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
90             </xsl:choose>
91         </xsl:variable>
92
93         <!-- Title Statement -->
94         <!-- Alternate Graphic Representation (MARC 880) -->
95         <xsl:if test="$display880">
96             <h1 class="title">
97                 <xsl:call-template name="m880Select">
98                     <xsl:with-param name="basetags">245</xsl:with-param>
99                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
100                 </xsl:call-template>
101             </h1>
102         </xsl:if>
103
104         <!--Bug 13381 -->
105         <xsl:if test="marc:datafield[@tag=245]">
106             <h1 class="title" property="name">
107                 <xsl:for-each select="marc:datafield[@tag=245]">
108                     <xsl:call-template name="subfieldSelect">
109                         <xsl:with-param name="codes">a</xsl:with-param>
110                     </xsl:call-template>
111                     <xsl:text> </xsl:text>
112                     <!-- 13381 add additional subfields-->
113                     <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
114                         <xsl:choose>
115                             <xsl:when test="@code='h'">
116                                 <!--  13381 Span class around subfield h so it can be suppressed via css -->
117                                 <span class="title_medium"><xsl:apply-templates/> </span>
118                             </xsl:when>
119                             <xsl:when test="@code='c'">
120                                 <!--  13381 Span class around subfield c so it can be suppressed via css -->
121                                 <span class="title_resp_stmt"><xsl:apply-templates/> </span>
122                             </xsl:when>
123                             <xsl:otherwise>
124                                 <xsl:apply-templates/>
125                                 <xsl:text> </xsl:text>
126                             </xsl:otherwise>
127                         </xsl:choose>
128                     </xsl:for-each>
129                 </xsl:for-each>
130             </h1>
131         </xsl:if>
132
133         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
134         <xsl:if test="$display880">
135             <h5 class="author">
136                 <xsl:call-template name="m880Select">
137                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
138                     <xsl:with-param name="codes">abc</xsl:with-param>
139                     <xsl:with-param name="index">au</xsl:with-param>
140                     <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
141                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
142                 </xsl:call-template>
143             </h5>
144         </xsl:if>
145
146         <!-- Author Statement -->
147         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
148         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
149
150     <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
151         <span class="results_summary type"><span class="label">Material type: </span>
152         <xsl:element name="img"><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>
153         <xsl:text> </xsl:text>
154         <xsl:value-of select="$materialTypeLabel"/>
155         </span>
156     </xsl:if>
157
158
159         <!--Series: Alternate Graphic Representation (MARC 880) -->
160         <xsl:if test="$display880">
161             <xsl:call-template name="m880Select">
162                 <xsl:with-param name="basetags">440,490</xsl:with-param>
163                 <xsl:with-param name="codes">av</xsl:with-param>
164                 <xsl:with-param name="class">results_summary series</xsl:with-param>
165                 <xsl:with-param name="label">Series: </xsl:with-param>
166                 <xsl:with-param name="index">se</xsl:with-param>
167             </xsl:call-template>
168         </xsl:if>
169         
170         <!-- Series -->
171         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
172         <span class="results_summary series"><span class="label">Series: </span>
173         <!-- 440 -->
174         <xsl:for-each select="marc:datafield[@tag=440]">
175             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
176             <xsl:call-template name="chopPunctuation">
177                             <xsl:with-param name="chopString">
178                                 <xsl:call-template name="subfieldSelect">
179                                     <xsl:with-param name="codes">av</xsl:with-param>
180                                 </xsl:call-template>
181                             </xsl:with-param>
182                         </xsl:call-template>
183             </a>
184             <xsl:call-template name="part"/>
185             <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
186         </xsl:for-each>
187
188         <!-- 490 Series not traced, Ind1 = 0 -->
189         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
190             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
191                         <xsl:call-template name="chopPunctuation">
192                             <xsl:with-param name="chopString">
193                                 <xsl:call-template name="subfieldSelect">
194                                     <xsl:with-param name="codes">av</xsl:with-param>
195                                 </xsl:call-template>
196                             </xsl:with-param>
197                         </xsl:call-template>
198             </a>
199                     <xsl:call-template name="part"/>
200         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
201         </xsl:for-each>
202         <!-- 490 Series traced, Ind1 = 1 -->
203         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
204             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
205                 <xsl:choose>
206                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
207                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
208                             <xsl:call-template name="chopPunctuation">
209                                 <xsl:with-param name="chopString">
210                                     <xsl:call-template name="subfieldSelect">
211                                         <xsl:with-param name="codes">a_t</xsl:with-param>
212                                     </xsl:call-template>
213                                 </xsl:with-param>
214                             </xsl:call-template>
215                         </a>
216                     </xsl:when>
217                     <xsl:otherwise>
218                         <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
219                             <xsl:call-template name="chopPunctuation">
220                                 <xsl:with-param name="chopString">
221                                     <xsl:call-template name="subfieldSelect">
222                                         <xsl:with-param name="codes">a_t</xsl:with-param>
223                                     </xsl:call-template>
224                                 </xsl:with-param>
225                             </xsl:call-template>
226                         </a>
227                         <xsl:call-template name="part"/>
228                     </xsl:otherwise>
229                 </xsl:choose>
230                 <xsl:text>: </xsl:text>
231                 <xsl:value-of  select="marc:subfield[@code='v']" />
232             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
233             </xsl:for-each>
234         </xsl:if>
235
236         </span>
237         </xsl:if>
238
239         <!-- Analytics -->
240         <xsl:if test="$leader7='s'">
241         <span class="results_summary analytics"><span class="label">Analytics: </span>
242             <a>
243             <xsl:choose>
244             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
245                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
246             </xsl:when>
247             <xsl:otherwise>
248                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
249             </xsl:otherwise>
250             </xsl:choose>
251             <xsl:text>Show analytics</xsl:text>
252             </a>
253         </span>
254         </xsl:if>
255
256         <!-- Volumes of sets and traced series -->
257         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
258         <span class="results_summary volumes"><span class="label">Volumes: </span>
259             <a>
260             <xsl:choose>
261             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
262                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute>
263             </xsl:when>
264             <xsl:otherwise>
265                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
266             </xsl:otherwise>
267             </xsl:choose>
268             <xsl:text>Show volumes</xsl:text>
269             </a>
270         </span>
271         </xsl:if>
272
273         <!-- Set -->
274         <xsl:if test="$leader19='c'">
275         <span class="results_summary set"><span class="label">Set: </span>
276         <xsl:for-each select="marc:datafield[@tag=773]">
277             <a>
278             <xsl:choose>
279             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
280                 <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>
281             </xsl:when>
282             <xsl:otherwise>
283                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
284             </xsl:otherwise>
285             </xsl:choose>
286             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
287             </a>
288             <xsl:choose>
289                 <xsl:when test="position()=last()"></xsl:when>
290                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
291             </xsl:choose>
292         </xsl:for-each>
293         </span>
294         </xsl:if>
295
296         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
297         <xsl:if test="$display880">
298             <xsl:call-template name="m880Select">
299                 <xsl:with-param name="basetags">260</xsl:with-param>
300                 <xsl:with-param name="codes">abcg</xsl:with-param>
301                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
302                 <xsl:with-param name="label">Publisher: </xsl:with-param>
303             </xsl:call-template>
304         </xsl:if>
305
306         <!-- Publisher info and RDA related info from tags 260, 264 -->
307         <xsl:choose>
308         <xsl:when test="marc:datafield[@tag=260]">
309         <span class="results_summary publisher"><span class="label">Publisher: </span>
310             <xsl:for-each select="marc:datafield[@tag=260]">
311                 <xsl:if test="marc:subfield[@code='a']">
312                     <xsl:call-template name="subfieldSelect">
313                         <xsl:with-param name="codes">a</xsl:with-param>
314                     </xsl:call-template>
315                 </xsl:if>
316                 <xsl:text> </xsl:text>
317                 <xsl:if test="marc:subfield[@code='b']">
318                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
319                     <xsl:call-template name="subfieldSelect">
320                         <xsl:with-param name="codes">b</xsl:with-param>
321                     </xsl:call-template>
322                </a>
323                </xsl:if>
324                <xsl:text> </xsl:text>
325                 <xsl:call-template name="chopPunctuation">
326                   <xsl:with-param name="chopString">
327                     <xsl:call-template name="subfieldSelect">
328                         <xsl:with-param name="codes">cg</xsl:with-param>
329                     </xsl:call-template>
330                    </xsl:with-param>
331                </xsl:call-template>
332                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
333             </xsl:for-each>
334             <xsl:if test="marc:datafield[@tag=264]">
335                 <xsl:text>; </xsl:text>
336                 <xsl:call-template name="showRDAtag264"/>
337             </xsl:if>
338         </span>
339         </xsl:when>
340         <xsl:when test="marc:datafield[@tag=264]">
341             <span class="results_summary">
342                 <xsl:call-template name="showRDAtag264"/>
343             </span>
344         </xsl:when>
345         </xsl:choose>
346
347         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
348         <xsl:if test="$display880">
349             <xsl:call-template name="m880Select">
350                 <xsl:with-param name="basetags">250</xsl:with-param>
351                 <xsl:with-param name="codes">ab</xsl:with-param>
352                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
353                 <xsl:with-param name="label">Edition: </xsl:with-param>
354             </xsl:call-template>
355         </xsl:if>
356         
357         <xsl:if test="marc:datafield[@tag=250]">
358         <span class="results_summary edition"><span class="label">Edition: </span>
359             <xsl:for-each select="marc:datafield[@tag=250]">
360                 <xsl:call-template name="chopPunctuation">
361                   <xsl:with-param name="chopString">
362                     <xsl:call-template name="subfieldSelect">
363                         <xsl:with-param name="codes">ab</xsl:with-param>
364                     </xsl:call-template>
365                    </xsl:with-param>
366                </xsl:call-template>
367                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
368             </xsl:for-each>
369         </span>
370         </xsl:if>
371
372         <!-- Description: Alternate Graphic Representation (MARC 880) -->
373         <xsl:if test="$display880">
374             <xsl:call-template name="m880Select">
375                 <xsl:with-param name="basetags">300</xsl:with-param>
376                 <xsl:with-param name="codes">abceg</xsl:with-param>
377                 <xsl:with-param name="class">results_summary description</xsl:with-param>
378                 <xsl:with-param name="label">Description: </xsl:with-param>
379             </xsl:call-template>
380         </xsl:if>
381         
382         <xsl:if test="marc:datafield[@tag=300]">
383         <span class="results_summary description"><span class="label">Description: </span>
384             <xsl:for-each select="marc:datafield[@tag=300]">
385                 <xsl:call-template name="chopPunctuation">
386                   <xsl:with-param name="chopString">
387                     <xsl:call-template name="subfieldSelect">
388                         <xsl:with-param name="codes">abceg</xsl:with-param>
389                     </xsl:call-template>
390                    </xsl:with-param>
391                </xsl:call-template>
392                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
393             </xsl:for-each>
394         </span>
395        </xsl:if>
396
397         <!-- Build ISBN -->
398         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
399           <span class="results_summary isbn"><span class="label">ISBN: </span>
400             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
401               <span property="isbn">
402                 <xsl:value-of select="."/>
403                 <xsl:choose>
404                   <xsl:when test="position()=last()">
405                     <xsl:text>.</xsl:text>
406                   </xsl:when>
407                   <xsl:otherwise>
408                     <xsl:text>; </xsl:text>
409                   </xsl:otherwise>
410                 </xsl:choose>
411               </span>
412             </xsl:for-each>
413           </span>
414         </xsl:if>
415
416         <!-- Build ISSN -->
417         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
418           <span class="results_summary issn"><span class="label">ISSN: </span>
419             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
420               <span property="issn">
421                 <xsl:value-of select="."/>
422                 <xsl:choose>
423                   <xsl:when test="position()=last()">
424                     <xsl:text>.</xsl:text>
425                   </xsl:when>
426                   <xsl:otherwise>
427                     <xsl:text>; </xsl:text>
428                   </xsl:otherwise>
429                 </xsl:choose>
430               </span>
431             </xsl:for-each>
432           </span>
433         </xsl:if>
434
435         <xsl:if test="marc:datafield[@tag=013]">
436             <span class="results_summary patent_info">
437                 <span class="label">Patent information: </span>
438                 <xsl:for-each select="marc:datafield[@tag=013]">
439                     <xsl:call-template name="subfieldSelect">
440                         <xsl:with-param name="codes">acdef</xsl:with-param>
441                         <xsl:with-param name="delimeter">, </xsl:with-param>
442                     </xsl:call-template>
443                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
444                 </xsl:for-each>
445             </span>
446         </xsl:if>
447
448         <xsl:if test="marc:datafield[@tag=088]">
449             <span class="results_summary report_number">
450                 <span class="label">Report number: </span>
451                 <xsl:for-each select="marc:datafield[@tag=088]">
452                     <xsl:call-template name="subfieldSelect">
453                         <xsl:with-param name="codes">a</xsl:with-param>
454                     </xsl:call-template>
455                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
456                 </xsl:for-each>
457             </span>
458         </xsl:if>
459
460         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
461         <xsl:if test="$display880">
462             <xsl:call-template name="m880Select">
463                 <xsl:with-param name="basetags">246</xsl:with-param>
464                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
465                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
466                 <xsl:with-param name="label">Other title: </xsl:with-param>
467             </xsl:call-template>
468         </xsl:if>
469
470         <xsl:if test="marc:datafield[@tag=246]">
471         <span class="results_summary other_title"><span class="label">Other title: </span>
472             <xsl:for-each select="marc:datafield[@tag=246]">
473                 <xsl:call-template name="chopPunctuation">
474                   <xsl:with-param name="chopString">
475                     <xsl:call-template name="subfieldSelect">
476                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
477                     </xsl:call-template>
478                    </xsl:with-param>
479                </xsl:call-template>
480                 <!-- #13386 added separator | -->
481                 <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>
482             </xsl:for-each>
483         </span>
484        </xsl:if>
485
486         <xsl:if test="marc:datafield[@tag=242]">
487         <span class="results_summary translated_title"><span class="label">Title translated: </span>
488             <xsl:for-each select="marc:datafield[@tag=242]">
489                 <xsl:call-template name="chopPunctuation">
490                   <xsl:with-param name="chopString">
491                     <xsl:call-template name="subfieldSelect">
492                         <xsl:with-param name="codes">abchnp</xsl:with-param>
493                     </xsl:call-template>
494                    </xsl:with-param>
495                </xsl:call-template>
496                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
497             </xsl:for-each>
498         </span>
499        </xsl:if>
500
501         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
502         <xsl:if test="$display880">
503             <xsl:call-template name="m880Select">
504                 <xsl:with-param name="basetags">130,240</xsl:with-param>
505                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
506                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
507                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
508             </xsl:call-template>
509         </xsl:if>
510
511         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
512         <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
513         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
514             <xsl:variable name="str">
515                 <xsl:for-each select="marc:subfield">
516                     <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
517                         <xsl:value-of select="text()"/>
518                         <xsl:text> </xsl:text>
519                      </xsl:if>
520                 </xsl:for-each>
521             </xsl:variable>
522             <xsl:call-template name="chopPunctuation">
523                 <xsl:with-param name="chopString">
524                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
525                         
526                 </xsl:with-param>
527             </xsl:call-template>
528             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
529         </xsl:for-each>
530         </span>
531         </xsl:if>
532
533         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
534             <span class="results_summary subjects"><span class="label">Subject(s): </span>
535             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
536             <a>
537             <xsl:choose>
538             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
539             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
540                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
541             </xsl:when>
542             <xsl:when test="$TraceSubjectSubdivisions='1'">
543                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
544                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
545                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
546                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
547                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
548                     </xsl:call-template>
549                 </xsl:attribute>
550             </xsl:when>
551             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
552             <xsl:otherwise>
553                 <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="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
554             </xsl:otherwise>
555             </xsl:choose>
556             <xsl:call-template name="chopPunctuation">
557                 <xsl:with-param name="chopString">
558                     <xsl:call-template name="subfieldSelect">
559                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
560                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
561                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
562                     </xsl:call-template>
563                 </xsl:with-param>
564             </xsl:call-template>
565             </a>
566             <xsl:choose>
567             <xsl:when test="position()=last()"></xsl:when>
568             <xsl:otherwise> | </xsl:otherwise>
569             </xsl:choose>
570
571             </xsl:for-each>
572             </span>
573         </xsl:if>
574
575         <!-- Genre/Form -->
576         <xsl:if test="marc:datafield[@tag=655]">
577             <span class="results_summary genre"><span class="label">Genre/Form: </span>
578                 <xsl:for-each select="marc:datafield[@tag=655]">
579                     <a>
580                         <xsl:choose>
581                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
582                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
583                             </xsl:when>
584                             <xsl:when test="$TraceSubjectSubdivisions='1'">
585                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
586                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
587                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
588                                     <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
589                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
590                                 </xsl:call-template>
591                                 </xsl:attribute>
592                             </xsl:when>
593                             <xsl:otherwise>
594                                 <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>
595                             </xsl:otherwise>
596                         </xsl:choose>
597                     <xsl:call-template name="subfieldSelect">
598                         <xsl:with-param name="codes">avxyz</xsl:with-param>
599                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
600                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
601                     </xsl:call-template>
602                     </a>
603                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
604                 </xsl:for-each>
605             </span>
606         </xsl:if>
607
608 <!-- DDC classification -->
609     <xsl:if test="marc:datafield[@tag=082]">
610         <span class="results_summary ddc">
611             <span class="label">DDC classification: </span>
612             <xsl:for-each select="marc:datafield[@tag=082]">
613                 <xsl:call-template name="subfieldSelect">
614                     <xsl:with-param name="codes">a</xsl:with-param>
615                 </xsl:call-template>
616                 <xsl:choose>
617                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
618                     <xsl:otherwise> | </xsl:otherwise>
619                 </xsl:choose>
620             </xsl:for-each>
621         </span>
622     </xsl:if>
623
624         <xsl:if test="marc:datafield[@tag=856]">
625         <span class="results_summary online_resources"><span class="label">Online resources: </span>
626         <xsl:for-each select="marc:datafield[@tag=856]">
627                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
628                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
629                                     <xsl:choose>
630                                     <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')">
631                                         <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>
632                                     </xsl:when>
633                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
634                                         <xsl:call-template name="subfieldSelect">
635                                         <xsl:with-param name="codes">y3z</xsl:with-param>
636                                         </xsl:call-template>
637                                     </xsl:when>
638                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
639                                         <xsl:choose>
640                                         <xsl:when test="$URLLinkText!=''">
641                                                 <xsl:value-of select="$URLLinkText"/>
642                                         </xsl:when>
643                                         <xsl:otherwise>
644                                                 <xsl:text>Click here to access online</xsl:text>
645                                         </xsl:otherwise>
646                                         </xsl:choose>
647                                     </xsl:when>
648                                     </xsl:choose>
649                                     </a>
650                                     <xsl:choose>
651                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
652                                     <xsl:otherwise> | </xsl:otherwise>
653                                     </xsl:choose>
654
655         </xsl:for-each>
656         </span>
657         </xsl:if>
658         <xsl:if test="marc:datafield[@tag=505]">
659             <div class="results_summary contents">
660             <xsl:choose>
661             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
662                 <span class="label">Contents:</span>
663             </xsl:when>
664             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
665                 <span class="label">Incomplete contents:</span>
666             </xsl:when>
667             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
668                 <span class="label">Partial contents:</span>
669             </xsl:when>
670             </xsl:choose>
671                 <xsl:for-each select="marc:datafield[@tag=505]">
672                     <div class='contentblock'>
673                         <xsl:choose>
674                         <xsl:when test="@ind2=0">
675                             <xsl:call-template name="subfieldSelectSpan">
676                                 <xsl:with-param name="codes">tru</xsl:with-param>
677                             </xsl:call-template>
678                         </xsl:when>
679                         <xsl:otherwise>
680                             <xsl:call-template name="subfieldSelectSpan">
681                                 <xsl:with-param name="codes">atru</xsl:with-param>
682                             </xsl:call-template>
683                         </xsl:otherwise>
684                         </xsl:choose>
685                     </div>
686                 </xsl:for-each>
687             </div>
688         </xsl:if>
689
690         <!-- 586 -->
691         <xsl:if test="marc:datafield[@tag=586]">
692             <span class="results_summary awardsnote">
693                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
694                     <span class="label">Awards: </span>
695                 </xsl:if>
696                 <xsl:for-each select="marc:datafield[@tag=586]">
697                     <xsl:value-of select="marc:subfield[@code='a']"/>
698                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
699                 </xsl:for-each>
700             </span>
701         </xsl:if>
702
703         <!-- 508 -->
704         <xsl:if test="marc:datafield[@tag=508]">
705             <div class="results_summary prod_credits">
706                 <span class="label">Production Credits: </span>
707                 <xsl:for-each select="marc:datafield[@tag=508]">
708                     <xsl:call-template name="subfieldSelectSpan">
709                         <xsl:with-param name="codes">a</xsl:with-param>
710                     </xsl:call-template>
711                 </xsl:for-each>
712             </div>
713         </xsl:if>
714
715         <!-- 773 -->
716         <xsl:if test="marc:datafield[@tag=773]">
717         <xsl:for-each select="marc:datafield[@tag=773]">
718         <xsl:if test="@ind1=0">
719         <span class="results_summary in"><span class="label">
720         <xsl:choose>
721         <xsl:when test="@ind2=' '">
722             In:
723         </xsl:when>
724         <xsl:when test="@ind2=8">
725             <xsl:if test="marc:subfield[@code='i']">
726                 <xsl:value-of select="marc:subfield[@code='i']"/>
727             </xsl:if>
728         </xsl:when>
729         </xsl:choose>
730         </span>
731                 <xsl:variable name="f773">
732                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
733                         <xsl:with-param name="codes">a_t</xsl:with-param>
734                     </xsl:call-template></xsl:with-param></xsl:call-template>
735                 </xsl:variable>
736             <xsl:choose>
737                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
738                     <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>
739                         <xsl:value-of select="translate($f773, '()', '')"/>
740                     </a>
741                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
742                 </xsl:when>
743                 <xsl:when test="marc:subfield[@code='0']">
744                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
745                         <xsl:value-of select="$f773"/>
746                     </a>
747                 </xsl:when>
748                 <xsl:otherwise>
749                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
750                         <xsl:value-of select="$f773"/>
751                     </a>
752                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
753                 </xsl:otherwise>
754             </xsl:choose>
755         </span>
756
757         <xsl:if test="marc:subfield[@code='n']">
758             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
759         </xsl:if>
760
761         </xsl:if>
762         </xsl:for-each>
763         </xsl:if>
764
765         <xsl:if test="marc:datafield[@tag=502]">
766             <span class="results_summary diss_note">
767                 <span class="label">Dissertation note: </span>
768                 <xsl:for-each select="marc:datafield[@tag=502]">
769                     <xsl:call-template name="subfieldSelect">
770                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
771                     </xsl:call-template>
772                 </xsl:for-each>
773                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
774             </span>
775         </xsl:if>
776
777         <!-- 866 textual holdings -->
778         <xsl:if test="marc:datafield[@tag=866]">
779             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
780                 <xsl:for-each select="marc:datafield[@tag=866]">
781                     <xsl:call-template name="subfieldSelect">
782                         <xsl:with-param name="codes">axz</xsl:with-param>
783                     </xsl:call-template>
784                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
785                 </xsl:for-each>
786             </span>
787         </xsl:if>
788
789         <!--  775 Other Edition  -->
790         <xsl:if test="marc:datafield[@tag=775]">
791         <span class="results_summary other_editions"><span class="label">Other editions: </span>
792         <xsl:for-each select="marc:datafield[@tag=775]">
793             <xsl:variable name="f775">
794                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
795                 <xsl:with-param name="codes">a_t</xsl:with-param>
796                 </xsl:call-template></xsl:with-param></xsl:call-template>
797             </xsl:variable>
798             <xsl:if test="marc:subfield[@code='i']">
799                 <xsl:call-template name="subfieldSelect">
800                     <xsl:with-param name="codes">i</xsl:with-param>
801                 </xsl:call-template>
802                 <xsl:text>: </xsl:text>
803             </xsl:if>
804             <a>
805             <xsl:choose>
806             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
807                 <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>
808             </xsl:when>
809             <xsl:otherwise>
810                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
811             </xsl:otherwise>
812             </xsl:choose>
813             <xsl:call-template name="subfieldSelect">
814                 <xsl:with-param name="codes">a_t</xsl:with-param>
815             </xsl:call-template>
816             </a>
817             <xsl:choose>
818                 <xsl:when test="position()=last()"></xsl:when>
819                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
820             </xsl:choose>
821         </xsl:for-each>
822         </span>
823         </xsl:if>
824
825         <!-- 780 -->
826         <xsl:if test="marc:datafield[@tag=780]">
827         <xsl:for-each select="marc:datafield[@tag=780]">
828         <xsl:if test="@ind1=0">
829         <span class="results_summary preceeding_entry">
830         <xsl:choose>
831         <xsl:when test="@ind2=0">
832             <span class="label">Continues:</span>
833         </xsl:when>
834         <xsl:when test="@ind2=1">
835             <span class="label">Continues in part:</span>
836         </xsl:when>
837         <xsl:when test="@ind2=2">
838             <span class="label">Supersedes:</span>
839         </xsl:when>
840         <xsl:when test="@ind2=3">
841             <span class="label">Supersedes in part:</span>
842         </xsl:when>
843         <xsl:when test="@ind2=4">
844             <span class="label">Formed by the union: ... and: ...</span>
845         </xsl:when>
846         <xsl:when test="@ind2=5">
847             <span class="label">Absorbed:</span>
848         </xsl:when>
849         <xsl:when test="@ind2=6">
850             <span class="label">Absorbed in part:</span>
851         </xsl:when>
852         <xsl:when test="@ind2=7">
853             <span class="label">Separated from:</span>
854         </xsl:when>
855         </xsl:choose>
856         <xsl:text> </xsl:text>
857                 <xsl:variable name="f780">
858                     <xsl:call-template name="subfieldSelect">
859                         <xsl:with-param name="codes">a_t</xsl:with-param>
860                     </xsl:call-template>
861                 </xsl:variable>
862             <xsl:choose>
863                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
864                     <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>
865                         <xsl:value-of select="translate($f780, '()', '')"/>
866                     </a>
867                 </xsl:when>
868                 <xsl:otherwise>
869                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
870                         <xsl:value-of select="translate($f780, '()', '')"/>
871                     </a>
872                 </xsl:otherwise>
873             </xsl:choose>
874         </span>
875  
876         <xsl:if test="marc:subfield[@code='n']">
877             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
878         </xsl:if>
879
880         </xsl:if>
881         </xsl:for-each>
882         </xsl:if>
883
884         <!-- 785 -->
885         <xsl:if test="marc:datafield[@tag=785]">
886         <xsl:for-each select="marc:datafield[@tag=785]">
887         <span class="results_summary succeeding_entry">
888         <xsl:choose>
889         <xsl:when test="@ind2=0">
890             <span class="label">Continued by:</span>
891         </xsl:when>
892         <xsl:when test="@ind2=1">
893             <span class="label">Continued in part by:</span>
894         </xsl:when>
895         <xsl:when test="@ind2=2">
896             <span class="label">Superseded by:</span>
897         </xsl:when>
898         <xsl:when test="@ind2=3">
899             <span class="label">Superseded in part by:</span>
900         </xsl:when>
901         <xsl:when test="@ind2=4">
902             <span class="label">Absorbed by:</span>
903         </xsl:when>
904         <xsl:when test="@ind2=5">
905             <span class="label">Absorbed in part by:</span>
906         </xsl:when>
907         <xsl:when test="@ind2=6">
908             <span class="label">Split into .. and ...:</span>
909         </xsl:when>
910         <xsl:when test="@ind2=7">
911             <span class="label">Merged with ... to form ...</span>
912         </xsl:when>
913         <xsl:when test="@ind2=8">
914             <span class="label">Changed back to:</span>
915         </xsl:when>
916         </xsl:choose>
917         <xsl:text> </xsl:text>
918                    <xsl:variable name="f785">
919                     <xsl:call-template name="subfieldSelect">
920                         <xsl:with-param name="codes">a_t</xsl:with-param>
921                     </xsl:call-template>
922                 </xsl:variable>
923
924             <xsl:choose>
925                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
926                     <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>
927                         <xsl:value-of select="translate($f785, '()', '')"/>
928                     </a>
929                 </xsl:when>
930                 <xsl:otherwise>
931                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
932                         <xsl:value-of select="translate($f785, '()', '')"/>
933                     </a>
934                 </xsl:otherwise>
935             </xsl:choose>
936
937         </span>
938         </xsl:for-each>
939         </xsl:if>
940
941         <xsl:if test="$OPACBaseURL!=''">
942         <span class="results_summary"><span class="label">OPAC view: </span>
943             <a><xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
944         </span>
945         </xsl:if>
946
947     </xsl:template>
948
949     <xsl:template name="nameABCQ">
950             <xsl:call-template name="chopPunctuation">
951                 <xsl:with-param name="chopString">
952                     <xsl:call-template name="subfieldSelect">
953                         <xsl:with-param name="codes">abcq</xsl:with-param>
954                     </xsl:call-template>
955                 </xsl:with-param>
956                 <xsl:with-param name="punctuation">
957                     <xsl:text>:,;/ </xsl:text>
958                 </xsl:with-param>
959             </xsl:call-template>
960     </xsl:template>
961
962     <xsl:template name="nameABCDN">
963             <xsl:call-template name="chopPunctuation">
964                 <xsl:with-param name="chopString">
965                     <xsl:call-template name="subfieldSelect">
966                         <xsl:with-param name="codes">abcdn</xsl:with-param>
967                     </xsl:call-template>
968                 </xsl:with-param>
969                 <xsl:with-param name="punctuation">
970                     <xsl:text>:,;/ </xsl:text>
971                 </xsl:with-param>
972             </xsl:call-template>
973     </xsl:template>
974
975     <xsl:template name="nameACDEQ">
976             <xsl:call-template name="subfieldSelect">
977                 <xsl:with-param name="codes">acdeq</xsl:with-param>
978             </xsl:call-template>
979     </xsl:template>
980
981     <xsl:template name="part">
982         <xsl:variable name="partNumber">
983             <xsl:call-template name="specialSubfieldSelect">
984                 <xsl:with-param name="axis">n</xsl:with-param>
985                 <xsl:with-param name="anyCodes">n</xsl:with-param>
986                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
987             </xsl:call-template>
988         </xsl:variable>
989         <xsl:variable name="partName">
990             <xsl:call-template name="specialSubfieldSelect">
991                 <xsl:with-param name="axis">p</xsl:with-param>
992                 <xsl:with-param name="anyCodes">p</xsl:with-param>
993                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
994             </xsl:call-template>
995         </xsl:variable>
996         <xsl:if test="string-length(normalize-space($partNumber))">
997                 <xsl:call-template name="chopPunctuation">
998                     <xsl:with-param name="chopString" select="$partNumber"/>
999                 </xsl:call-template>
1000         </xsl:if>
1001         <xsl:if test="string-length(normalize-space($partName))">
1002                 <xsl:call-template name="chopPunctuation">
1003                     <xsl:with-param name="chopString" select="$partName"/>
1004                 </xsl:call-template>
1005         </xsl:if>
1006     </xsl:template>
1007
1008     <xsl:template name="specialSubfieldSelect">
1009         <xsl:param name="anyCodes"/>
1010         <xsl:param name="axis"/>
1011         <xsl:param name="beforeCodes"/>
1012         <xsl:param name="afterCodes"/>
1013         <xsl:variable name="str">
1014             <xsl:for-each select="marc:subfield">
1015                 <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])">
1016                     <xsl:value-of select="text()"/>
1017                     <xsl:text> </xsl:text>
1018                 </xsl:if>
1019             </xsl:for-each>
1020         </xsl:variable>
1021         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1022     </xsl:template>
1023
1024     <xsl:template name="showAuthor">
1025         <xsl:param name="authorfield"/>
1026     <xsl:param name="UseAuthoritiesForTracings"/>
1027         <xsl:if test="count($authorfield)&gt;0">
1028         <h5 class="author">
1029         <xsl:for-each select="$authorfield">
1030         <xsl:choose>
1031           <xsl:when test="position()&gt;1"/>
1032           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
1033           <xsl:otherwise>Additional author(s): </xsl:otherwise>
1034         </xsl:choose>
1035         <a>
1036         <xsl:choose>
1037             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1038                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
1039             </xsl:when>
1040             <xsl:otherwise>
1041             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
1042             </xsl:otherwise>
1043         </xsl:choose>
1044         <xsl:choose>
1045           <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCQ"/></xsl:when>
1046           <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
1047           <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
1048         </xsl:choose>
1049         <!-- add relator code too between brackets-->
1050         <xsl:if test="marc:subfield[@code='4' or @code='e']">
1051       <span class="relatorcode">
1052       <xsl:text> [</xsl:text>
1053           <xsl:choose>
1054             <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
1055             <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
1056           </xsl:choose>
1057           <xsl:text>]</xsl:text>
1058       </span>
1059         </xsl:if>
1060         </a>
1061         <xsl:choose>
1062           <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1063         </xsl:choose>
1064         </xsl:for-each>
1065         </h5>
1066         </xsl:if>
1067     </xsl:template>
1068
1069     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1070     <xsl:template name="subfieldSelectSubject">
1071         <xsl:param name="codes"/>
1072         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1073         <xsl:param name="subdivCodes"/>
1074         <xsl:param name="subdivDelimiter"/>
1075         <xsl:param name="prefix"/>
1076         <xsl:param name="suffix"/>
1077         <xsl:variable name="str">
1078             <xsl:for-each select="marc:subfield">
1079                 <xsl:if test="contains($codes, @code)">
1080                     <xsl:if test="contains($subdivCodes, @code)">
1081                         <xsl:value-of select="$subdivDelimiter"/>
1082                     </xsl:if>
1083                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1084                 </xsl:if>
1085             </xsl:for-each>
1086         </xsl:variable>
1087         <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1088     </xsl:template>
1089
1090 </xsl:stylesheet>