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