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