Bug 5816: XSLT doesn't display enhanced contents
[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"></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                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
508                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
509                                     <xsl:choose>
510                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
511                                         <xsl:call-template name="subfieldSelect">
512                                         <xsl:with-param name="codes">y3z</xsl:with-param>
513                                         </xsl:call-template>
514                                     </xsl:when>
515                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
516                                         <xsl:choose>
517                                         <xsl:when test="$URLLinkText!=''">
518                                                 <xsl:value-of select="$URLLinkText"/>
519                                         </xsl:when>
520                                         <xsl:otherwise>
521                                                 <xsl:text>Click here to access online</xsl:text>
522                                         </xsl:otherwise>
523                                         </xsl:choose>
524                                     </xsl:when>
525                                     </xsl:choose>
526                                     </a>
527                               </xsl:if>
528                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
529                                    <a target='_blank'><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
530                                     <xsl:choose>
531                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
532                                         <xsl:call-template name="subfieldSelect">
533                                         <xsl:with-param name="codes">y3z</xsl:with-param>
534                                         </xsl:call-template>
535                                     </xsl:when>
536                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
537                                         <xsl:choose>
538                                         <xsl:when test="$URLLinkText!=''">
539                                                 <xsl:value-of select="$URLLinkText"/>
540                                         </xsl:when>
541                                         <xsl:otherwise>
542                                                 <xsl:text>Click here to access online</xsl:text>
543                                         </xsl:otherwise>
544                                         </xsl:choose>
545                                     </xsl:when>
546                                     </xsl:choose>
547                                     </a>
548                               </xsl:if>
549                                     <xsl:choose>
550                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
551                                     <xsl:otherwise> | </xsl:otherwise>
552                                     </xsl:choose>
553
554         </xsl:for-each>
555         </span>
556         </xsl:if>
557         <xsl:if test="marc:datafield[@tag=505]">
558         <xsl:for-each select="marc:datafield[@tag=505]">
559         <span class="results_summary">
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         <!-- 773 -->
588         <xsl:if test="marc:datafield[@tag=773]">
589         <xsl:for-each select="marc:datafield[@tag=773]">
590         <xsl:if test="@ind1=0">
591         <span class="results_summary"><span class="label">
592         <xsl:choose>
593         <xsl:when test="@ind2=' '">
594             In:
595         </xsl:when>
596         <xsl:when test="@ind2=8">
597             <xsl:if test="marc:subfield[@code='i']">
598                 <xsl:value-of select="marc:subfield[@code='i']"/>
599             </xsl:if>
600         </xsl:when>
601         </xsl:choose>
602         </span>
603                 <xsl:variable name="f773">
604                     <xsl:call-template name="subfieldSelect">
605                         <xsl:with-param name="codes">at</xsl:with-param>
606                     </xsl:call-template>
607                 </xsl:variable>
608             <xsl:choose>
609                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
610                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
611                         <xsl:value-of select="translate($f773, '()', '')"/>
612                     </a>
613                 </xsl:when>
614                 <xsl:otherwise>
615                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
616                         <xsl:value-of select="$f773"/>
617                     </a>
618                 </xsl:otherwise>
619             </xsl:choose>
620         </span>
621
622         <xsl:if test="marc:subfield[@code='n']">
623             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
624         </xsl:if>
625
626         </xsl:if>
627         </xsl:for-each>
628         </xsl:if>
629
630         <xsl:for-each select="marc:datafield[@tag=520]">
631         <span class="results_summary"><span class="label">
632         <xsl:choose>
633           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
634           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
635           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
636           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
637           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
638           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
639         </xsl:choose>
640         </span>
641         <xsl:call-template name="subfieldSelect">
642           <xsl:with-param name="codes">abcu</xsl:with-param>
643         </xsl:call-template>
644         </span>
645         </xsl:for-each>
646
647         <!-- 866 holdings public note -->
648         <xsl:if test="marc:datafield[@tag=866]">
649         <span class="results_summary"><span class="label">Holdings Note: </span>
650         <xsl:for-each select="marc:datafield[@tag=866]">
651                 <xsl:value-of select="marc:subfield[@code='z']"/>
652                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
653         </xsl:for-each>
654         </span>
655         </xsl:if>
656
657         <!--  775 Other Edition  -->
658         <xsl:if test="marc:datafield[@tag=775]">
659         <span class="results_summary"><span class="label">Other Editions: </span>
660         <xsl:for-each select="marc:datafield[@tag=775]">
661             <xsl:if test="marc:subfield[@code='i']">
662                 <xsl:call-template name="subfieldSelect">
663                     <xsl:with-param name="codes">i</xsl:with-param>
664                 </xsl:call-template>
665                 <xsl:text>: </xsl:text>
666             </xsl:if>
667             <a>
668             <xsl:choose>
669             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
670                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
671             </xsl:when>
672             <xsl:otherwise>
673                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
674             </xsl:otherwise>
675             </xsl:choose>
676             <xsl:call-template name="subfieldSelect">
677                 <xsl:with-param name="codes">t</xsl:with-param>
678             </xsl:call-template>
679             </a>
680             <xsl:choose>
681                 <xsl:when test="position()=last()"></xsl:when>
682                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
683             </xsl:choose>
684         </xsl:for-each>
685         </span>
686         </xsl:if>
687
688         <!-- 780 -->
689         <xsl:if test="marc:datafield[@tag=780]">
690         <xsl:for-each select="marc:datafield[@tag=780]">
691         <xsl:if test="@ind1=0">
692         <span class="results_summary">
693         <xsl:choose>
694         <xsl:when test="@ind2=0">
695             <span class="label">Continues:</span>
696         </xsl:when>
697         <xsl:when test="@ind2=1">
698             <span class="label">Continues in part:</span>
699         </xsl:when>
700         <xsl:when test="@ind2=2">
701             <span class="label">Supersedes:</span>
702         </xsl:when>
703         <xsl:when test="@ind2=3">
704             <span class="label">Supersedes in part:</span>
705         </xsl:when>
706         <xsl:when test="@ind2=4">
707             <span class="label">Formed by the union: ... and: ...</span>
708         </xsl:when>
709         <xsl:when test="@ind2=5">
710             <span class="label">Absorbed:</span>
711         </xsl:when>
712         <xsl:when test="@ind2=6">
713             <span class="label">Absorbed in part:</span>
714         </xsl:when>
715         <xsl:when test="@ind2=7">
716             <span class="label">Separated from:</span>
717         </xsl:when>
718         </xsl:choose>
719                 <xsl:variable name="f780">
720                     <xsl:call-template name="subfieldSelect">
721                         <xsl:with-param name="codes">at</xsl:with-param>
722                     </xsl:call-template>
723                 </xsl:variable>
724             <xsl:choose>
725                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
726                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
727                         <xsl:value-of select="translate($f780, '()', '')"/>
728                     </a>
729                 </xsl:when>
730                 <xsl:otherwise>
731                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
732                         <xsl:value-of select="translate($f780, '()', '')"/>
733                     </a>
734                 </xsl:otherwise>
735             </xsl:choose>
736         </span>
737
738         <xsl:if test="marc:subfield[@code='n']">
739             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
740         </xsl:if>
741
742         </xsl:if>
743         </xsl:for-each>
744         </xsl:if>
745
746         <!-- 785 -->
747         <xsl:if test="marc:datafield[@tag=785]">
748         <xsl:for-each select="marc:datafield[@tag=785]">
749         <xsl:if test="@ind1=0">
750         <span class="results_summary">
751         <xsl:choose>
752         <xsl:when test="@ind2=0">
753             <span class="label">Continued by:</span>
754         </xsl:when>
755         <xsl:when test="@ind2=1">
756             <span class="label">Continued in part by:</span>
757         </xsl:when>
758         <xsl:when test="@ind2=2">
759             <span class="label">Superseded by:</span>
760         </xsl:when>
761         <xsl:when test="@ind2=3">
762             <span class="label">Superseded in part by:</span>
763         </xsl:when>
764         <xsl:when test="@ind2=4">
765             <span class="label">Absorbed by:</span>
766         </xsl:when>
767         <xsl:when test="@ind2=5">
768             <span class="label">Absorbed in part by:</span>
769         </xsl:when>
770         <xsl:when test="@ind2=6">
771             <span class="label">Split into .. and ...:</span>
772         </xsl:when>
773         <xsl:when test="@ind2=7">
774             <span class="label">Merged with ... to form ...</span>
775         </xsl:when>
776         <xsl:when test="@ind2=8">
777             <span class="label">Changed back to:</span>
778         </xsl:when>
779
780         </xsl:choose>
781                    <xsl:variable name="f785">
782                     <xsl:call-template name="subfieldSelect">
783                         <xsl:with-param name="codes">at</xsl:with-param>
784                     </xsl:call-template>
785                 </xsl:variable>
786
787             <xsl:choose>
788                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
789                     <a href="/cgi-bin/koha/opac-search.pl?q=Control-number:{marc:subfield[@code='w']}">
790                         <xsl:value-of select="translate($f785, '()', '')"/>
791                     </a>
792                 </xsl:when>
793                 <xsl:otherwise>
794                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
795                         <xsl:value-of select="translate($f785, '()', '')"/>
796                     </a>
797                 </xsl:otherwise>
798             </xsl:choose>
799
800         </span>
801
802         <xsl:if test="marc:subfield[@code='n']">
803             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
804         </xsl:if>
805
806         </xsl:if>
807         </xsl:for-each>
808         </xsl:if>
809
810     </xsl:template>
811
812     <xsl:template name="nameABCDQ">
813             <xsl:call-template name="chopPunctuation">
814                 <xsl:with-param name="chopString">
815                     <xsl:call-template name="subfieldSelect">
816                         <xsl:with-param name="codes">aq</xsl:with-param>
817                     </xsl:call-template>
818                 </xsl:with-param>
819                 <xsl:with-param name="punctuation">
820                     <xsl:text>:,;/ </xsl:text>
821                 </xsl:with-param>
822             </xsl:call-template>
823         <xsl:call-template name="termsOfAddress"/>
824     </xsl:template>
825
826     <xsl:template name="nameABCDN">
827         <xsl:for-each select="marc:subfield[@code='a']">
828                 <xsl:call-template name="chopPunctuation">
829                     <xsl:with-param name="chopString" select="."/>
830                 </xsl:call-template>
831         </xsl:for-each>
832         <xsl:for-each select="marc:subfield[@code='b']">
833                 <xsl:value-of select="."/>
834         </xsl:for-each>
835         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
836                 <xsl:call-template name="subfieldSelect">
837                     <xsl:with-param name="codes">cdn</xsl:with-param>
838                 </xsl:call-template>
839         </xsl:if>
840     </xsl:template>
841
842     <xsl:template name="nameACDEQ">
843             <xsl:call-template name="subfieldSelect">
844                 <xsl:with-param name="codes">acdeq</xsl:with-param>
845             </xsl:call-template>
846     </xsl:template>
847     <xsl:template name="termsOfAddress">
848         <xsl:if test="marc:subfield[@code='b' or @code='c']">
849             <xsl:call-template name="chopPunctuation">
850                 <xsl:with-param name="chopString">
851                     <xsl:call-template name="subfieldSelect">
852                         <xsl:with-param name="codes">bc</xsl:with-param>
853                     </xsl:call-template>
854                 </xsl:with-param>
855             </xsl:call-template>
856         </xsl:if>
857     </xsl:template>
858
859     <xsl:template name="part">
860         <xsl:variable name="partNumber">
861             <xsl:call-template name="specialSubfieldSelect">
862                 <xsl:with-param name="axis">n</xsl:with-param>
863                 <xsl:with-param name="anyCodes">n</xsl:with-param>
864                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
865             </xsl:call-template>
866         </xsl:variable>
867         <xsl:variable name="partName">
868             <xsl:call-template name="specialSubfieldSelect">
869                 <xsl:with-param name="axis">p</xsl:with-param>
870                 <xsl:with-param name="anyCodes">p</xsl:with-param>
871                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
872             </xsl:call-template>
873         </xsl:variable>
874         <xsl:if test="string-length(normalize-space($partNumber))">
875                 <xsl:call-template name="chopPunctuation">
876                     <xsl:with-param name="chopString" select="$partNumber"/>
877                 </xsl:call-template>
878         </xsl:if>
879         <xsl:if test="string-length(normalize-space($partName))">
880                 <xsl:call-template name="chopPunctuation">
881                     <xsl:with-param name="chopString" select="$partName"/>
882                 </xsl:call-template>
883         </xsl:if>
884     </xsl:template>
885
886     <xsl:template name="specialSubfieldSelect">
887         <xsl:param name="anyCodes"/>
888         <xsl:param name="axis"/>
889         <xsl:param name="beforeCodes"/>
890         <xsl:param name="afterCodes"/>
891         <xsl:variable name="str">
892             <xsl:for-each select="marc:subfield">
893                 <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])">
894                     <xsl:value-of select="text()"/>
895                     <xsl:text> </xsl:text>
896                 </xsl:if>
897             </xsl:for-each>
898         </xsl:variable>
899         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
900     </xsl:template>
901 </xsl:stylesheet>