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