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