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