Merge remote branch 'kc/new/bug_5175' 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="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                 <xsl:if test="marc:subfield[@code='b']">
226                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
227                     <xsl:call-template name="subfieldSelect">
228                         <xsl:with-param name="codes">b</xsl:with-param>
229                     </xsl:call-template>
230                </a>
231                </xsl:if>
232                <xsl:text> </xsl:text>
233                 <xsl:call-template name="chopPunctuation">
234                   <xsl:with-param name="chopString">
235                     <xsl:call-template name="subfieldSelect">
236                         <xsl:with-param name="codes">acg</xsl:with-param>
237                     </xsl:call-template>
238                    </xsl:with-param>
239                </xsl:call-template>
240                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
241             </xsl:for-each>
242         </span>
243         </xsl:if>
244
245         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
246         <xsl:if test="$display880">
247             <xsl:call-template name="m880Select">
248                 <xsl:with-param name="basetags">250</xsl:with-param>
249                 <xsl:with-param name="codes">ab</xsl:with-param>
250                 <xsl:with-param name="class">results_summary</xsl:with-param>
251                 <xsl:with-param name="label">Edition: </xsl:with-param>
252             </xsl:call-template>
253         </xsl:if>
254         
255         <xsl:if test="marc:datafield[@tag=250]">
256         <span class="results_summary"><span class="label">Edition: </span>
257             <xsl:for-each select="marc:datafield[@tag=250]">
258                 <xsl:call-template name="chopPunctuation">
259                   <xsl:with-param name="chopString">
260                     <xsl:call-template name="subfieldSelect">
261                         <xsl:with-param name="codes">ab</xsl:with-param>
262                     </xsl:call-template>
263                    </xsl:with-param>
264                </xsl:call-template>
265                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
266             </xsl:for-each>
267         </span>
268         </xsl:if>
269
270         <!-- Description: Alternate Graphic Representation (MARC 880) -->
271         <xsl:if test="$display880">
272             <xsl:call-template name="m880Select">
273                 <xsl:with-param name="basetags">300</xsl:with-param>
274                 <xsl:with-param name="codes">abceg</xsl:with-param>
275                 <xsl:with-param name="class">results_summary</xsl:with-param>
276                 <xsl:with-param name="label">Description: </xsl:with-param>
277             </xsl:call-template>
278         </xsl:if>
279         
280         <xsl:if test="marc:datafield[@tag=300]">
281         <span class="results_summary"><span class="label">Description: </span>
282             <xsl:for-each select="marc:datafield[@tag=300]">
283                 <xsl:call-template name="chopPunctuation">
284                   <xsl:with-param name="chopString">
285                     <xsl:call-template name="subfieldSelect">
286                         <xsl:with-param name="codes">abceg</xsl:with-param>
287                     </xsl:call-template>
288                    </xsl:with-param>
289                </xsl:call-template>
290                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
291             </xsl:for-each>
292         </span>
293        </xsl:if>
294
295        <xsl:if test="marc:datafield[@tag=020]">
296         <span class="results_summary"><span class="label">ISBN: </span>
297         <xsl:for-each select="marc:datafield[@tag=020]">
298         <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
299                 <xsl:value-of select="marc:subfield[@code='a']"/>
300                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
301         </xsl:for-each>
302         </span>
303         </xsl:if>
304
305         <xsl:if test="marc:datafield[@tag=022]">
306         <span class="results_summary"><span class="label">ISSN: </span>
307         <xsl:for-each select="marc:datafield[@tag=022]">
308                 <xsl:value-of select="marc:subfield[@code='a']"/>
309                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
310         </xsl:for-each>
311         </span>
312         </xsl:if>
313
314         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
315         <xsl:if test="$display880">
316             <xsl:call-template name="m880Select">
317                 <xsl:with-param name="basetags">246</xsl:with-param>
318                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
319                 <xsl:with-param name="class">results_summary</xsl:with-param>
320                 <xsl:with-param name="label">Other Title: </xsl:with-param>
321             </xsl:call-template>
322         </xsl:if>
323
324         <xsl:if test="marc:datafield[@tag=246]">
325         <span class="results_summary"><span class="label">Other Title: </span>
326             <xsl:for-each select="marc:datafield[@tag=246]">
327                 <xsl:call-template name="chopPunctuation">
328                   <xsl:with-param name="chopString">
329                     <xsl:call-template name="subfieldSelect">
330                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
331                     </xsl:call-template>
332                    </xsl:with-param>
333                </xsl:call-template>
334                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
335             </xsl:for-each>
336         </span>
337        </xsl:if>
338
339         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
340         <xsl:if test="$display880">
341             <xsl:call-template name="m880Select">
342                 <xsl:with-param name="basetags">130,240</xsl:with-param>
343                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
344                 <xsl:with-param name="class">results_summary</xsl:with-param>
345                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
346             </xsl:call-template>
347         </xsl:if>
348
349         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
350         <span class="results_summary"><span class="label">Uniform titles: </span>
351         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
352             <xsl:variable name="str">
353                 <xsl:for-each select="marc:subfield">
354                     <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'])))">
355                         <xsl:value-of select="text()"/>
356                         <xsl:text> </xsl:text>
357                      </xsl:if>
358                 </xsl:for-each>
359             </xsl:variable>
360             <xsl:call-template name="chopPunctuation">
361                 <xsl:with-param name="chopString">
362                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
363                         
364                 </xsl:with-param>
365             </xsl:call-template>
366             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
367         </xsl:for-each>
368         </span>
369         </xsl:if>
370
371         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
372             <span class="results_summary"><span class="label">Subject(s): </span>
373             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
374             <a>
375             <xsl:choose>
376             <xsl:when test="marc:subfield[@code=9]">
377                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
378             </xsl:when>
379             <xsl:otherwise>
380                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
381             </xsl:otherwise>
382             </xsl:choose>
383             <xsl:call-template name="chopPunctuation">
384                 <xsl:with-param name="chopString">
385                     <xsl:call-template name="subfieldSelect">
386                         <xsl:with-param name="codes">abcdtvxyz</xsl:with-param>
387                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
388                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
389                     </xsl:call-template>
390                 </xsl:with-param>
391             </xsl:call-template>
392             </a>
393             <xsl:choose>
394             <xsl:when test="position()=last()"></xsl:when>
395             <xsl:otherwise> | </xsl:otherwise>
396             </xsl:choose>
397
398             </xsl:for-each>
399             </span>
400         </xsl:if>
401
402         <xsl:if test="marc:datafield[@tag=856]">
403         <span class="results_summary"><span class="label">Online Resources: </span>
404         <xsl:for-each select="marc:datafield[@tag=856]">
405                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
406                                     <xsl:choose>
407                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
408                                         <xsl:call-template name="subfieldSelect">
409                                         <xsl:with-param name="codes">y3z</xsl:with-param>
410                                         </xsl:call-template>
411                                     </xsl:when>
412                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
413                                         <xsl:choose>
414                                         <xsl:when test="$URLLinkText!=''">
415                                                 <xsl:value-of select="$URLLinkText"/>
416                                         </xsl:when>
417                                         <xsl:otherwise>
418                                                 <xsl:text>Click here to access online</xsl:text>
419                                         </xsl:otherwise>
420                                         </xsl:choose>
421                                     </xsl:when>
422                                     </xsl:choose>
423                                     </a>
424                                     <xsl:choose>
425                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
426                                     <xsl:otherwise> | </xsl:otherwise>
427                                     </xsl:choose>
428
429         </xsl:for-each>
430         </span>
431         </xsl:if>
432         <xsl:if test="marc:datafield[@tag=505]">
433         <xsl:for-each select="marc:datafield[@tag=505]">
434         <span class="results_summary">
435         <xsl:choose>
436         <xsl:when test="@ind1=0">
437             <span class="label">Contents:</span>
438         </xsl:when>
439         <xsl:when test="@ind1=1">
440             <span class="label">Incomplete contents:</span>
441         </xsl:when>
442         <xsl:when test="@ind1=1">
443             <span class="label">Partial contents:</span>
444         </xsl:when>
445         </xsl:choose>  
446         <xsl:choose>
447         <xsl:when test="@ind2=0">
448             <xsl:for-each select="marc:subfield[@code='t']">
449                 <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
450             </xsl:for-each> 
451         </xsl:when>
452         <xsl:otherwise>
453             <xsl:call-template name="subfieldSelect">
454                 <xsl:with-param name="codes">au</xsl:with-param>
455             </xsl:call-template>
456         </xsl:otherwise>
457         </xsl:choose>
458         </span>
459         </xsl:for-each>
460         </xsl:if>
461
462         <!-- 780 -->
463         <xsl:if test="marc:datafield[@tag=780]">
464         <xsl:for-each select="marc:datafield[@tag=780]">
465         <span class="results_summary">
466         <xsl:choose>
467         <xsl:when test="@ind2=0">
468             <span class="label">Continues:</span>
469         </xsl:when>
470         <xsl:when test="@ind2=1">
471             <span class="label">Continues in part:</span>
472         </xsl:when>
473         <xsl:when test="@ind2=2">
474             <span class="label">Supersedes:</span>
475         </xsl:when>
476         <xsl:when test="@ind2=3">
477             <span class="label">Supersedes in part:</span>
478         </xsl:when>
479         <xsl:when test="@ind2=4">
480             <span class="label">Formed by the union: ... and: ...</span>
481         </xsl:when>
482         <xsl:when test="@ind2=5">
483             <span class="label">Absorbed:</span>
484         </xsl:when>
485         <xsl:when test="@ind2=6">
486             <span class="label">Absorbed in part:</span>
487         </xsl:when>
488         <xsl:when test="@ind2=7">
489             <span class="label">Separated from:</span>
490         </xsl:when>
491         </xsl:choose>
492                 <xsl:variable name="f780">
493                     <xsl:call-template name="subfieldSelect">
494                         <xsl:with-param name="codes">at</xsl:with-param>
495                     </xsl:call-template>
496                 </xsl:variable>
497              <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
498                 <xsl:value-of select="translate($f780, '()', '')"/>
499             </a>
500         </span>
501  
502         <xsl:choose>
503         <xsl:when test="@ind1=0">
504             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
505         </xsl:when>
506         </xsl:choose>
507
508         </xsl:for-each>
509         </xsl:if>
510
511         <!-- 785 -->
512         <xsl:if test="marc:datafield[@tag=785]">
513         <xsl:for-each select="marc:datafield[@tag=785]">
514         <span class="results_summary">
515         <xsl:choose>
516         <xsl:when test="@ind2=0">
517             <span class="label">Continued by:</span>
518         </xsl:when>
519         <xsl:when test="@ind2=1">
520             <span class="label">Continued in part by:</span>
521         </xsl:when>
522         <xsl:when test="@ind2=2">
523             <span class="label">Superseded by:</span>
524         </xsl:when>
525         <xsl:when test="@ind2=3">
526             <span class="label">Superseded in part by:</span>
527         </xsl:when>
528         <xsl:when test="@ind2=4">
529             <span class="label">Absorbed by:</span>
530         </xsl:when>
531         <xsl:when test="@ind2=5">
532             <span class="label">Absorbed in part by:</span>
533         </xsl:when>
534         <xsl:when test="@ind2=6">
535             <span class="label">Split into .. and ...:</span>
536         </xsl:when>
537         <xsl:when test="@ind2=7">
538             <span class="label">Merged with ... to form ...</span>
539         </xsl:when>
540         <xsl:when test="@ind2=8">
541             <span class="label">Changed back to:</span>
542         </xsl:when>
543
544         </xsl:choose>
545                    <xsl:variable name="f785">
546                     <xsl:call-template name="subfieldSelect">
547                         <xsl:with-param name="codes">at</xsl:with-param>
548                     </xsl:call-template>
549                 </xsl:variable>
550
551                 <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
552                 <xsl:value-of select="translate($f785, '()', '')"/>
553             </a>
554
555         </span>
556         </xsl:for-each>
557         </xsl:if>
558
559         <xsl:if test="$OPACBaseURL!=''">
560         <span class="results_summary"><span class="label">OPAC view: </span>
561             <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>.
562         </span>
563         </xsl:if>
564
565     </xsl:template>
566
567     <xsl:template name="nameABCDQ">
568             <xsl:call-template name="chopPunctuation">
569                 <xsl:with-param name="chopString">
570                     <xsl:call-template name="subfieldSelect">
571                         <xsl:with-param name="codes">aq</xsl:with-param>
572                     </xsl:call-template>
573                 </xsl:with-param>
574                 <xsl:with-param name="punctuation">
575                     <xsl:text>:,;/ </xsl:text>
576                 </xsl:with-param>
577             </xsl:call-template>
578         <xsl:call-template name="termsOfAddress"/>
579     </xsl:template>
580
581     <xsl:template name="nameABCDN">
582         <xsl:for-each select="marc:subfield[@code='a']">
583                 <xsl:call-template name="chopPunctuation">
584                     <xsl:with-param name="chopString" select="."/>
585                 </xsl:call-template>
586         </xsl:for-each>
587         <xsl:for-each select="marc:subfield[@code='b']">
588                 <xsl:value-of select="."/>
589         </xsl:for-each>
590         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
591                 <xsl:call-template name="subfieldSelect">
592                     <xsl:with-param name="codes">cdn</xsl:with-param>
593                 </xsl:call-template>
594         </xsl:if>
595     </xsl:template>
596
597     <xsl:template name="nameACDEQ">
598             <xsl:call-template name="subfieldSelect">
599                 <xsl:with-param name="codes">acdeq</xsl:with-param>
600             </xsl:call-template>
601     </xsl:template>
602     <xsl:template name="termsOfAddress">
603         <xsl:if test="marc:subfield[@code='b' or @code='c']">
604             <xsl:call-template name="chopPunctuation">
605                 <xsl:with-param name="chopString">
606                     <xsl:call-template name="subfieldSelect">
607                         <xsl:with-param name="codes">bc</xsl:with-param>
608                     </xsl:call-template>
609                 </xsl:with-param>
610             </xsl:call-template>
611         </xsl:if>
612     </xsl:template>
613
614     <xsl:template name="part">
615         <xsl:variable name="partNumber">
616             <xsl:call-template name="specialSubfieldSelect">
617                 <xsl:with-param name="axis">n</xsl:with-param>
618                 <xsl:with-param name="anyCodes">n</xsl:with-param>
619                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
620             </xsl:call-template>
621         </xsl:variable>
622         <xsl:variable name="partName">
623             <xsl:call-template name="specialSubfieldSelect">
624                 <xsl:with-param name="axis">p</xsl:with-param>
625                 <xsl:with-param name="anyCodes">p</xsl:with-param>
626                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
627             </xsl:call-template>
628         </xsl:variable>
629         <xsl:if test="string-length(normalize-space($partNumber))">
630                 <xsl:call-template name="chopPunctuation">
631                     <xsl:with-param name="chopString" select="$partNumber"/>
632                 </xsl:call-template>
633         </xsl:if>
634         <xsl:if test="string-length(normalize-space($partName))">
635                 <xsl:call-template name="chopPunctuation">
636                     <xsl:with-param name="chopString" select="$partName"/>
637                 </xsl:call-template>
638         </xsl:if>
639     </xsl:template>
640
641     <xsl:template name="specialSubfieldSelect">
642         <xsl:param name="anyCodes"/>
643         <xsl:param name="axis"/>
644         <xsl:param name="beforeCodes"/>
645         <xsl:param name="afterCodes"/>
646         <xsl:variable name="str">
647             <xsl:for-each select="marc:subfield">
648                 <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])">
649                     <xsl:value-of select="text()"/>
650                     <xsl:text> </xsl:text>
651                 </xsl:if>
652             </xsl:for-each>
653         </xsl:variable>
654         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
655     </xsl:template>
656
657 </xsl:stylesheet>