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