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