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