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