Merge remote-tracking branch 'kc/new/enh/bug_5922' 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
19     <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
20         <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
21         <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
22         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
23         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
24         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
25
26         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
27         <xsl:variable name="leader" select="marc:leader"/>
28         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
29         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
30         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
31         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
32         <xsl:variable name="materialTypeCode">
33             <xsl:choose>
34                 <xsl:when test="$leader19='a'">ST</xsl:when>
35                 <xsl:when test="$leader6='a'">
36                     <xsl:choose>
37                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
38                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
39                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
40                     </xsl:choose>
41                 </xsl:when>
42                 <xsl:when test="$leader6='t'">BK</xsl:when>
43                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
44                 <xsl:when test="$leader6='m'">CF</xsl:when>
45                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
46                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
47                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
48                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
49             </xsl:choose>
50         </xsl:variable>
51         <xsl:variable name="materialTypeLabel">
52             <xsl:choose>
53                 <xsl:when test="$leader19='a'">Set</xsl:when>
54                 <xsl:when test="$leader6='a'">
55                     <xsl:choose>
56                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
57                         <xsl:when test="$leader7='i' or $leader7='s'">
58                             <xsl:choose>
59                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
60                                 <xsl:otherwise>Series</xsl:otherwise>
61                             </xsl:choose>
62                         </xsl:when>
63                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
64                     </xsl:choose>
65                 </xsl:when>
66                 <xsl:when test="$leader6='t'">Book</xsl:when>
67                 <xsl:when test="$leader6='o'">Kit</xsl:when>                            
68                 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
69                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
70                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
71                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual Material</xsl:when>
72                 <xsl:when test="$leader6='j'">Music</xsl:when>
73                 <xsl:when test="$leader6='i'">Sound</xsl:when>
74                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
75             </xsl:choose>
76         </xsl:variable>
77
78         <!-- Title Statement -->
79         <!-- Alternate Graphic Representation (MARC 880) -->
80         <xsl:if test="$display880">
81             <h1 class="title">
82                 <xsl:call-template name="m880Select">
83                     <xsl:with-param name="basetags">245</xsl:with-param>
84                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
85                 </xsl:call-template>
86             </h1>
87         </xsl:if>
88
89         <xsl:if test="marc:datafield[@tag=245]">
90         <h1>
91             <xsl:for-each select="marc:datafield[@tag=245]">
92                     <xsl:call-template name="subfieldSelect">
93                         <xsl:with-param name="codes">a</xsl:with-param>
94                     </xsl:call-template>
95                     <xsl:if test="marc:subfield[@code='b']">
96                         <xsl:text> </xsl:text>
97                         <xsl:call-template name="subfieldSelect">
98                             <xsl:with-param name="codes">b</xsl:with-param>
99                         </xsl:call-template>
100                     </xsl:if>
101                     <xsl:if test="marc:subfield[@code='h']">
102                         <xsl:text> </xsl:text>
103                         <xsl:call-template name="subfieldSelect">
104                             <xsl:with-param name="codes">h</xsl:with-param>
105                         </xsl:call-template>
106                     </xsl:if>
107                     <xsl:text> </xsl:text>
108                     <xsl:call-template name="subfieldSelect">
109                         <xsl:with-param name="codes">fgknps</xsl:with-param>
110                     </xsl:call-template>
111             </xsl:for-each>
112         </h1>
113         </xsl:if>
114
115         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
116         <xsl:if test="$display880">
117             <h5 class="author">
118                 <xsl:call-template name="m880Select">
119                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
120                     <xsl:with-param name="codes">abc</xsl:with-param>
121                     <xsl:with-param name="index">au</xsl:with-param>
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"><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</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"><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"><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"><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=Title:<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"><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:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
261             </xsl:when>
262             <xsl:otherwise>
263                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<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</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"><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</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"><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</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"><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"><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"><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</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"><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</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"><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"><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"><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">
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"><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:otherwise>
568                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
569                         <xsl:value-of select="$f773"/>
570                     </a>
571                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
572                 </xsl:otherwise>
573             </xsl:choose>
574         </span>
575
576         <xsl:if test="marc:subfield[@code='n']">
577             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
578         </xsl:if>
579
580         </xsl:if>
581         </xsl:for-each>
582         </xsl:if>
583
584         <!--  775 Other Edition  -->
585         <xsl:if test="marc:datafield[@tag=775]">
586         <span class="results_summary"><span class="label">Other Editions: </span>
587         <xsl:for-each select="marc:datafield[@tag=775]">
588             <xsl:if test="marc:subfield[@code='i']">
589                 <xsl:call-template name="subfieldSelect">
590                     <xsl:with-param name="codes">i</xsl:with-param>
591                 </xsl:call-template>
592                 <xsl:text>: </xsl:text>
593             </xsl:if>
594             <a>
595             <xsl:choose>
596             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
597                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
598             </xsl:when>
599             <xsl:otherwise>
600                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
601             </xsl:otherwise>
602             </xsl:choose>
603             <xsl:call-template name="subfieldSelect">
604                 <xsl:with-param name="codes">t</xsl:with-param>
605             </xsl:call-template>
606             </a>
607             <xsl:choose>
608                 <xsl:when test="position()=last()"></xsl:when>
609                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
610             </xsl:choose>
611         </xsl:for-each>
612         </span>
613         </xsl:if>
614
615         <!-- 780 -->
616         <xsl:if test="marc:datafield[@tag=780]">
617         <xsl:for-each select="marc:datafield[@tag=780]">
618         <xsl:if test="@ind1=0">
619         <span class="results_summary">
620         <xsl:choose>
621         <xsl:when test="@ind2=0">
622             <span class="label">Continues:</span>
623         </xsl:when>
624         <xsl:when test="@ind2=1">
625             <span class="label">Continues in part:</span>
626         </xsl:when>
627         <xsl:when test="@ind2=2">
628             <span class="label">Supersedes:</span>
629         </xsl:when>
630         <xsl:when test="@ind2=3">
631             <span class="label">Supersedes in part:</span>
632         </xsl:when>
633         <xsl:when test="@ind2=4">
634             <span class="label">Formed by the union: ... and: ...</span>
635         </xsl:when>
636         <xsl:when test="@ind2=5">
637             <span class="label">Absorbed:</span>
638         </xsl:when>
639         <xsl:when test="@ind2=6">
640             <span class="label">Absorbed in part:</span>
641         </xsl:when>
642         <xsl:when test="@ind2=7">
643             <span class="label">Separated from:</span>
644         </xsl:when>
645         </xsl:choose>
646                 <xsl:variable name="f780">
647                     <xsl:call-template name="subfieldSelect">
648                         <xsl:with-param name="codes">at</xsl:with-param>
649                     </xsl:call-template>
650                 </xsl:variable>
651             <xsl:choose>
652                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
653                     <a href="/cgi-bin/koha/catalogue/search.pl?q=Control-number:{marc:subfield[@code='w']}">
654                         <xsl:value-of select="translate($f780, '()', '')"/>
655                     </a>
656                 </xsl:when>
657                 <xsl:otherwise>
658                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
659                         <xsl:value-of select="translate($f780, '()', '')"/>
660                     </a>
661                 </xsl:otherwise>
662             </xsl:choose>
663         </span>
664  
665         <xsl:if test="marc:subfield[@code='n']">
666             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
667         </xsl:if>
668
669         </xsl:if>
670         </xsl:for-each>
671         </xsl:if>
672
673         <!-- 785 -->
674         <xsl:if test="marc:datafield[@tag=785]">
675         <xsl:for-each select="marc:datafield[@tag=785]">
676         <span class="results_summary">
677         <xsl:choose>
678         <xsl:when test="@ind2=0">
679             <span class="label">Continued by:</span>
680         </xsl:when>
681         <xsl:when test="@ind2=1">
682             <span class="label">Continued in part by:</span>
683         </xsl:when>
684         <xsl:when test="@ind2=2">
685             <span class="label">Superseded by:</span>
686         </xsl:when>
687         <xsl:when test="@ind2=3">
688             <span class="label">Superseded in part by:</span>
689         </xsl:when>
690         <xsl:when test="@ind2=4">
691             <span class="label">Absorbed by:</span>
692         </xsl:when>
693         <xsl:when test="@ind2=5">
694             <span class="label">Absorbed in part by:</span>
695         </xsl:when>
696         <xsl:when test="@ind2=6">
697             <span class="label">Split into .. and ...:</span>
698         </xsl:when>
699         <xsl:when test="@ind2=7">
700             <span class="label">Merged with ... to form ...</span>
701         </xsl:when>
702         <xsl:when test="@ind2=8">
703             <span class="label">Changed back to:</span>
704         </xsl:when>
705
706         </xsl:choose>
707                    <xsl:variable name="f785">
708                     <xsl:call-template name="subfieldSelect">
709                         <xsl:with-param name="codes">at</xsl:with-param>
710                     </xsl:call-template>
711                 </xsl:variable>
712
713             <xsl:choose>
714                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
715                     <a href="/cgi-bin/koha/catalogue/search.pl?q=Control-number:{marc:subfield[@code='w']}">
716                         <xsl:value-of select="translate($f785, '()', '')"/>
717                     </a>
718                 </xsl:when>
719                 <xsl:otherwise>
720                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
721                         <xsl:value-of select="translate($f785, '()', '')"/>
722                     </a>
723                 </xsl:otherwise>
724             </xsl:choose>
725
726         </span>
727         </xsl:for-each>
728         </xsl:if>
729
730         <xsl:if test="$OPACBaseURL!=''">
731         <span class="results_summary"><span class="label">OPAC view: </span>
732             <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>.
733         </span>
734         </xsl:if>
735
736     </xsl:template>
737
738     <xsl:template name="nameABCDQ">
739             <xsl:call-template name="chopPunctuation">
740                 <xsl:with-param name="chopString">
741                     <xsl:call-template name="subfieldSelect">
742                         <xsl:with-param name="codes">aq</xsl:with-param>
743                     </xsl:call-template>
744                 </xsl:with-param>
745                 <xsl:with-param name="punctuation">
746                     <xsl:text>:,;/ </xsl:text>
747                 </xsl:with-param>
748             </xsl:call-template>
749         <xsl:call-template name="termsOfAddress"/>
750     </xsl:template>
751
752     <xsl:template name="nameABCDN">
753         <xsl:for-each select="marc:subfield[@code='a']">
754                 <xsl:call-template name="chopPunctuation">
755                     <xsl:with-param name="chopString" select="."/>
756                 </xsl:call-template>
757         </xsl:for-each>
758         <xsl:for-each select="marc:subfield[@code='b']">
759                 <xsl:value-of select="."/>
760         </xsl:for-each>
761         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
762                 <xsl:call-template name="subfieldSelect">
763                     <xsl:with-param name="codes">cdn</xsl:with-param>
764                 </xsl:call-template>
765         </xsl:if>
766     </xsl:template>
767
768     <xsl:template name="nameACDEQ">
769             <xsl:call-template name="subfieldSelect">
770                 <xsl:with-param name="codes">acdeq</xsl:with-param>
771             </xsl:call-template>
772     </xsl:template>
773     <xsl:template name="termsOfAddress">
774         <xsl:if test="marc:subfield[@code='b' or @code='c']">
775             <xsl:call-template name="chopPunctuation">
776                 <xsl:with-param name="chopString">
777                     <xsl:call-template name="subfieldSelect">
778                         <xsl:with-param name="codes">bc</xsl:with-param>
779                     </xsl:call-template>
780                 </xsl:with-param>
781             </xsl:call-template>
782         </xsl:if>
783     </xsl:template>
784
785     <xsl:template name="part">
786         <xsl:variable name="partNumber">
787             <xsl:call-template name="specialSubfieldSelect">
788                 <xsl:with-param name="axis">n</xsl:with-param>
789                 <xsl:with-param name="anyCodes">n</xsl:with-param>
790                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
791             </xsl:call-template>
792         </xsl:variable>
793         <xsl:variable name="partName">
794             <xsl:call-template name="specialSubfieldSelect">
795                 <xsl:with-param name="axis">p</xsl:with-param>
796                 <xsl:with-param name="anyCodes">p</xsl:with-param>
797                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
798             </xsl:call-template>
799         </xsl:variable>
800         <xsl:if test="string-length(normalize-space($partNumber))">
801                 <xsl:call-template name="chopPunctuation">
802                     <xsl:with-param name="chopString" select="$partNumber"/>
803                 </xsl:call-template>
804         </xsl:if>
805         <xsl:if test="string-length(normalize-space($partName))">
806                 <xsl:call-template name="chopPunctuation">
807                     <xsl:with-param name="chopString" select="$partName"/>
808                 </xsl:call-template>
809         </xsl:if>
810     </xsl:template>
811
812     <xsl:template name="specialSubfieldSelect">
813         <xsl:param name="anyCodes"/>
814         <xsl:param name="axis"/>
815         <xsl:param name="beforeCodes"/>
816         <xsl:param name="afterCodes"/>
817         <xsl:variable name="str">
818             <xsl:for-each select="marc:subfield">
819                 <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])">
820                     <xsl:value-of select="text()"/>
821                     <xsl:text> </xsl:text>
822                 </xsl:if>
823             </xsl:for-each>
824         </xsl:variable>
825         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
826     </xsl:template>
827
828     <xsl:template name="showAuthor">
829         <xsl:param name="authorfield"/>
830     <xsl:param name="UseAuthoritiesForTracings"/>
831         <xsl:if test="count($authorfield)&gt;0">
832         <h5 class="author">
833         <xsl:for-each select="$authorfield">
834         <xsl:choose>
835           <xsl:when test="position()&gt;1"/>
836           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
837           <xsl:otherwise>Additional author(s): </xsl:otherwise>
838         </xsl:choose>
839         <a>
840         <xsl:choose>
841             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
842                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
843             </xsl:when>
844             <xsl:otherwise>
845             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
846             </xsl:otherwise>
847         </xsl:choose>
848         <xsl:choose>
849           <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCDQ"/></xsl:when>
850           <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
851           <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
852         </xsl:choose>
853         <!-- add relator code too between brackets-->
854         <xsl:if test="marc:subfield[@code='4' or @code='e']">
855           <xsl:text>[</xsl:text>
856           <xsl:choose>
857             <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
858             <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
859           </xsl:choose>
860           <xsl:text>]</xsl:text>
861         </xsl:if>
862         </a>
863         <xsl:choose>
864           <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
865         </xsl:choose>
866         </xsl:for-each>
867         </h5>
868         </xsl:if>
869     </xsl:template>
870
871 </xsl:stylesheet>