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