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