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