Bug 15100: MARC21 - make display of "Dates associated with a name" optional
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
6 <!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com  -->
7 <xsl:stylesheet version="1.0"
8   xmlns:marc="http://www.loc.gov/MARC21/slim"
9   xmlns:items="http://www.koha-community.org/items"
10   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11   exclude-result-prefixes="marc items">
12     <xsl:import href="MARC21slimUtils.xsl"/>
13     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
14     <xsl:template match="/">
15             <xsl:apply-templates/>
16     </xsl:template>
17
18     <xsl:template match="marc:record">
19
20         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
21         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
22         <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
23         <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
24         <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
25         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
26         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
27         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
28         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
29         <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
30         <xsl:variable name="TracingQuotesLeft">
31            <xsl:choose>
32              <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
33              <xsl:otherwise>"</xsl:otherwise>
34            </xsl:choose>
35         </xsl:variable>
36         <xsl:variable name="TracingQuotesRight">
37           <xsl:choose>
38             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
39             <xsl:otherwise>"</xsl:otherwise>
40           </xsl:choose>
41         </xsl:variable>
42         <xsl:variable name="leader" select="marc:leader"/>
43         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
44         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
45         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
46         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
47         <xsl:variable name="materialTypeCode">
48             <xsl:choose>
49                 <xsl:when test="$leader19='a'">ST</xsl:when>
50                 <xsl:when test="$leader6='a'">
51                     <xsl:choose>
52                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
53                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
54                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
55                     </xsl:choose>
56                 </xsl:when>
57                 <xsl:when test="$leader6='t'">BK</xsl:when>
58                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
59                 <xsl:when test="$leader6='m'">CF</xsl:when>
60                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
61                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
62                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
63                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
64             </xsl:choose>
65         </xsl:variable>
66         <xsl:variable name="materialTypeLabel">
67             <xsl:choose>
68                 <xsl:when test="$leader19='a'">Set</xsl:when>
69                 <xsl:when test="$leader6='a'">
70                     <xsl:choose>
71                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
72                         <xsl:when test="$leader7='i' or $leader7='s'">
73                             <xsl:choose>
74                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
75                                 <xsl:otherwise>Series</xsl:otherwise>
76                             </xsl:choose>
77                         </xsl:when>
78                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
79                     </xsl:choose>
80                 </xsl:when>
81                 <xsl:when test="$leader6='t'">Book</xsl:when>
82                 <xsl:when test="$leader6='o'">Kit</xsl:when>                            
83                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
84                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
85                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
86                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual material</xsl:when>
87                 <xsl:when test="$leader6='j'">Music</xsl:when>
88                 <xsl:when test="$leader6='i'">Sound</xsl:when>
89                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
90             </xsl:choose>
91         </xsl:variable>
92
93         <!-- Title Statement -->
94         <!-- Alternate Graphic Representation (MARC 880) -->
95         <xsl:if test="$display880">
96             <h1 class="title">
97                 <xsl:call-template name="m880Select">
98                     <xsl:with-param name="basetags">245</xsl:with-param>
99                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
100                 </xsl:call-template>
101             </h1>
102         </xsl:if>
103
104         <!--Bug 13381 -->
105         <xsl:if test="marc:datafield[@tag=245]">
106             <h1 class="title" property="name">
107                 <xsl:for-each select="marc:datafield[@tag=245]">
108                     <xsl:call-template name="subfieldSelect">
109                         <xsl:with-param name="codes">a</xsl:with-param>
110                     </xsl:call-template>
111                     <xsl:text> </xsl:text>
112                     <!-- 13381 add additional subfields-->
113                     <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
114                         <xsl:choose>
115                             <xsl:when test="@code='h'">
116                                 <!--  13381 Span class around subfield h so it can be suppressed via css -->
117                                 <span class="title_medium"><xsl:apply-templates/> </span>
118                             </xsl:when>
119                             <xsl:when test="@code='c'">
120                                 <!--  13381 Span class around subfield c so it can be suppressed via css -->
121                                 <span class="title_resp_stmt"><xsl:apply-templates/> </span>
122                             </xsl:when>
123                             <xsl:otherwise>
124                                 <xsl:apply-templates/>
125                                 <xsl:text> </xsl:text>
126                             </xsl:otherwise>
127                         </xsl:choose>
128                     </xsl:for-each>
129                 </xsl:for-each>
130             </h1>
131         </xsl:if>
132
133         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
134         <xsl:if test="$display880">
135             <h5 class="author">
136                 <xsl:call-template name="m880Select">
137                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
138                     <xsl:with-param name="codes">abc</xsl:with-param>
139                     <xsl:with-param name="index">au</xsl:with-param>
140                     <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
141                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
142                 </xsl:call-template>
143             </h5>
144         </xsl:if>
145
146         <!-- Author Statement -->
147         <xsl:call-template name="showAuthor">
148             <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
149             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
150         </xsl:call-template>
151
152         <!-- #13382 Suppress 700$i and 7xx/@ind2=2 -->
153         <xsl:call-template name="showAuthor">
154             <xsl:with-param name="authorfield" select="marc:datafield[(@tag=700 or @tag=710 or @tag=711) and not(@ind2=2) and not(marc:subfield[@code='i'])]"/>
155             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
156         </xsl:call-template>
157
158     <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
159         <span class="results_summary type"><span class="label">Material type: </span>
160         <xsl:element name="img"><xsl:attribute name="src">/intranet-tmpl/prog/img/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
161         <xsl:text> </xsl:text>
162         <xsl:value-of select="$materialTypeLabel"/>
163         </span>
164     </xsl:if>
165
166
167         <!--Series: Alternate Graphic Representation (MARC 880) -->
168         <xsl:if test="$display880">
169             <xsl:call-template name="m880Select">
170                 <xsl:with-param name="basetags">440,490</xsl:with-param>
171                 <xsl:with-param name="codes">av</xsl:with-param>
172                 <xsl:with-param name="class">results_summary series</xsl:with-param>
173                 <xsl:with-param name="label">Series: </xsl:with-param>
174                 <xsl:with-param name="index">se</xsl:with-param>
175             </xsl:call-template>
176         </xsl:if>
177         
178         <!-- Series -->
179         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
180         <span class="results_summary series"><span class="label">Series: </span>
181         <!-- 440 -->
182         <xsl:for-each select="marc:datafield[@tag=440]">
183             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
184             <xsl:call-template name="chopPunctuation">
185                             <xsl:with-param name="chopString">
186                                 <xsl:call-template name="subfieldSelect">
187                                     <xsl:with-param name="codes">av</xsl:with-param>
188                                 </xsl:call-template>
189                             </xsl:with-param>
190                         </xsl:call-template>
191             </a>
192             <xsl:call-template name="part"/>
193             <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
194         </xsl:for-each>
195
196         <!-- 490 Series not traced, Ind1 = 0 -->
197         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
198             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
199                         <xsl:call-template name="chopPunctuation">
200                             <xsl:with-param name="chopString">
201                                 <xsl:call-template name="subfieldSelect">
202                                     <xsl:with-param name="codes">av</xsl:with-param>
203                                 </xsl:call-template>
204                             </xsl:with-param>
205                         </xsl:call-template>
206             </a>
207                     <xsl:call-template name="part"/>
208         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
209         </xsl:for-each>
210         <!-- 490 Series traced, Ind1 = 1 -->
211         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
212             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
213                 <xsl:choose>
214                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
215                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
216                             <xsl:call-template name="chopPunctuation">
217                                 <xsl:with-param name="chopString">
218                                     <xsl:call-template name="subfieldSelect">
219                                         <xsl:with-param name="codes">a_t</xsl:with-param>
220                                     </xsl:call-template>
221                                 </xsl:with-param>
222                             </xsl:call-template>
223                         </a>
224                     </xsl:when>
225                     <xsl:otherwise>
226                         <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
227                             <xsl:call-template name="chopPunctuation">
228                                 <xsl:with-param name="chopString">
229                                     <xsl:call-template name="subfieldSelect">
230                                         <xsl:with-param name="codes">a_t</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:otherwise>
237                 </xsl:choose>
238                 <xsl:text>: </xsl:text>
239                 <xsl:value-of  select="marc:subfield[@code='v']" />
240             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
241             </xsl:for-each>
242         </xsl:if>
243
244         </span>
245         </xsl:if>
246
247         <!-- Analytics -->
248         <xsl:if test="$leader7='s'">
249         <span class="results_summary analytics"><span class="label">Analytics: </span>
250             <a>
251             <xsl:choose>
252             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
253                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
254             </xsl:when>
255             <xsl:otherwise>
256                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
257             </xsl:otherwise>
258             </xsl:choose>
259             <xsl:text>Show analytics</xsl:text>
260             </a>
261         </span>
262         </xsl:if>
263
264         <!-- Volumes of sets and traced series -->
265         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
266         <span class="results_summary volumes"><span class="label">Volumes: </span>
267             <a>
268             <xsl:choose>
269             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
270                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute>
271             </xsl:when>
272             <xsl:otherwise>
273                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
274             </xsl:otherwise>
275             </xsl:choose>
276             <xsl:text>Show volumes</xsl:text>
277             </a>
278         </span>
279         </xsl:if>
280
281         <!-- Set -->
282         <xsl:if test="$leader19='c'">
283         <span class="results_summary set"><span class="label">Set: </span>
284         <xsl:for-each select="marc:datafield[@tag=773]">
285             <a>
286             <xsl:choose>
287             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
288                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
289             </xsl:when>
290             <xsl:otherwise>
291                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
292             </xsl:otherwise>
293             </xsl:choose>
294             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
295             </a>
296             <xsl:choose>
297                 <xsl:when test="position()=last()"></xsl:when>
298                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
299             </xsl:choose>
300         </xsl:for-each>
301         </span>
302         </xsl:if>
303
304         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
305         <xsl:if test="$display880">
306             <xsl:call-template name="m880Select">
307                 <xsl:with-param name="basetags">260</xsl:with-param>
308                 <xsl:with-param name="codes">abcg</xsl:with-param>
309                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
310                 <xsl:with-param name="label">Publisher: </xsl:with-param>
311             </xsl:call-template>
312         </xsl:if>
313
314         <!-- Publisher info and RDA related info from tags 260, 264 -->
315         <xsl:choose>
316             <xsl:when test="marc:datafield[@tag=264]">
317                 <xsl:call-template name="showRDAtag264"/>
318             </xsl:when>
319             <xsl:when test="marc:datafield[@tag=260]">
320                 <span class="results_summary publisher"><span class="label">Publisher: </span>
321                     <xsl:for-each select="marc:datafield[@tag=260]">
322                         <xsl:if test="marc:subfield[@code='a']">
323                             <xsl:call-template name="subfieldSelect">
324                                 <xsl:with-param name="codes">a</xsl:with-param>
325                             </xsl:call-template>
326                         </xsl:if>
327                         <xsl:text> </xsl:text>
328                         <xsl:if test="marc:subfield[@code='b']">
329                         <a href="/cgi-bin/koha/catalogue/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">cg</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:when>
347         </xsl:choose>
348
349         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
350         <xsl:if test="$display880">
351             <xsl:call-template name="m880Select">
352                 <xsl:with-param name="basetags">250</xsl:with-param>
353                 <xsl:with-param name="codes">ab</xsl:with-param>
354                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
355                 <xsl:with-param name="label">Edition: </xsl:with-param>
356             </xsl:call-template>
357         </xsl:if>
358         
359         <xsl:if test="marc:datafield[@tag=250]">
360         <span class="results_summary edition"><span class="label">Edition: </span>
361             <xsl:for-each select="marc:datafield[@tag=250]">
362                 <xsl:call-template name="chopPunctuation">
363                   <xsl:with-param name="chopString">
364                     <xsl:call-template name="subfieldSelect">
365                         <xsl:with-param name="codes">ab</xsl:with-param>
366                     </xsl:call-template>
367                    </xsl:with-param>
368                </xsl:call-template>
369                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
370             </xsl:for-each>
371         </span>
372         </xsl:if>
373
374         <!-- Description: Alternate Graphic Representation (MARC 880) -->
375         <xsl:if test="$display880">
376             <xsl:call-template name="m880Select">
377                 <xsl:with-param name="basetags">300</xsl:with-param>
378                 <xsl:with-param name="codes">abceg</xsl:with-param>
379                 <xsl:with-param name="class">results_summary description</xsl:with-param>
380                 <xsl:with-param name="label">Description: </xsl:with-param>
381             </xsl:call-template>
382         </xsl:if>
383         
384         <xsl:if test="marc:datafield[@tag=300]">
385         <span class="results_summary description"><span class="label">Description: </span>
386             <xsl:for-each select="marc:datafield[@tag=300]">
387                 <xsl:call-template name="chopPunctuation">
388                   <xsl:with-param name="chopString">
389                     <xsl:call-template name="subfieldSelect">
390                         <xsl:with-param name="codes">abceg</xsl:with-param>
391                     </xsl:call-template>
392                    </xsl:with-param>
393                </xsl:call-template>
394                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
395             </xsl:for-each>
396         </span>
397        </xsl:if>
398
399         <!-- Content Type -->
400         <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
401             <span class="results_summary" id="content_type">
402                 <xsl:if test="marc:datafield[@tag=336]">
403                     <span class="label">Content type: </span>
404                     <xsl:for-each select="marc:datafield[@tag=336]">
405                         <xsl:call-template name="subfieldSelect">
406                             <xsl:with-param name="codes">a</xsl:with-param>
407                             <xsl:with-param name="delimeter">, </xsl:with-param>
408                         </xsl:call-template>
409                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
410                     </xsl:for-each>
411                 </xsl:if>
412                 <xsl:text> </xsl:text>
413                 <!-- Media Type -->
414                 <xsl:if test="marc:datafield[@tag=337]">
415                     <span class="label">Media type: </span>
416                     <xsl:for-each select="marc:datafield[@tag=337]">
417                         <xsl:call-template name="subfieldSelect">
418                             <xsl:with-param name="codes">a</xsl:with-param>
419                             <xsl:with-param name="delimeter">, </xsl:with-param>
420                         </xsl:call-template>
421                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
422                     </xsl:for-each>
423                 </xsl:if>
424                 <xsl:text> </xsl:text>
425                 <!-- Media Type -->
426                 <xsl:if test="marc:datafield[@tag=338]">
427                     <span class="label">Carrier type: </span>
428                     <xsl:for-each select="marc:datafield[@tag=338]">
429                         <xsl:call-template name="subfieldSelect">
430                             <xsl:with-param name="codes">a</xsl:with-param>
431                             <xsl:with-param name="delimeter">, </xsl:with-param>
432                         </xsl:call-template>
433                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
434                     </xsl:for-each>
435                 </xsl:if>
436             </span>
437         </xsl:if>
438
439
440         <!-- Build ISBN -->
441         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
442           <span class="results_summary isbn"><span class="label">ISBN: </span>
443             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
444               <span property="isbn">
445                 <xsl:value-of select="."/>
446                 <xsl:choose>
447                   <xsl:when test="position()=last()">
448                     <xsl:text>.</xsl:text>
449                   </xsl:when>
450                   <xsl:otherwise>
451                     <xsl:text>; </xsl:text>
452                   </xsl:otherwise>
453                 </xsl:choose>
454               </span>
455             </xsl:for-each>
456           </span>
457         </xsl:if>
458
459         <!-- Build ISSN -->
460         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
461           <span class="results_summary issn"><span class="label">ISSN: </span>
462             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
463               <span property="issn">
464                 <xsl:value-of select="."/>
465                 <xsl:choose>
466                   <xsl:when test="position()=last()">
467                     <xsl:text>.</xsl:text>
468                   </xsl:when>
469                   <xsl:otherwise>
470                     <xsl:text>; </xsl:text>
471                   </xsl:otherwise>
472                 </xsl:choose>
473               </span>
474             </xsl:for-each>
475           </span>
476         </xsl:if>
477
478         <xsl:if test="marc:datafield[@tag=013]">
479             <span class="results_summary patent_info">
480                 <span class="label">Patent information: </span>
481                 <xsl:for-each select="marc:datafield[@tag=013]">
482                     <xsl:call-template name="subfieldSelect">
483                         <xsl:with-param name="codes">acdef</xsl:with-param>
484                         <xsl:with-param name="delimeter">, </xsl:with-param>
485                     </xsl:call-template>
486                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
487                 </xsl:for-each>
488             </span>
489         </xsl:if>
490
491         <xsl:if test="marc:datafield[@tag=088]">
492             <span class="results_summary report_number">
493                 <span class="label">Report number: </span>
494                 <xsl:for-each select="marc:datafield[@tag=088]">
495                     <xsl:call-template name="subfieldSelect">
496                         <xsl:with-param name="codes">a</xsl:with-param>
497                     </xsl:call-template>
498                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
499                 </xsl:for-each>
500             </span>
501         </xsl:if>
502
503         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
504         <xsl:if test="$display880">
505             <xsl:call-template name="m880Select">
506                 <xsl:with-param name="basetags">246</xsl:with-param>
507                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
508                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
509                 <xsl:with-param name="label">Other title: </xsl:with-param>
510             </xsl:call-template>
511         </xsl:if>
512
513         <xsl:if test="marc:datafield[@tag=246]">
514             <span class="results_summary other_title"><span class="label">Other title: </span>
515                 <xsl:for-each select="marc:datafield[@tag=246]">
516                     <xsl:call-template name="chopPunctuation">
517                         <xsl:with-param name="chopString">
518                             <xsl:call-template name="subfieldSelect">
519                                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
520                             </xsl:call-template>
521                         </xsl:with-param>
522                     </xsl:call-template>
523                     <xsl:if test="@ind1=1 and not(marc:subfield[@code='i'])">
524                         <xsl:choose>
525                             <xsl:when test="@ind2=0"> [Portion of title]</xsl:when>
526                             <xsl:when test="@ind2=1"> [Parallel title]</xsl:when>
527                             <xsl:when test="@ind2=2"> [Distinctive title]</xsl:when>
528                             <xsl:when test="@ind2=3"> [Other title]</xsl:when>
529                             <xsl:when test="@ind2=4"> [Cover title]</xsl:when>
530                             <xsl:when test="@ind2=5"> [Added title page title]</xsl:when>
531                             <xsl:when test="@ind2=6"> [Caption title]</xsl:when>
532                             <xsl:when test="@ind2=7"> [Running title]</xsl:when>
533                             <xsl:when test="@ind2=8"> [Spine title]</xsl:when>
534                         </xsl:choose>
535                     </xsl:if>
536                     <xsl:if test="marc:subfield[@code='i']">
537                         <xsl:value-of select="concat(' [',marc:subfield[@code='i'],']')"/>
538                     </xsl:if>
539                     <!-- #13386 added separator | -->
540                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise></xsl:choose>
541                 </xsl:for-each>
542             </span>
543         </xsl:if>
544
545         <xsl:if test="marc:datafield[@tag=242]">
546         <span class="results_summary translated_title"><span class="label">Title translated: </span>
547             <xsl:for-each select="marc:datafield[@tag=242]">
548                 <xsl:call-template name="chopPunctuation">
549                   <xsl:with-param name="chopString">
550                     <xsl:call-template name="subfieldSelect">
551                         <xsl:with-param name="codes">abchnp</xsl:with-param>
552                     </xsl:call-template>
553                    </xsl:with-param>
554                </xsl:call-template>
555                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
556             </xsl:for-each>
557         </span>
558        </xsl:if>
559
560         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
561         <xsl:if test="$display880">
562             <xsl:call-template name="m880Select">
563                 <xsl:with-param name="basetags">130,240</xsl:with-param>
564                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
565                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
566                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
567             </xsl:call-template>
568         </xsl:if>
569
570         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
571             <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
572                 <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
573                     <xsl:for-each select="marc:subfield">
574                         <xsl:if test="contains('adfghklmnoprst',@code)">
575                             <xsl:value-of select="text()"/>
576                             <xsl:text> </xsl:text>
577                         </xsl:if>
578                     </xsl:for-each>
579                     <xsl:if test="position() != last()">
580                         <span class="separator"><xsl:text> | </xsl:text></span>
581                     </xsl:if>
582                 </xsl:for-each>
583             </span>
584         </xsl:if>
585
586         <!-- #13382 Added Related works 700$i -->
587         <xsl:if test="marc:datafield[@tag=700][marc:subfield[@code='i']] or marc:datafield[@tag=710][marc:subfield[@code='i']] or marc:datafield[@tag=711][marc:subfield[@code='i']]">
588             <span class="results_summary related_works"><span class="label">Related works: </span>
589                 <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='i']] | marc:datafield[@tag=710][marc:subfield[@code='i']] | marc:datafield[@tag=711][marc:subfield[@code='i']]">
590                     <xsl:variable name="str">
591                         <xsl:call-template name="subfieldSelect">
592                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
593                         </xsl:call-template>
594                     </xsl:variable>
595                     <xsl:call-template name="chopPunctuation">
596                         <xsl:with-param name="chopString">
597                             <xsl:value-of select="$str"/>
598                         </xsl:with-param>
599                     </xsl:call-template>
600                     <!-- add relator code too between brackets-->
601                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
602                         <span class="relatorcode">
603                             <xsl:text> [</xsl:text>
604                             <xsl:choose>
605                                 <xsl:when test="marc:subfield[@code='e']">
606                                     <xsl:for-each select="marc:subfield[@code='e']">
607                                         <xsl:value-of select="."/>
608                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
609                                     </xsl:for-each>
610                                 </xsl:when>
611                                 <xsl:otherwise>
612                                     <xsl:for-each select="marc:subfield[@code='4']">
613                                         <xsl:value-of select="."/>
614                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
615                                     </xsl:for-each>
616                                 </xsl:otherwise>
617                             </xsl:choose>
618                             <xsl:text>]</xsl:text>
619                         </span>
620                     </xsl:if>
621                     <xsl:choose>
622                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
623                     </xsl:choose>
624                 </xsl:for-each>
625             </span>
626         </xsl:if>
627
628         <!-- #13382 Added Contained Works 7xx@ind2=2 -->
629         <xsl:if test="marc:datafield[@tag=700][@ind2=2 and not(marc:subfield[@code='i'])] or marc:datafield[@tag=710][@ind2=2 and not(marc:subfield[@code='i'])] or marc:datafield[@tag=711][@ind2=2 and not(marc:subfield[@code='i'])]">
630             <span class="results_summary contained_works"><span class="label">Contained works: </span>
631                 <xsl:for-each select="marc:datafield[@tag=700][@ind2=2][not(marc:subfield[@code='i'])] | marc:datafield[@tag=710][@ind2=2][not(marc:subfield[@code='i'])] | marc:datafield[@tag=711][@ind2=2][not(marc:subfield[@code='i'])]">
632                     <xsl:variable name="str">
633                         <xsl:call-template name="subfieldSelect">
634                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
635                         </xsl:call-template>
636                     </xsl:variable>
637                     <xsl:call-template name="chopPunctuation">
638                         <xsl:with-param name="chopString">
639                             <xsl:value-of select="$str"/>
640                         </xsl:with-param>
641                     </xsl:call-template>
642                     <!-- add relator code too between brackets-->
643                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
644                         <span class="relatorcode">
645                             <xsl:text> [</xsl:text>
646                             <xsl:choose>
647                                 <xsl:when test="marc:subfield[@code='e']">
648                                     <xsl:for-each select="marc:subfield[@code='e']">
649                                         <xsl:value-of select="."/>
650                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
651                                     </xsl:for-each>
652                                 </xsl:when>
653                                 <xsl:otherwise>
654                                     <xsl:for-each select="marc:subfield[@code='4']">
655                                         <xsl:value-of select="."/>
656                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
657                                     </xsl:for-each>
658                                 </xsl:otherwise>
659                             </xsl:choose>
660                             <xsl:text>]</xsl:text>
661                         </span>
662                     </xsl:if>
663                     <xsl:choose>
664                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
665                     </xsl:choose>
666                 </xsl:for-each>
667             </span>
668         </xsl:if>
669
670
671         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
672             <span class="results_summary subjects"><span class="label">Subject(s): </span>
673             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
674             <a>
675             <xsl:choose>
676             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
677             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
678                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
679             </xsl:when>
680             <xsl:when test="$TraceSubjectSubdivisions='1'">
681                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
682                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
683                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
684                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
685                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
686                     </xsl:call-template>
687                 </xsl:attribute>
688             </xsl:when>
689             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
690             <xsl:otherwise>
691                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
692             </xsl:otherwise>
693             </xsl:choose>
694             <xsl:call-template name="chopPunctuation">
695                 <xsl:with-param name="chopString">
696                     <xsl:call-template name="subfieldSelect">
697                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
698                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
699                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
700                     </xsl:call-template>
701                 </xsl:with-param>
702             </xsl:call-template>
703             </a>
704             <xsl:choose>
705             <xsl:when test="position()=last()"></xsl:when>
706             <xsl:otherwise> | </xsl:otherwise>
707             </xsl:choose>
708
709             </xsl:for-each>
710             </span>
711         </xsl:if>
712
713         <!-- Genre/Form -->
714         <xsl:if test="marc:datafield[@tag=655]">
715             <span class="results_summary genre"><span class="label">Genre/Form: </span>
716                 <xsl:for-each select="marc:datafield[@tag=655]">
717                     <a>
718                         <xsl:choose>
719                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
720                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
721                             </xsl:when>
722                             <xsl:when test="$TraceSubjectSubdivisions='1'">
723                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
724                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
725                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
726                                     <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
727                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
728                                 </xsl:call-template>
729                                 </xsl:attribute>
730                             </xsl:when>
731                             <xsl:otherwise>
732                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
733                             </xsl:otherwise>
734                         </xsl:choose>
735                     <xsl:call-template name="subfieldSelect">
736                         <xsl:with-param name="codes">avxyz</xsl:with-param>
737                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
738                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
739                     </xsl:call-template>
740                     </a>
741                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
742                 </xsl:for-each>
743             </span>
744         </xsl:if>
745
746 <!-- DDC classification -->
747     <xsl:if test="marc:datafield[@tag=082]">
748         <span class="results_summary ddc">
749             <span class="label">DDC classification: </span>
750             <xsl:for-each select="marc:datafield[@tag=082]">
751                 <xsl:call-template name="subfieldSelect">
752                     <xsl:with-param name="codes">a</xsl:with-param>
753                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
754                 </xsl:call-template>
755                 <xsl:choose>
756                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
757                     <xsl:otherwise> | </xsl:otherwise>
758                 </xsl:choose>
759             </xsl:for-each>
760         </span>
761     </xsl:if>
762
763         <xsl:if test="marc:datafield[@tag=856]">
764         <span class="results_summary online_resources"><span class="label">Online resources: </span>
765         <xsl:for-each select="marc:datafield[@tag=856]">
766                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
767                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
768                                     <xsl:choose>
769                                     <xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
770                                         <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="height">100</xsl:attribute></xsl:element><xsl:text></xsl:text>
771                                     </xsl:when>
772                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
773                                         <xsl:call-template name="subfieldSelect">
774                                         <xsl:with-param name="codes">y3z</xsl:with-param>
775                                         </xsl:call-template>
776                                     </xsl:when>
777                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
778                                         <xsl:choose>
779                                         <xsl:when test="$URLLinkText!=''">
780                                                 <xsl:value-of select="$URLLinkText"/>
781                                         </xsl:when>
782                                         <xsl:otherwise>
783                                                 <xsl:text>Click here to access online</xsl:text>
784                                         </xsl:otherwise>
785                                         </xsl:choose>
786                                     </xsl:when>
787                                     </xsl:choose>
788                                     </a>
789                                     <xsl:choose>
790                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
791                                     <xsl:otherwise> | </xsl:otherwise>
792                                     </xsl:choose>
793
794         </xsl:for-each>
795         </span>
796         </xsl:if>
797         <xsl:if test="marc:datafield[@tag=505]">
798             <div class="results_summary contents">
799             <xsl:choose>
800             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
801                 <span class="label">Contents:</span>
802             </xsl:when>
803             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
804                 <span class="label">Incomplete contents:</span>
805             </xsl:when>
806             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
807                 <span class="label">Partial contents:</span>
808             </xsl:when>
809             </xsl:choose>
810                 <xsl:for-each select="marc:datafield[@tag=505]">
811                     <div class='contentblock'>
812                         <xsl:choose>
813                         <xsl:when test="@ind2=0">
814                             <xsl:call-template name="subfieldSelectSpan">
815                                 <xsl:with-param name="codes">tru</xsl:with-param>
816                             </xsl:call-template>
817                         </xsl:when>
818                         <xsl:otherwise>
819                             <xsl:call-template name="subfieldSelectSpan">
820                                 <xsl:with-param name="codes">atru</xsl:with-param>
821                             </xsl:call-template>
822                         </xsl:otherwise>
823                         </xsl:choose>
824                     </div>
825                 </xsl:for-each>
826             </div>
827         </xsl:if>
828
829         <!-- 586 -->
830         <xsl:if test="marc:datafield[@tag=586]">
831             <span class="results_summary awardsnote">
832                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
833                     <span class="label">Awards: </span>
834                 </xsl:if>
835                 <xsl:for-each select="marc:datafield[@tag=586]">
836                     <xsl:value-of select="marc:subfield[@code='a']"/>
837                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
838                 </xsl:for-each>
839             </span>
840         </xsl:if>
841
842         <!-- 508 -->
843         <xsl:if test="marc:datafield[@tag=508]">
844             <div class="results_summary prod_credits">
845                 <span class="label">Production credits: </span>
846                 <xsl:for-each select="marc:datafield[@tag=508]">
847                     <xsl:call-template name="subfieldSelectSpan">
848                         <xsl:with-param name="codes">a</xsl:with-param>
849                     </xsl:call-template>
850                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
851                 </xsl:for-each>
852             </div>
853         </xsl:if>
854
855         <!-- 773 -->
856         <xsl:if test="marc:datafield[@tag=773]">
857         <xsl:for-each select="marc:datafield[@tag=773]">
858         <xsl:if test="@ind1 !=1">
859         <span class="results_summary in"><span class="label">
860         <xsl:choose>
861         <xsl:when test="@ind2=' '">
862             In:
863         </xsl:when>
864         <xsl:when test="@ind2=8">
865             <xsl:if test="marc:subfield[@code='i']">
866                 <xsl:value-of select="marc:subfield[@code='i']"/>
867             </xsl:if>
868         </xsl:when>
869         </xsl:choose>
870         </span>
871                 <xsl:variable name="f773">
872                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
873                         <xsl:with-param name="codes">a_t</xsl:with-param>
874                     </xsl:call-template></xsl:with-param></xsl:call-template>
875                 </xsl:variable>
876             <xsl:choose>
877                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
878                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
879                         <xsl:value-of select="translate($f773, '()', '')"/>
880                     </a>
881                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
882                 </xsl:when>
883                 <xsl:when test="marc:subfield[@code='0']">
884                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
885                         <xsl:value-of select="$f773"/>
886                     </a>
887                 </xsl:when>
888                 <xsl:otherwise>
889                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
890                         <xsl:value-of select="$f773"/>
891                     </a>
892                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
893                 </xsl:otherwise>
894             </xsl:choose>
895         </span>
896
897         <xsl:if test="marc:subfield[@code='n']">
898             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
899         </xsl:if>
900
901         </xsl:if>
902         </xsl:for-each>
903         </xsl:if>
904
905         <xsl:if test="marc:datafield[@tag=502]">
906             <span class="results_summary diss_note">
907                 <span class="label">Dissertation note: </span>
908                 <xsl:for-each select="marc:datafield[@tag=502]">
909                     <xsl:call-template name="subfieldSelect">
910                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
911                     </xsl:call-template>
912                 </xsl:for-each>
913                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
914             </span>
915         </xsl:if>
916
917         <!-- 866 textual holdings -->
918         <xsl:if test="marc:datafield[@tag=866]">
919             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
920                 <xsl:for-each select="marc:datafield[@tag=866]">
921                     <xsl:call-template name="subfieldSelect">
922                         <xsl:with-param name="codes">axz</xsl:with-param>
923                     </xsl:call-template>
924                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
925                 </xsl:for-each>
926             </span>
927         </xsl:if>
928
929         <!--  775 Other Edition  -->
930         <xsl:if test="marc:datafield[@tag=775]">
931         <span class="results_summary other_editions"><span class="label">Other editions: </span>
932         <xsl:for-each select="marc:datafield[@tag=775]">
933             <xsl:variable name="f775">
934                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
935                 <xsl:with-param name="codes">a_t</xsl:with-param>
936                 </xsl:call-template></xsl:with-param></xsl:call-template>
937             </xsl:variable>
938             <xsl:if test="marc:subfield[@code='i']">
939                 <xsl:call-template name="subfieldSelect">
940                     <xsl:with-param name="codes">i</xsl:with-param>
941                 </xsl:call-template>
942                 <xsl:text>: </xsl:text>
943             </xsl:if>
944             <a>
945             <xsl:choose>
946             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
947                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
948             </xsl:when>
949             <xsl:otherwise>
950                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
951             </xsl:otherwise>
952             </xsl:choose>
953             <xsl:call-template name="subfieldSelect">
954                 <xsl:with-param name="codes">a_t</xsl:with-param>
955             </xsl:call-template>
956             </a>
957             <xsl:choose>
958                 <xsl:when test="position()=last()"></xsl:when>
959                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
960             </xsl:choose>
961         </xsl:for-each>
962         </span>
963         </xsl:if>
964
965         <!-- 780 -->
966         <xsl:if test="marc:datafield[@tag=780]">
967         <xsl:for-each select="marc:datafield[@tag=780]">
968         <xsl:if test="@ind1=0">
969         <span class="results_summary preceeding_entry">
970         <xsl:choose>
971         <xsl:when test="@ind2=0">
972             <span class="label">Continues:</span>
973         </xsl:when>
974         <xsl:when test="@ind2=1">
975             <span class="label">Continues in part:</span>
976         </xsl:when>
977         <xsl:when test="@ind2=2">
978             <span class="label">Supersedes:</span>
979         </xsl:when>
980         <xsl:when test="@ind2=3">
981             <span class="label">Supersedes in part:</span>
982         </xsl:when>
983         <xsl:when test="@ind2=4">
984             <span class="label">Formed by the union: ... and: ...</span>
985         </xsl:when>
986         <xsl:when test="@ind2=5">
987             <span class="label">Absorbed:</span>
988         </xsl:when>
989         <xsl:when test="@ind2=6">
990             <span class="label">Absorbed in part:</span>
991         </xsl:when>
992         <xsl:when test="@ind2=7">
993             <span class="label">Separated from:</span>
994         </xsl:when>
995         </xsl:choose>
996         <xsl:text> </xsl:text>
997                 <xsl:variable name="f780">
998                     <xsl:call-template name="subfieldSelect">
999                         <xsl:with-param name="codes">a_t</xsl:with-param>
1000                     </xsl:call-template>
1001                 </xsl:variable>
1002             <xsl:choose>
1003                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1004                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
1005                         <xsl:value-of select="translate($f780, '()', '')"/>
1006                     </a>
1007                 </xsl:when>
1008                 <xsl:otherwise>
1009                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
1010                         <xsl:value-of select="translate($f780, '()', '')"/>
1011                     </a>
1012                 </xsl:otherwise>
1013             </xsl:choose>
1014         </span>
1015  
1016         <xsl:if test="marc:subfield[@code='n']">
1017             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1018         </xsl:if>
1019
1020         </xsl:if>
1021         </xsl:for-each>
1022         </xsl:if>
1023
1024         <!-- 785 -->
1025         <xsl:if test="marc:datafield[@tag=785]">
1026         <xsl:for-each select="marc:datafield[@tag=785]">
1027         <span class="results_summary succeeding_entry">
1028         <xsl:choose>
1029         <xsl:when test="@ind2=0">
1030             <span class="label">Continued by:</span>
1031         </xsl:when>
1032         <xsl:when test="@ind2=1">
1033             <span class="label">Continued in part by:</span>
1034         </xsl:when>
1035         <xsl:when test="@ind2=2">
1036             <span class="label">Superseded by:</span>
1037         </xsl:when>
1038         <xsl:when test="@ind2=3">
1039             <span class="label">Superseded in part by:</span>
1040         </xsl:when>
1041         <xsl:when test="@ind2=4">
1042             <span class="label">Absorbed by:</span>
1043         </xsl:when>
1044         <xsl:when test="@ind2=5">
1045             <span class="label">Absorbed in part by:</span>
1046         </xsl:when>
1047         <xsl:when test="@ind2=6">
1048             <span class="label">Split into .. and ...:</span>
1049         </xsl:when>
1050         <xsl:when test="@ind2=7">
1051             <span class="label">Merged with ... to form ...</span>
1052         </xsl:when>
1053         <xsl:when test="@ind2=8">
1054             <span class="label">Changed back to:</span>
1055         </xsl:when>
1056         </xsl:choose>
1057         <xsl:text> </xsl:text>
1058                    <xsl:variable name="f785">
1059                     <xsl:call-template name="subfieldSelect">
1060                         <xsl:with-param name="codes">a_t</xsl:with-param>
1061                     </xsl:call-template>
1062                 </xsl:variable>
1063
1064             <xsl:choose>
1065                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1066                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
1067                         <xsl:value-of select="translate($f785, '()', '')"/>
1068                     </a>
1069                 </xsl:when>
1070                 <xsl:otherwise>
1071                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
1072                         <xsl:value-of select="translate($f785, '()', '')"/>
1073                     </a>
1074                 </xsl:otherwise>
1075             </xsl:choose>
1076
1077         </span>
1078         </xsl:for-each>
1079         </xsl:if>
1080
1081         <xsl:if test="$OPACBaseURL!=''">
1082         <span class="results_summary"><span class="label">OPAC view: </span>
1083             <a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
1084         </span>
1085         </xsl:if>
1086
1087     </xsl:template>
1088
1089     <xsl:template name="nameABCQ">
1090             <xsl:call-template name="chopPunctuation">
1091                 <xsl:with-param name="chopString">
1092                     <xsl:call-template name="subfieldSelect">
1093                         <xsl:with-param name="codes">abcq</xsl:with-param>
1094                     </xsl:call-template>
1095                 </xsl:with-param>
1096                 <xsl:with-param name="punctuation">
1097                     <xsl:text>:,;/ </xsl:text>
1098                 </xsl:with-param>
1099             </xsl:call-template>
1100     </xsl:template>
1101
1102     <xsl:template name="nameABCDN">
1103             <xsl:call-template name="chopPunctuation">
1104                 <xsl:with-param name="chopString">
1105                     <xsl:call-template name="subfieldSelect">
1106                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1107                     </xsl:call-template>
1108                 </xsl:with-param>
1109                 <xsl:with-param name="punctuation">
1110                     <xsl:text>:,;/ </xsl:text>
1111                 </xsl:with-param>
1112             </xsl:call-template>
1113     </xsl:template>
1114
1115     <xsl:template name="nameACDEQ">
1116             <xsl:call-template name="subfieldSelect">
1117                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1118             </xsl:call-template>
1119     </xsl:template>
1120
1121     <xsl:template name="part">
1122         <xsl:variable name="partNumber">
1123             <xsl:call-template name="specialSubfieldSelect">
1124                 <xsl:with-param name="axis">n</xsl:with-param>
1125                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1126                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1127             </xsl:call-template>
1128         </xsl:variable>
1129         <xsl:variable name="partName">
1130             <xsl:call-template name="specialSubfieldSelect">
1131                 <xsl:with-param name="axis">p</xsl:with-param>
1132                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1133                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1134             </xsl:call-template>
1135         </xsl:variable>
1136         <xsl:if test="string-length(normalize-space($partNumber))">
1137                 <xsl:call-template name="chopPunctuation">
1138                     <xsl:with-param name="chopString" select="$partNumber"/>
1139                 </xsl:call-template>
1140         </xsl:if>
1141         <xsl:if test="string-length(normalize-space($partName))">
1142                 <xsl:call-template name="chopPunctuation">
1143                     <xsl:with-param name="chopString" select="$partName"/>
1144                 </xsl:call-template>
1145         </xsl:if>
1146     </xsl:template>
1147
1148     <xsl:template name="specialSubfieldSelect">
1149         <xsl:param name="anyCodes"/>
1150         <xsl:param name="axis"/>
1151         <xsl:param name="beforeCodes"/>
1152         <xsl:param name="afterCodes"/>
1153         <xsl:variable name="str">
1154             <xsl:for-each select="marc:subfield">
1155                 <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])">
1156                     <xsl:value-of select="text()"/>
1157                     <xsl:text> </xsl:text>
1158                 </xsl:if>
1159             </xsl:for-each>
1160         </xsl:variable>
1161         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1162     </xsl:template>
1163
1164     <xsl:template name="showAuthor">
1165         <xsl:param name="authorfield"/>
1166     <xsl:param name="UseAuthoritiesForTracings"/>
1167         <xsl:if test="count($authorfield)&gt;0">
1168         <h5 class="author">
1169         <xsl:for-each select="$authorfield">
1170         <xsl:choose>
1171           <xsl:when test="position()&gt;1"/>
1172           <!-- #13383 -->
1173           <xsl:when test="@tag&lt;700">By: </xsl:when>
1174           <!--#13382 Changed Additional author to contributor -->
1175           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1176         </xsl:choose>
1177         <a>
1178         <xsl:choose>
1179             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1180                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
1181             </xsl:when>
1182             <xsl:otherwise>
1183             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
1184             </xsl:otherwise>
1185         </xsl:choose>
1186         <xsl:choose>
1187             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1188                 <!-- #13383 -->
1189                 <xsl:call-template name="chopPunctuation">
1190                     <xsl:with-param name="chopString">
1191                         <xsl:call-template name="subfieldSelect">
1192                             <xsl:with-param name="codes">
1193                                 <xsl:choose>
1194                                     <!-- #13383 include subfield e for field 111  -->
1195                                     <xsl:when test="@tag=111">abceqt</xsl:when>
1196                                     <xsl:otherwise>abcjqt</xsl:otherwise>
1197                                 </xsl:choose>
1198                             </xsl:with-param>
1199                         </xsl:call-template>
1200                     </xsl:with-param>
1201                     <xsl:with-param name="punctuation">
1202                         <xsl:text>:,;/ </xsl:text>
1203                     </xsl:with-param>
1204                 </xsl:call-template>
1205             </xsl:when>
1206             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1207             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1208             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1209                 <xsl:variable name="str">
1210                     <xsl:call-template name="subfieldSelect">
1211                         <xsl:with-param name="codes">abcfghiklmnoprstux</xsl:with-param>
1212                     </xsl:call-template>
1213                 </xsl:variable>
1214                 <xsl:call-template name="chopPunctuation">
1215                     <xsl:with-param name="chopString">
1216                         <xsl:value-of select="$str"/>
1217                     </xsl:with-param>
1218                     <xsl:with-param name="punctuation">
1219                         <xsl:text>:,;/. </xsl:text>
1220                     </xsl:with-param>
1221                 </xsl:call-template>
1222             </xsl:when>
1223         </xsl:choose>
1224     <xsl:if test="marc:subfield[@code='d']">
1225         <span class="authordates">
1226             <xsl:text> </xsl:text>
1227             <xsl:value-of select="marc:subfield[@code='d']"/>
1228         </span>
1229     </xsl:if>
1230         <!-- add relator code too between brackets-->
1231     <!-- #13383 include relator code j for field 111 -->
1232             <xsl:if test="marc:subfield[@code='4' or @code='e'][not(parent::*[@tag=111])] or (self::*[@tag=111] and marc:subfield[@code='4' or @code='j'][. != ''])">
1233                 <span class="relatorcode">
1234                     <xsl:text> [</xsl:text>
1235                     <xsl:choose>
1236                         <xsl:when test="@tag=111">
1237                             <xsl:choose>
1238                                 <!-- Prefer j over 4 -->
1239                                 <xsl:when test="marc:subfield[@code='j']">
1240                                     <xsl:for-each select="marc:subfield[@code='j']">
1241                                         <xsl:value-of select="."/>
1242                                         <xsl:if test="position() != last()">, </xsl:if>
1243                                     </xsl:for-each>
1244                                 </xsl:when>
1245                                 <xsl:otherwise>
1246                                     <xsl:for-each select="marc:subfield[@code=4]">
1247                                         <xsl:value-of select="."/>
1248                                         <xsl:if test="position() != last()">, </xsl:if>
1249                                     </xsl:for-each>
1250                                 </xsl:otherwise>
1251                             </xsl:choose>
1252                         </xsl:when>
1253                         <!-- Prefer e over 4 -->
1254                         <xsl:when test="marc:subfield[@code='e']">
1255                             <xsl:for-each select="marc:subfield[@code='e']">
1256                                 <xsl:value-of select="."/>
1257                                 <xsl:if test="position() != last()">, </xsl:if>
1258                             </xsl:for-each>
1259                         </xsl:when>
1260                         <xsl:otherwise>
1261                             <xsl:for-each select="marc:subfield[@code=4]">
1262                                 <xsl:value-of select="."/>
1263                                 <xsl:if test="position() != last()">, </xsl:if>
1264                             </xsl:for-each>
1265                         </xsl:otherwise>
1266                     </xsl:choose>
1267                     <xsl:text>]</xsl:text>
1268                 </span>
1269             </xsl:if>
1270         </a>
1271         <xsl:choose>
1272             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1273         </xsl:choose>
1274         </xsl:for-each>
1275         </h5>
1276
1277         </xsl:if>
1278     </xsl:template>
1279
1280     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1281     <xsl:template name="subfieldSelectSubject">
1282         <xsl:param name="codes"/>
1283         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1284         <xsl:param name="subdivCodes"/>
1285         <xsl:param name="subdivDelimiter"/>
1286         <xsl:param name="prefix"/>
1287         <xsl:param name="suffix"/>
1288         <xsl:variable name="str">
1289             <xsl:for-each select="marc:subfield">
1290                 <xsl:if test="contains($codes, @code)">
1291                     <xsl:if test="contains($subdivCodes, @code)">
1292                         <xsl:value-of select="$subdivDelimiter"/>
1293                     </xsl:if>
1294                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1295                 </xsl:if>
1296             </xsl:for-each>
1297         </xsl:variable>
1298         <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1299     </xsl:template>
1300
1301 </xsl:stylesheet>