Merge remote branch 'kc/new/enh/bug_5489' into kcmaster
[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='o' or $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='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'">
56                             <xsl:choose>
57                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
58                                 <xsl:otherwise>Series</xsl:otherwise>
59                             </xsl:choose>
60                         </xsl:when>
61                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
62                     </xsl:choose>
63                 </xsl:when>
64                 <xsl:when test="$leader6='t'">Book</xsl:when>
65                                 <xsl:when test="$leader6='o'">Kit</xsl:when>
66                 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
67                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
68                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
69                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual Material</xsl:when>
70                 <xsl:when test="$leader6='j'">Music</xsl:when>
71                 <xsl:when test="$leader6='i'">Sound</xsl:when>
72                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
73             </xsl:choose>
74         </xsl:variable>
75
76         <!-- Title Statement -->
77         <!-- Alternate Graphic Representation (MARC 880) -->
78         <xsl:if test="$display880">
79             <h1 class="title">
80                 <xsl:call-template name="m880Select">
81                     <xsl:with-param name="basetags">245</xsl:with-param>
82                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
83                 </xsl:call-template>
84             </h1>
85         </xsl:if>
86
87         <xsl:if test="marc:datafield[@tag=245]">
88         <h1>
89             <xsl:for-each select="marc:datafield[@tag=245]">
90                     <xsl:call-template name="subfieldSelect">
91                         <xsl:with-param name="codes">a</xsl:with-param>
92                     </xsl:call-template>
93                     <xsl:if test="marc:subfield[@code='b']">
94                         <xsl:text> </xsl:text>
95                         <xsl:call-template name="subfieldSelect">
96                             <xsl:with-param name="codes">b</xsl:with-param>
97                         </xsl:call-template>
98                     </xsl:if>
99                     <xsl:if test="marc:subfield[@code='h']">
100                         <xsl:text> </xsl:text>
101                         <xsl:call-template name="subfieldSelect">
102                             <xsl:with-param name="codes">h</xsl:with-param>
103                         </xsl:call-template>
104                     </xsl:if>
105                 <xsl:text> </xsl:text>
106                     <xsl:call-template name="subfieldSelect">
107                         <xsl:with-param name="codes">fgknps</xsl:with-param>
108                     </xsl:call-template>
109             </xsl:for-each>
110         </h1>
111         </xsl:if>
112
113         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
114         <xsl:if test="$display880">
115             <h5 class="author">
116                 <xsl:call-template name="m880Select">
117                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
118                     <xsl:with-param name="codes">abc</xsl:with-param>
119                     <xsl:with-param name="index">au</xsl:with-param>
120                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
121                 </xsl:call-template>
122             </h5>
123         </xsl:if>
124
125         <xsl:choose>
126         <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]">
127         <h5 class="author">by
128         <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
129         <a>
130         <xsl:choose>
131             <xsl:when test="marc:subfield[@code=9]">
132                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
133             </xsl:when>
134             <xsl:otherwise>
135             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
136             </xsl:otherwise>
137         </xsl:choose>
138         <xsl:call-template name="nameABCDQ"/></a>
139         <xsl:choose>
140         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
141         </xsl:for-each>
142
143         <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
144         <a>
145         <xsl:choose>
146             <xsl:when test="marc:subfield[@code=9]">
147                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
148             </xsl:when>
149             <xsl:otherwise>
150             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
151             </xsl:otherwise>
152         </xsl:choose>
153         <xsl:call-template name="nameABCDN"/></a>
154         <xsl:choose><xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
155         </xsl:for-each>
156
157         <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
158             <xsl:choose>
159             <xsl:when test="marc:subfield[@code='n']">
160                <xsl:text> </xsl:text>
161                <xsl:call-template name="subfieldSelect">
162                   <xsl:with-param name="codes">n</xsl:with-param>                              </xsl:call-template>
163                <xsl:text> </xsl:text>
164             </xsl:when>
165             </xsl:choose>
166         <a>
167         <xsl:choose>
168             <xsl:when test="marc:subfield[@code=9]">
169                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
170             </xsl:when>
171             <xsl:otherwise>
172             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
173             </xsl:otherwise>
174         </xsl:choose>
175         <xsl:call-template name="nameACDEQ"/></a>
176         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
177
178         </xsl:for-each>
179         </h5>
180         </xsl:when>
181         </xsl:choose>
182         <div id="views">
183         <span class="view"><span id="Normalview">Normal View</span> </span>
184         <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC">MARC View</a></span>
185 <xsl:if test="$ShowISBD!='0'">
186         <span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}">ISBD View</a></span>
187 </xsl:if>
188         </div>
189
190    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
191         <xsl:if test="$materialTypeCode!=''">
192         <span class="results_summary"><span class="label">Type: </span>
193         <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>
194         <xsl:value-of select="$materialTypeLabel"/>
195         </span>
196         </xsl:if>
197    </xsl:if>
198
199         <!--Series: Alternate Graphic Representation (MARC 880) -->
200         <xsl:if test="$display880">
201             <xsl:call-template name="m880Select">
202                 <xsl:with-param name="basetags">440,490</xsl:with-param>
203                 <xsl:with-param name="codes">av</xsl:with-param>
204                 <xsl:with-param name="class">results_summary</xsl:with-param>
205                 <xsl:with-param name="label">Series: </xsl:with-param>
206                 <xsl:with-param name="index">se</xsl:with-param>
207             </xsl:call-template>
208         </xsl:if>
209
210         <!-- Series -->
211         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
212         <span class="results_summary"><span class="label">Series: </span>
213         <!-- 440 -->
214         <xsl:for-each select="marc:datafield[@tag=440]">
215              <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
216             <xsl:call-template name="chopPunctuation">
217                             <xsl:with-param name="chopString">
218                                 <xsl:call-template name="subfieldSelect">
219                                     <xsl:with-param name="codes">av</xsl:with-param>
220                                 </xsl:call-template>
221                             </xsl:with-param>
222                         </xsl:call-template>
223                         </a>
224                     <xsl:text> </xsl:text><xsl:call-template name="part"/>
225             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
226         </xsl:for-each>
227
228         <!-- 490 Series not traced, Ind1 = 0 -->
229         <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
230              <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
231                         <xsl:call-template name="chopPunctuation">
232                             <xsl:with-param name="chopString">
233                                 <xsl:call-template name="subfieldSelect">
234                                     <xsl:with-param name="codes">av</xsl:with-param>
235                                 </xsl:call-template>
236                             </xsl:with-param>
237                         </xsl:call-template>
238             </a>
239                     <xsl:call-template name="part"/>
240         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
241         </xsl:for-each>
242         <!-- 490 Series traced, Ind1 = 1 -->
243         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
244             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
245                 <xsl:choose>
246                     <xsl:when test="marc:subfield[@code='w']">
247                         <a href="/cgi-bin/koha/opac-search.pl?q=rcn:{marc:subfield[@code='w']}">
248                             <xsl:call-template name="chopPunctuation">
249                                 <xsl:with-param name="chopString">
250                                     <xsl:call-template name="subfieldSelect">
251                                         <xsl:with-param name="codes">at</xsl:with-param>
252                                     </xsl:call-template>
253                                 </xsl:with-param>
254                             </xsl:call-template>
255                         </a>
256                     </xsl:when>
257                     <xsl:otherwise>
258                         <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='t']}">
259                             <xsl:call-template name="chopPunctuation">
260                                 <xsl:with-param name="chopString">
261                                     <xsl:call-template name="subfieldSelect">
262                                         <xsl:with-param name="codes">at</xsl:with-param>
263                                     </xsl:call-template>
264                                 </xsl:with-param>
265                             </xsl:call-template>
266                         </a>
267                         <xsl:call-template name="part"/>
268                     </xsl:otherwise>
269                 </xsl:choose>
270                 <xsl:text>: </xsl:text>
271                 <xsl:value-of  select="marc:subfield[@code='v']" />
272             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
273             </xsl:for-each>
274         </xsl:if>
275         </span>
276         </xsl:if>
277
278         <!-- Volumes of sets and traced series -->
279         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
280         <span class="results_summary"><span class="label">Volumes: </span>
281             <a>
282             <xsl:choose>
283             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
284                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/></xsl:attribute>
285             </xsl:when>
286             <xsl:otherwise>
287                 <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>
288             </xsl:otherwise>
289             </xsl:choose>
290             <xsl:text>Show volumes</xsl:text>
291             </a>
292         </span>
293         </xsl:if>
294
295         <!-- Set -->
296         <xsl:if test="$leader19='c'">
297         <span class="results_summary"><span class="label">Set: </span>
298         <xsl:for-each select="marc:datafield[@tag=773]">
299             <a>
300             <xsl:choose>
301             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
302                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
303             </xsl:when>
304             <xsl:otherwise>
305                 <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>
306             </xsl:otherwise>
307             </xsl:choose>
308             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
309             </a>
310             <xsl:choose>
311                 <xsl:when test="position()=last()"></xsl:when>
312                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
313             </xsl:choose>
314         </xsl:for-each>
315         </span>
316         </xsl:if>
317
318         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
319         <xsl:if test="$display880">
320             <xsl:call-template name="m880Select">
321                 <xsl:with-param name="basetags">260</xsl:with-param>
322                 <xsl:with-param name="codes">abcg</xsl:with-param>
323                 <xsl:with-param name="class">results_summary</xsl:with-param>
324                 <xsl:with-param name="label">Publisher: </xsl:with-param>
325             </xsl:call-template>
326         </xsl:if>
327
328         <xsl:if test="marc:datafield[@tag=260]">
329         <span class="results_summary"><span class="label">Publisher: </span>
330             <xsl:for-each select="marc:datafield[@tag=260]">
331                 <xsl:if test="marc:subfield[@code='b']">
332                 <a href="/cgi-bin/koha/opac-search.pl?q=pb:{marc:subfield[@code='b']}">
333                     <xsl:call-template name="subfieldSelect">
334                         <xsl:with-param name="codes">b</xsl:with-param>
335                     </xsl:call-template>
336                </a>
337                </xsl:if>
338                <xsl:text> </xsl:text>
339                 <xsl:call-template name="chopPunctuation">
340                   <xsl:with-param name="chopString">
341                     <xsl:call-template name="subfieldSelect">
342                         <xsl:with-param name="codes">acg</xsl:with-param>
343                     </xsl:call-template>
344                    </xsl:with-param>
345                </xsl:call-template>
346                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
347             </xsl:for-each>
348         </span>
349         </xsl:if>
350
351         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
352         <xsl:if test="$display880">
353             <xsl:call-template name="m880Select">
354                 <xsl:with-param name="basetags">250</xsl:with-param>
355                 <xsl:with-param name="codes">ab</xsl:with-param>
356                 <xsl:with-param name="class">results_summary</xsl:with-param>
357                 <xsl:with-param name="label">Edition: </xsl:with-param>
358             </xsl:call-template>
359         </xsl:if>
360
361         <xsl:if test="marc:datafield[@tag=250]">
362         <span class="results_summary"><span class="label">Edition: </span>
363             <xsl:for-each select="marc:datafield[@tag=250]">
364                 <xsl:call-template name="chopPunctuation">
365                   <xsl:with-param name="chopString">
366                     <xsl:call-template name="subfieldSelect">
367                         <xsl:with-param name="codes">ab</xsl:with-param>
368                     </xsl:call-template>
369                    </xsl:with-param>
370                </xsl:call-template>
371                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
372             </xsl:for-each>
373         </span>
374         </xsl:if>
375
376         <!-- Description: Alternate Graphic Representation (MARC 880) -->
377         <xsl:if test="$display880">
378             <xsl:call-template name="m880Select">
379                 <xsl:with-param name="basetags">300</xsl:with-param>
380                 <xsl:with-param name="codes">abceg</xsl:with-param>
381                 <xsl:with-param name="class">results_summary</xsl:with-param>
382                 <xsl:with-param name="label">Description: </xsl:with-param>
383             </xsl:call-template>
384         </xsl:if>
385
386         <xsl:if test="marc:datafield[@tag=300]">
387         <span class="results_summary"><span class="label">Description: </span>
388             <xsl:for-each select="marc:datafield[@tag=300]">
389                 <xsl:call-template name="chopPunctuation">
390                   <xsl:with-param name="chopString">
391                     <xsl:call-template name="subfieldSelect">
392                         <xsl:with-param name="codes">abceg</xsl:with-param>
393                     </xsl:call-template>
394                    </xsl:with-param>
395                </xsl:call-template>
396                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
397             </xsl:for-each>
398         </span>
399        </xsl:if>
400
401        <xsl:if test="marc:datafield[@tag=020]">
402         <span class="results_summary"><span class="label">ISBN: </span>
403         <xsl:for-each select="marc:datafield[@tag=020]">
404         <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
405                 <xsl:value-of select="marc:subfield[@code='a']"/>
406                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
407         </xsl:for-each>
408         </span>
409         </xsl:if>
410
411         <xsl:if test="marc:datafield[@tag=022]">
412         <span class="results_summary"><span class="label">ISSN: </span>
413         <xsl:for-each select="marc:datafield[@tag=022]">
414                 <xsl:value-of select="marc:subfield[@code='a']"/>
415                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
416         </xsl:for-each>
417         </span>
418         </xsl:if>
419
420         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
421         <xsl:if test="$display880">
422             <xsl:call-template name="m880Select">
423                 <xsl:with-param name="basetags">246</xsl:with-param>
424                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
425                 <xsl:with-param name="class">results_summary</xsl:with-param>
426                 <xsl:with-param name="label">Other Title: </xsl:with-param>
427             </xsl:call-template>
428         </xsl:if>
429
430         <xsl:if test="marc:datafield[@tag=246]">
431         <span class="results_summary"><span class="label">Other Title: </span>
432             <xsl:for-each select="marc:datafield[@tag=246]">
433                 <xsl:call-template name="chopPunctuation">
434                   <xsl:with-param name="chopString">
435                     <xsl:call-template name="subfieldSelect">
436                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
437                     </xsl:call-template>
438                    </xsl:with-param>
439                </xsl:call-template>
440                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
441             </xsl:for-each>
442         </span>
443        </xsl:if>
444
445         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
446         <xsl:if test="$display880">
447             <xsl:call-template name="m880Select">
448                 <xsl:with-param name="basetags">130,240</xsl:with-param>
449                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
450                 <xsl:with-param name="class">results_summary</xsl:with-param>
451                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
452             </xsl:call-template>
453         </xsl:if>
454
455         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
456         <span class="results_summary"><span class="label">Uniform titles: </span>
457         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
458             <xsl:variable name="str">
459                 <xsl:for-each select="marc:subfield">
460                     <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'])))">
461                         <xsl:value-of select="text()"/>
462                         <xsl:text> </xsl:text>
463                      </xsl:if>
464                 </xsl:for-each>
465             </xsl:variable>
466             <xsl:call-template name="chopPunctuation">
467                 <xsl:with-param name="chopString">
468                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
469
470                 </xsl:with-param>
471             </xsl:call-template>
472             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
473         </xsl:for-each>
474         </span>
475         </xsl:if>
476
477         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
478             <span class="results_summary"><span class="label">Subject(s): </span>
479             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
480             <a>
481             <xsl:choose>
482             <xsl:when test="marc:subfield[@code=9]">
483                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
484             </xsl:when>
485             <xsl:otherwise>
486                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
487             </xsl:otherwise>
488             </xsl:choose>
489             <xsl:call-template name="chopPunctuation">
490                 <xsl:with-param name="chopString">
491                     <xsl:call-template name="subfieldSelect">
492                         <xsl:with-param name="codes">abcdtvxyz</xsl:with-param>
493                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
494                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
495                     </xsl:call-template>
496                 </xsl:with-param>
497             </xsl:call-template>
498             </a>
499             <xsl:choose>
500             <xsl:when test="position()=last()"></xsl:when>
501             <xsl:otherwise> | </xsl:otherwise>
502             </xsl:choose>
503
504             </xsl:for-each>
505             </span>
506         </xsl:if>
507
508         <xsl:if test="marc:datafield[@tag=856]">
509         <span class="results_summary"><span class="label">Online Resources: </span>
510         <xsl:for-each select="marc:datafield[@tag=856]">
511                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
512                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
513                                     <xsl:choose>
514                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
515                                         <xsl:call-template name="subfieldSelect">
516                                         <xsl:with-param name="codes">y3z</xsl:with-param>
517                                         </xsl:call-template>
518                                     </xsl:when>
519                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
520                                         <xsl:choose>
521                                         <xsl:when test="$URLLinkText!=''">
522                                                 <xsl:value-of select="$URLLinkText"/>
523                                         </xsl:when>
524                                         <xsl:otherwise>
525                                                 <xsl:text>Click here to access online</xsl:text>
526                                         </xsl:otherwise>
527                                         </xsl:choose>
528                                     </xsl:when>
529                                     </xsl:choose>
530                                     </a>
531                               </xsl:if>
532                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
533                                    <a target='_blank'><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
534                                     <xsl:choose>
535                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
536                                         <xsl:call-template name="subfieldSelect">
537                                         <xsl:with-param name="codes">y3z</xsl:with-param>
538                                         </xsl:call-template>
539                                     </xsl:when>
540                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
541                                         <xsl:choose>
542                                         <xsl:when test="$URLLinkText!=''">
543                                                 <xsl:value-of select="$URLLinkText"/>
544                                         </xsl:when>
545                                         <xsl:otherwise>
546                                                 <xsl:text>Click here to access online</xsl:text>
547                                         </xsl:otherwise>
548                                         </xsl:choose>
549                                     </xsl:when>
550                                     </xsl:choose>
551                                     </a>
552                               </xsl:if>
553                                     <xsl:choose>
554                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
555                                     <xsl:otherwise> | </xsl:otherwise>
556                                     </xsl:choose>
557
558         </xsl:for-each>
559         </span>
560         </xsl:if>
561         <xsl:if test="marc:datafield[@tag=505]">
562         <xsl:for-each select="marc:datafield[@tag=505]">
563         <span class="results_summary">
564         <xsl:choose>
565         <xsl:when test="@ind1=1">
566             <span class="label">Incomplete contents:</span>
567         </xsl:when>
568         <xsl:when test="@ind1=1">
569             <span class="label">Partial contents:</span>
570         </xsl:when>
571         <xsl:otherwise>
572             <span class="label">Contents:</span>
573         </xsl:otherwise>
574         </xsl:choose>
575         <xsl:choose>
576         <xsl:when test="@ind2=0">
577             <xsl:for-each select="marc:subfield[@code='t']">
578                 <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
579             </xsl:for-each>
580         </xsl:when>
581         <xsl:otherwise>
582             <xsl:call-template name="subfieldSelect">
583                 <xsl:with-param name="codes">au</xsl:with-param>
584             </xsl:call-template>
585         </xsl:otherwise>
586         </xsl:choose>
587         </span>
588         </xsl:for-each>
589         </xsl:if>
590
591         <!-- 773 -->
592         <xsl:if test="marc:datafield[@tag=773]">
593         <xsl:for-each select="marc:datafield[@tag=773]">
594         <xsl:if test="@ind1=0">
595         <span class="results_summary"><span class="label">
596         <xsl:choose>
597         <xsl:when test="@ind2=' '">
598             In:
599         </xsl:when>
600         <xsl:when test="@ind2=8">
601             <xsl:if test="marc:subfield[@code='i']">
602                 <xsl:value-of select="marc:subfield[@code='i']"/>
603             </xsl:if>
604         </xsl:when>
605         </xsl:choose>
606         </span>
607                 <xsl:variable name="f773">
608                     <xsl:call-template name="subfieldSelect">
609                         <xsl:with-param name="codes">at</xsl:with-param>
610                     </xsl:call-template>
611                 </xsl:variable>
612             <xsl:choose>
613                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
614                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
615                         <xsl:value-of select="translate($f773, '()', '')"/>
616                     </a>
617                 </xsl:when>
618                 <xsl:otherwise>
619                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
620                         <xsl:value-of select="$f773"/>
621                     </a>
622                 </xsl:otherwise>
623             </xsl:choose>
624         </span>
625
626         <xsl:if test="marc:subfield[@code='n']">
627             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
628         </xsl:if>
629
630         </xsl:if>
631         </xsl:for-each>
632         </xsl:if>
633
634         <xsl:for-each select="marc:datafield[@tag=520]">
635         <span class="results_summary"><span class="label">
636         <xsl:choose>
637           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
638           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
639           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
640           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
641           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
642           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
643         </xsl:choose>
644         </span>
645         <xsl:call-template name="subfieldSelect">
646           <xsl:with-param name="codes">abcu</xsl:with-param>
647         </xsl:call-template>
648         </span>
649         </xsl:for-each>
650
651         <!-- 866 holdings public note -->
652         <xsl:if test="marc:datafield[@tag=866]">
653         <span class="results_summary"><span class="label">Holdings Note: </span>
654         <xsl:for-each select="marc:datafield[@tag=866]">
655                 <xsl:value-of select="marc:subfield[@code='z']"/>
656                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
657         </xsl:for-each>
658         </span>
659         </xsl:if>
660
661         <!--  775 Other Edition  -->
662         <xsl:if test="marc:datafield[@tag=775]">
663         <span class="results_summary"><span class="label">Other Editions: </span>
664         <xsl:for-each select="marc:datafield[@tag=775]">
665             <xsl:if test="marc:subfield[@code='i']">
666                 <xsl:call-template name="subfieldSelect">
667                     <xsl:with-param name="codes">i</xsl:with-param>
668                 </xsl:call-template>
669                 <xsl:text>: </xsl:text>
670             </xsl:if>
671             <a>
672             <xsl:choose>
673             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
674                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
675             </xsl:when>
676             <xsl:otherwise>
677                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
678             </xsl:otherwise>
679             </xsl:choose>
680             <xsl:call-template name="subfieldSelect">
681                 <xsl:with-param name="codes">t</xsl:with-param>
682             </xsl:call-template>
683             </a>
684             <xsl:choose>
685                 <xsl:when test="position()=last()"></xsl:when>
686                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
687             </xsl:choose>
688         </xsl:for-each>
689         </span>
690         </xsl:if>
691
692         <!-- 780 -->
693         <xsl:if test="marc:datafield[@tag=780]">
694         <xsl:for-each select="marc:datafield[@tag=780]">
695         <xsl:if test="@ind1=0">
696         <span class="results_summary">
697         <xsl:choose>
698         <xsl:when test="@ind2=0">
699             <span class="label">Continues:</span>
700         </xsl:when>
701         <xsl:when test="@ind2=1">
702             <span class="label">Continues in part:</span>
703         </xsl:when>
704         <xsl:when test="@ind2=2">
705             <span class="label">Supersedes:</span>
706         </xsl:when>
707         <xsl:when test="@ind2=3">
708             <span class="label">Supersedes in part:</span>
709         </xsl:when>
710         <xsl:when test="@ind2=4">
711             <span class="label">Formed by the union: ... and: ...</span>
712         </xsl:when>
713         <xsl:when test="@ind2=5">
714             <span class="label">Absorbed:</span>
715         </xsl:when>
716         <xsl:when test="@ind2=6">
717             <span class="label">Absorbed in part:</span>
718         </xsl:when>
719         <xsl:when test="@ind2=7">
720             <span class="label">Separated from:</span>
721         </xsl:when>
722         </xsl:choose>
723                 <xsl:variable name="f780">
724                     <xsl:call-template name="subfieldSelect">
725                         <xsl:with-param name="codes">at</xsl:with-param>
726                     </xsl:call-template>
727                 </xsl:variable>
728             <xsl:choose>
729                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
730                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
731                         <xsl:value-of select="translate($f780, '()', '')"/>
732                     </a>
733                 </xsl:when>
734                 <xsl:otherwise>
735                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
736                         <xsl:value-of select="translate($f780, '()', '')"/>
737                     </a>
738                 </xsl:otherwise>
739             </xsl:choose>
740         </span>
741
742         <xsl:if test="marc:subfield[@code='n']">
743             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
744         </xsl:if>
745
746         </xsl:if>
747         </xsl:for-each>
748         </xsl:if>
749
750         <!-- 785 -->
751         <xsl:if test="marc:datafield[@tag=785]">
752         <xsl:for-each select="marc:datafield[@tag=785]">
753         <xsl:if test="@ind1=0">
754         <span class="results_summary">
755         <xsl:choose>
756         <xsl:when test="@ind2=0">
757             <span class="label">Continued by:</span>
758         </xsl:when>
759         <xsl:when test="@ind2=1">
760             <span class="label">Continued in part by:</span>
761         </xsl:when>
762         <xsl:when test="@ind2=2">
763             <span class="label">Superseded by:</span>
764         </xsl:when>
765         <xsl:when test="@ind2=3">
766             <span class="label">Superseded in part by:</span>
767         </xsl:when>
768         <xsl:when test="@ind2=4">
769             <span class="label">Absorbed by:</span>
770         </xsl:when>
771         <xsl:when test="@ind2=5">
772             <span class="label">Absorbed in part by:</span>
773         </xsl:when>
774         <xsl:when test="@ind2=6">
775             <span class="label">Split into .. and ...:</span>
776         </xsl:when>
777         <xsl:when test="@ind2=7">
778             <span class="label">Merged with ... to form ...</span>
779         </xsl:when>
780         <xsl:when test="@ind2=8">
781             <span class="label">Changed back to:</span>
782         </xsl:when>
783
784         </xsl:choose>
785                    <xsl:variable name="f785">
786                     <xsl:call-template name="subfieldSelect">
787                         <xsl:with-param name="codes">at</xsl:with-param>
788                     </xsl:call-template>
789                 </xsl:variable>
790
791             <xsl:choose>
792                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
793                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
794                         <xsl:value-of select="translate($f785, '()', '')"/>
795                     </a>
796                 </xsl:when>
797                 <xsl:otherwise>
798                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
799                         <xsl:value-of select="translate($f785, '()', '')"/>
800                     </a>
801                 </xsl:otherwise>
802             </xsl:choose>
803
804         </span>
805
806         <xsl:if test="marc:subfield[@code='n']">
807             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
808         </xsl:if>
809
810         </xsl:if>
811         </xsl:for-each>
812         </xsl:if>
813
814     </xsl:template>
815
816     <xsl:template name="nameABCDQ">
817             <xsl:call-template name="chopPunctuation">
818                 <xsl:with-param name="chopString">
819                     <xsl:call-template name="subfieldSelect">
820                         <xsl:with-param name="codes">aq</xsl:with-param>
821                     </xsl:call-template>
822                 </xsl:with-param>
823                 <xsl:with-param name="punctuation">
824                     <xsl:text>:,;/ </xsl:text>
825                 </xsl:with-param>
826             </xsl:call-template>
827         <xsl:call-template name="termsOfAddress"/>
828     </xsl:template>
829
830     <xsl:template name="nameABCDN">
831         <xsl:for-each select="marc:subfield[@code='a']">
832                 <xsl:call-template name="chopPunctuation">
833                     <xsl:with-param name="chopString" select="."/>
834                 </xsl:call-template>
835         </xsl:for-each>
836         <xsl:for-each select="marc:subfield[@code='b']">
837                 <xsl:value-of select="."/>
838         </xsl:for-each>
839         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
840                 <xsl:call-template name="subfieldSelect">
841                     <xsl:with-param name="codes">cdn</xsl:with-param>
842                 </xsl:call-template>
843         </xsl:if>
844     </xsl:template>
845
846     <xsl:template name="nameACDEQ">
847             <xsl:call-template name="subfieldSelect">
848                 <xsl:with-param name="codes">acdeq</xsl:with-param>
849             </xsl:call-template>
850     </xsl:template>
851     <xsl:template name="termsOfAddress">
852         <xsl:if test="marc:subfield[@code='b' or @code='c']">
853             <xsl:call-template name="chopPunctuation">
854                 <xsl:with-param name="chopString">
855                     <xsl:call-template name="subfieldSelect">
856                         <xsl:with-param name="codes">bc</xsl:with-param>
857                     </xsl:call-template>
858                 </xsl:with-param>
859             </xsl:call-template>
860         </xsl:if>
861     </xsl:template>
862
863     <xsl:template name="part">
864         <xsl:variable name="partNumber">
865             <xsl:call-template name="specialSubfieldSelect">
866                 <xsl:with-param name="axis">n</xsl:with-param>
867                 <xsl:with-param name="anyCodes">n</xsl:with-param>
868                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
869             </xsl:call-template>
870         </xsl:variable>
871         <xsl:variable name="partName">
872             <xsl:call-template name="specialSubfieldSelect">
873                 <xsl:with-param name="axis">p</xsl:with-param>
874                 <xsl:with-param name="anyCodes">p</xsl:with-param>
875                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
876             </xsl:call-template>
877         </xsl:variable>
878         <xsl:if test="string-length(normalize-space($partNumber))">
879                 <xsl:call-template name="chopPunctuation">
880                     <xsl:with-param name="chopString" select="$partNumber"/>
881                 </xsl:call-template>
882         </xsl:if>
883         <xsl:if test="string-length(normalize-space($partName))">
884                 <xsl:call-template name="chopPunctuation">
885                     <xsl:with-param name="chopString" select="$partName"/>
886                 </xsl:call-template>
887         </xsl:if>
888     </xsl:template>
889
890     <xsl:template name="specialSubfieldSelect">
891         <xsl:param name="anyCodes"/>
892         <xsl:param name="axis"/>
893         <xsl:param name="beforeCodes"/>
894         <xsl:param name="afterCodes"/>
895         <xsl:variable name="str">
896             <xsl:for-each select="marc:subfield">
897                 <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])">
898                     <xsl:value-of select="text()"/>
899                     <xsl:text> </xsl:text>
900                 </xsl:if>
901             </xsl:for-each>
902         </xsl:variable>
903         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
904     </xsl:template>
905 </xsl:stylesheet>