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