Bug 13383: 100/110/111 changes to XSLT
[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=260]">
317         <span class="results_summary publisher"><span class="label">Publisher: </span>
318             <xsl:for-each select="marc:datafield[@tag=260]">
319                 <xsl:if test="marc:subfield[@code='a']">
320                     <xsl:call-template name="subfieldSelect">
321                         <xsl:with-param name="codes">a</xsl:with-param>
322                     </xsl:call-template>
323                 </xsl:if>
324                 <xsl:text> </xsl:text>
325                 <xsl:if test="marc:subfield[@code='b']">
326                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
327                     <xsl:call-template name="subfieldSelect">
328                         <xsl:with-param name="codes">b</xsl:with-param>
329                     </xsl:call-template>
330                </a>
331                </xsl:if>
332                <xsl:text> </xsl:text>
333                 <xsl:call-template name="chopPunctuation">
334                   <xsl:with-param name="chopString">
335                     <xsl:call-template name="subfieldSelect">
336                         <xsl:with-param name="codes">cg</xsl:with-param>
337                     </xsl:call-template>
338                    </xsl:with-param>
339                </xsl:call-template>
340                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
341             </xsl:for-each>
342             <xsl:if test="marc:datafield[@tag=264]">
343                 <xsl:text>; </xsl:text>
344                 <xsl:call-template name="showRDAtag264"/>
345             </xsl:if>
346         </span>
347         </xsl:when>
348         <xsl:when test="marc:datafield[@tag=264]">
349             <span class="results_summary">
350                 <xsl:call-template name="showRDAtag264"/>
351             </span>
352         </xsl:when>
353         </xsl:choose>
354
355         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
356         <xsl:if test="$display880">
357             <xsl:call-template name="m880Select">
358                 <xsl:with-param name="basetags">250</xsl:with-param>
359                 <xsl:with-param name="codes">ab</xsl:with-param>
360                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
361                 <xsl:with-param name="label">Edition: </xsl:with-param>
362             </xsl:call-template>
363         </xsl:if>
364         
365         <xsl:if test="marc:datafield[@tag=250]">
366         <span class="results_summary edition"><span class="label">Edition: </span>
367             <xsl:for-each select="marc:datafield[@tag=250]">
368                 <xsl:call-template name="chopPunctuation">
369                   <xsl:with-param name="chopString">
370                     <xsl:call-template name="subfieldSelect">
371                         <xsl:with-param name="codes">ab</xsl:with-param>
372                     </xsl:call-template>
373                    </xsl:with-param>
374                </xsl:call-template>
375                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
376             </xsl:for-each>
377         </span>
378         </xsl:if>
379
380         <!-- Description: Alternate Graphic Representation (MARC 880) -->
381         <xsl:if test="$display880">
382             <xsl:call-template name="m880Select">
383                 <xsl:with-param name="basetags">300</xsl:with-param>
384                 <xsl:with-param name="codes">abceg</xsl:with-param>
385                 <xsl:with-param name="class">results_summary description</xsl:with-param>
386                 <xsl:with-param name="label">Description: </xsl:with-param>
387             </xsl:call-template>
388         </xsl:if>
389         
390         <xsl:if test="marc:datafield[@tag=300]">
391         <span class="results_summary description"><span class="label">Description: </span>
392             <xsl:for-each select="marc:datafield[@tag=300]">
393                 <xsl:call-template name="chopPunctuation">
394                   <xsl:with-param name="chopString">
395                     <xsl:call-template name="subfieldSelect">
396                         <xsl:with-param name="codes">abceg</xsl:with-param>
397                     </xsl:call-template>
398                    </xsl:with-param>
399                </xsl:call-template>
400                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
401             </xsl:for-each>
402         </span>
403        </xsl:if>
404
405         <!-- Content Type -->
406         <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
407             <span class="results_summary" id="content_type">
408                 <xsl:if test="marc:datafield[@tag=336]">
409                     <span class="label">Content Type: </span>
410                     <xsl:for-each select="marc:datafield[@tag=336]">
411                         <xsl:call-template name="subfieldSelect">
412                             <xsl:with-param name="codes">a</xsl:with-param>
413                             <xsl:with-param name="delimeter">, </xsl:with-param>
414                         </xsl:call-template>
415                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
416                     </xsl:for-each>
417                 </xsl:if>
418                 <xsl:text> </xsl:text>
419                 <!-- Media Type -->
420                 <xsl:if test="marc:datafield[@tag=337]">
421                     <span class="label">Media Type: </span>
422                     <xsl:for-each select="marc:datafield[@tag=337]">
423                         <xsl:call-template name="subfieldSelect">
424                             <xsl:with-param name="codes">a</xsl:with-param>
425                             <xsl:with-param name="delimeter">, </xsl:with-param>
426                         </xsl:call-template>
427                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
428                     </xsl:for-each>
429                 </xsl:if>
430                 <xsl:text> </xsl:text>
431                 <!-- Media Type -->
432                 <xsl:if test="marc:datafield[@tag=338]">
433                     <span class="label">Carrier Type: </span>
434                     <xsl:for-each select="marc:datafield[@tag=338]">
435                         <xsl:call-template name="subfieldSelect">
436                             <xsl:with-param name="codes">a</xsl:with-param>
437                             <xsl:with-param name="delimeter">, </xsl:with-param>
438                         </xsl:call-template>
439                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
440                     </xsl:for-each>
441                 </xsl:if>
442             </span>
443         </xsl:if>
444
445
446         <!-- Build ISBN -->
447         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
448           <span class="results_summary isbn"><span class="label">ISBN: </span>
449             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
450               <span property="isbn">
451                 <xsl:value-of select="."/>
452                 <xsl:choose>
453                   <xsl:when test="position()=last()">
454                     <xsl:text>.</xsl:text>
455                   </xsl:when>
456                   <xsl:otherwise>
457                     <xsl:text>; </xsl:text>
458                   </xsl:otherwise>
459                 </xsl:choose>
460               </span>
461             </xsl:for-each>
462           </span>
463         </xsl:if>
464
465         <!-- Build ISSN -->
466         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
467           <span class="results_summary issn"><span class="label">ISSN: </span>
468             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
469               <span property="issn">
470                 <xsl:value-of select="."/>
471                 <xsl:choose>
472                   <xsl:when test="position()=last()">
473                     <xsl:text>.</xsl:text>
474                   </xsl:when>
475                   <xsl:otherwise>
476                     <xsl:text>; </xsl:text>
477                   </xsl:otherwise>
478                 </xsl:choose>
479               </span>
480             </xsl:for-each>
481           </span>
482         </xsl:if>
483
484         <xsl:if test="marc:datafield[@tag=013]">
485             <span class="results_summary patent_info">
486                 <span class="label">Patent information: </span>
487                 <xsl:for-each select="marc:datafield[@tag=013]">
488                     <xsl:call-template name="subfieldSelect">
489                         <xsl:with-param name="codes">acdef</xsl:with-param>
490                         <xsl:with-param name="delimeter">, </xsl:with-param>
491                     </xsl:call-template>
492                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
493                 </xsl:for-each>
494             </span>
495         </xsl:if>
496
497         <xsl:if test="marc:datafield[@tag=088]">
498             <span class="results_summary report_number">
499                 <span class="label">Report number: </span>
500                 <xsl:for-each select="marc:datafield[@tag=088]">
501                     <xsl:call-template name="subfieldSelect">
502                         <xsl:with-param name="codes">a</xsl:with-param>
503                     </xsl:call-template>
504                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
505                 </xsl:for-each>
506             </span>
507         </xsl:if>
508
509         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
510         <xsl:if test="$display880">
511             <xsl:call-template name="m880Select">
512                 <xsl:with-param name="basetags">246</xsl:with-param>
513                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
514                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
515                 <xsl:with-param name="label">Other title: </xsl:with-param>
516             </xsl:call-template>
517         </xsl:if>
518
519         <xsl:if test="marc:datafield[@tag=246]">
520         <span class="results_summary other_title"><span class="label">Other title: </span>
521             <xsl:for-each select="marc:datafield[@tag=246]">
522                 <xsl:call-template name="chopPunctuation">
523                   <xsl:with-param name="chopString">
524                     <xsl:call-template name="subfieldSelect">
525                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
526                     </xsl:call-template>
527                    </xsl:with-param>
528                </xsl:call-template>
529                 <!-- #13386 added separator | -->
530                 <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>
531             </xsl:for-each>
532         </span>
533        </xsl:if>
534
535         <xsl:if test="marc:datafield[@tag=242]">
536         <span class="results_summary translated_title"><span class="label">Title translated: </span>
537             <xsl:for-each select="marc:datafield[@tag=242]">
538                 <xsl:call-template name="chopPunctuation">
539                   <xsl:with-param name="chopString">
540                     <xsl:call-template name="subfieldSelect">
541                         <xsl:with-param name="codes">abchnp</xsl:with-param>
542                     </xsl:call-template>
543                    </xsl:with-param>
544                </xsl:call-template>
545                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
546             </xsl:for-each>
547         </span>
548        </xsl:if>
549
550         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
551         <xsl:if test="$display880">
552             <xsl:call-template name="m880Select">
553                 <xsl:with-param name="basetags">130,240</xsl:with-param>
554                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
555                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
556                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
557             </xsl:call-template>
558         </xsl:if>
559
560         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
561             <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
562                 <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
563                     <xsl:for-each select="marc:subfield">
564                         <xsl:if test="contains('adfghklmnoprst',@code)">
565                             <xsl:value-of select="text()"/>
566                             <xsl:text> </xsl:text>
567                         </xsl:if>
568                     </xsl:for-each>
569                     <xsl:if test="position() != last()">
570                         <span class="separator"><xsl:text> | </xsl:text></span>
571                     </xsl:if>
572                 </xsl:for-each>
573             </span>
574         </xsl:if>
575
576         <!-- #13382 Added Related works 700$i -->
577         <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']]">
578             <span class="results_summary related_works"><span class="label">Related Works: </span>
579                 <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']]">
580                     <xsl:variable name="str">
581                         <xsl:call-template name="subfieldSelect">
582                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
583                         </xsl:call-template>
584                     </xsl:variable>
585                     <xsl:call-template name="chopPunctuation">
586                         <xsl:with-param name="chopString">
587                             <xsl:value-of select="$str"/>
588                         </xsl:with-param>
589                     </xsl:call-template>
590                     <!-- add relator code too between brackets-->
591                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
592                         <span class="relatorcode">
593                             <xsl:text> [</xsl:text>
594                             <xsl:choose>
595                                 <xsl:when test="marc:subfield[@code='e']">
596                                     <xsl:for-each select="marc:subfield[@code='e']">
597                                         <xsl:value-of select="."/>
598                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
599                                     </xsl:for-each>
600                                 </xsl:when>
601                                 <xsl:otherwise>
602                                     <xsl:for-each select="marc:subfield[@code='4']">
603                                         <xsl:value-of select="."/>
604                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
605                                     </xsl:for-each>
606                                 </xsl:otherwise>
607                             </xsl:choose>
608                             <xsl:text>]</xsl:text>
609                         </span>
610                     </xsl:if>
611                     <xsl:choose>
612                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
613                     </xsl:choose>
614                 </xsl:for-each>
615             </span>
616         </xsl:if>
617
618         <!-- #13382 Added Contained Works 7xx@ind2=2 -->
619         <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'])]">
620             <span class="results_summary contained_works"><span class="label">Contained Works: </span>
621                 <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'])]">
622                     <xsl:variable name="str">
623                         <xsl:call-template name="subfieldSelect">
624                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
625                         </xsl:call-template>
626                     </xsl:variable>
627                     <xsl:call-template name="chopPunctuation">
628                         <xsl:with-param name="chopString">
629                             <xsl:value-of select="$str"/>
630                         </xsl:with-param>
631                     </xsl:call-template>
632                     <!-- add relator code too between brackets-->
633                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
634                         <span class="relatorcode">
635                             <xsl:text> [</xsl:text>
636                             <xsl:choose>
637                                 <xsl:when test="marc:subfield[@code='e']">
638                                     <xsl:for-each select="marc:subfield[@code='e']">
639                                         <xsl:value-of select="."/>
640                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
641                                     </xsl:for-each>
642                                 </xsl:when>
643                                 <xsl:otherwise>
644                                     <xsl:for-each select="marc:subfield[@code='4']">
645                                         <xsl:value-of select="."/>
646                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
647                                     </xsl:for-each>
648                                 </xsl:otherwise>
649                             </xsl:choose>
650                             <xsl:text>]</xsl:text>
651                         </span>
652                     </xsl:if>
653                     <xsl:choose>
654                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
655                     </xsl:choose>
656                 </xsl:for-each>
657             </span>
658         </xsl:if>
659
660
661         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
662             <span class="results_summary subjects"><span class="label">Subject(s): </span>
663             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
664             <a>
665             <xsl:choose>
666             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
667             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
668                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
669             </xsl:when>
670             <xsl:when test="$TraceSubjectSubdivisions='1'">
671                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
672                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
673                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
674                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
675                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
676                     </xsl:call-template>
677                 </xsl:attribute>
678             </xsl:when>
679             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
680             <xsl:otherwise>
681                 <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>
682             </xsl:otherwise>
683             </xsl:choose>
684             <xsl:call-template name="chopPunctuation">
685                 <xsl:with-param name="chopString">
686                     <xsl:call-template name="subfieldSelect">
687                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
688                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
689                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
690                     </xsl:call-template>
691                 </xsl:with-param>
692             </xsl:call-template>
693             </a>
694             <xsl:choose>
695             <xsl:when test="position()=last()"></xsl:when>
696             <xsl:otherwise> | </xsl:otherwise>
697             </xsl:choose>
698
699             </xsl:for-each>
700             </span>
701         </xsl:if>
702
703         <!-- Genre/Form -->
704         <xsl:if test="marc:datafield[@tag=655]">
705             <span class="results_summary genre"><span class="label">Genre/Form: </span>
706                 <xsl:for-each select="marc:datafield[@tag=655]">
707                     <a>
708                         <xsl:choose>
709                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
710                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
711                             </xsl:when>
712                             <xsl:when test="$TraceSubjectSubdivisions='1'">
713                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
714                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
715                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
716                                     <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
717                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
718                                 </xsl:call-template>
719                                 </xsl:attribute>
720                             </xsl:when>
721                             <xsl:otherwise>
722                                 <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>
723                             </xsl:otherwise>
724                         </xsl:choose>
725                     <xsl:call-template name="subfieldSelect">
726                         <xsl:with-param name="codes">avxyz</xsl:with-param>
727                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
728                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
729                     </xsl:call-template>
730                     </a>
731                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
732                 </xsl:for-each>
733             </span>
734         </xsl:if>
735
736 <!-- DDC classification -->
737     <xsl:if test="marc:datafield[@tag=082]">
738         <span class="results_summary ddc">
739             <span class="label">DDC classification: </span>
740             <xsl:for-each select="marc:datafield[@tag=082]">
741                 <xsl:call-template name="subfieldSelect">
742                     <xsl:with-param name="codes">a</xsl:with-param>
743                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
744                 </xsl:call-template>
745                 <xsl:choose>
746                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
747                     <xsl:otherwise> | </xsl:otherwise>
748                 </xsl:choose>
749             </xsl:for-each>
750         </span>
751     </xsl:if>
752
753         <xsl:if test="marc:datafield[@tag=856]">
754         <span class="results_summary online_resources"><span class="label">Online resources: </span>
755         <xsl:for-each select="marc:datafield[@tag=856]">
756                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
757                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
758                                     <xsl:choose>
759                                     <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')">
760                                         <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>
761                                     </xsl:when>
762                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
763                                         <xsl:call-template name="subfieldSelect">
764                                         <xsl:with-param name="codes">y3z</xsl:with-param>
765                                         </xsl:call-template>
766                                     </xsl:when>
767                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
768                                         <xsl:choose>
769                                         <xsl:when test="$URLLinkText!=''">
770                                                 <xsl:value-of select="$URLLinkText"/>
771                                         </xsl:when>
772                                         <xsl:otherwise>
773                                                 <xsl:text>Click here to access online</xsl:text>
774                                         </xsl:otherwise>
775                                         </xsl:choose>
776                                     </xsl:when>
777                                     </xsl:choose>
778                                     </a>
779                                     <xsl:choose>
780                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
781                                     <xsl:otherwise> | </xsl:otherwise>
782                                     </xsl:choose>
783
784         </xsl:for-each>
785         </span>
786         </xsl:if>
787         <xsl:if test="marc:datafield[@tag=505]">
788             <div class="results_summary contents">
789             <xsl:choose>
790             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
791                 <span class="label">Contents:</span>
792             </xsl:when>
793             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
794                 <span class="label">Incomplete contents:</span>
795             </xsl:when>
796             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
797                 <span class="label">Partial contents:</span>
798             </xsl:when>
799             </xsl:choose>
800                 <xsl:for-each select="marc:datafield[@tag=505]">
801                     <div class='contentblock'>
802                         <xsl:choose>
803                         <xsl:when test="@ind2=0">
804                             <xsl:call-template name="subfieldSelectSpan">
805                                 <xsl:with-param name="codes">tru</xsl:with-param>
806                             </xsl:call-template>
807                         </xsl:when>
808                         <xsl:otherwise>
809                             <xsl:call-template name="subfieldSelectSpan">
810                                 <xsl:with-param name="codes">atru</xsl:with-param>
811                             </xsl:call-template>
812                         </xsl:otherwise>
813                         </xsl:choose>
814                     </div>
815                 </xsl:for-each>
816             </div>
817         </xsl:if>
818
819         <!-- 586 -->
820         <xsl:if test="marc:datafield[@tag=586]">
821             <span class="results_summary awardsnote">
822                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
823                     <span class="label">Awards: </span>
824                 </xsl:if>
825                 <xsl:for-each select="marc:datafield[@tag=586]">
826                     <xsl:value-of select="marc:subfield[@code='a']"/>
827                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
828                 </xsl:for-each>
829             </span>
830         </xsl:if>
831
832         <!-- 508 -->
833         <xsl:if test="marc:datafield[@tag=508]">
834             <div class="results_summary prod_credits">
835                 <span class="label">Production Credits: </span>
836                 <xsl:for-each select="marc:datafield[@tag=508]">
837                     <xsl:call-template name="subfieldSelectSpan">
838                         <xsl:with-param name="codes">a</xsl:with-param>
839                     </xsl:call-template>
840                 </xsl:for-each>
841             </div>
842         </xsl:if>
843
844         <!-- 773 -->
845         <xsl:if test="marc:datafield[@tag=773]">
846         <xsl:for-each select="marc:datafield[@tag=773]">
847         <xsl:if test="@ind1 !=1">
848         <span class="results_summary in"><span class="label">
849         <xsl:choose>
850         <xsl:when test="@ind2=' '">
851             In:
852         </xsl:when>
853         <xsl:when test="@ind2=8">
854             <xsl:if test="marc:subfield[@code='i']">
855                 <xsl:value-of select="marc:subfield[@code='i']"/>
856             </xsl:if>
857         </xsl:when>
858         </xsl:choose>
859         </span>
860                 <xsl:variable name="f773">
861                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
862                         <xsl:with-param name="codes">a_t</xsl:with-param>
863                     </xsl:call-template></xsl:with-param></xsl:call-template>
864                 </xsl:variable>
865             <xsl:choose>
866                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
867                     <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>
868                         <xsl:value-of select="translate($f773, '()', '')"/>
869                     </a>
870                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
871                 </xsl:when>
872                 <xsl:when test="marc:subfield[@code='0']">
873                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
874                         <xsl:value-of select="$f773"/>
875                     </a>
876                 </xsl:when>
877                 <xsl:otherwise>
878                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
879                         <xsl:value-of select="$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:otherwise>
883             </xsl:choose>
884         </span>
885
886         <xsl:if test="marc:subfield[@code='n']">
887             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
888         </xsl:if>
889
890         </xsl:if>
891         </xsl:for-each>
892         </xsl:if>
893
894         <xsl:if test="marc:datafield[@tag=502]">
895             <span class="results_summary diss_note">
896                 <span class="label">Dissertation note: </span>
897                 <xsl:for-each select="marc:datafield[@tag=502]">
898                     <xsl:call-template name="subfieldSelect">
899                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
900                     </xsl:call-template>
901                 </xsl:for-each>
902                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
903             </span>
904         </xsl:if>
905
906         <!-- 866 textual holdings -->
907         <xsl:if test="marc:datafield[@tag=866]">
908             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
909                 <xsl:for-each select="marc:datafield[@tag=866]">
910                     <xsl:call-template name="subfieldSelect">
911                         <xsl:with-param name="codes">axz</xsl:with-param>
912                     </xsl:call-template>
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                 </xsl:for-each>
915             </span>
916         </xsl:if>
917
918         <!--  775 Other Edition  -->
919         <xsl:if test="marc:datafield[@tag=775]">
920         <span class="results_summary other_editions"><span class="label">Other editions: </span>
921         <xsl:for-each select="marc:datafield[@tag=775]">
922             <xsl:variable name="f775">
923                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
924                 <xsl:with-param name="codes">a_t</xsl:with-param>
925                 </xsl:call-template></xsl:with-param></xsl:call-template>
926             </xsl:variable>
927             <xsl:if test="marc:subfield[@code='i']">
928                 <xsl:call-template name="subfieldSelect">
929                     <xsl:with-param name="codes">i</xsl:with-param>
930                 </xsl:call-template>
931                 <xsl:text>: </xsl:text>
932             </xsl:if>
933             <a>
934             <xsl:choose>
935             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
936                 <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>
937             </xsl:when>
938             <xsl:otherwise>
939                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
940             </xsl:otherwise>
941             </xsl:choose>
942             <xsl:call-template name="subfieldSelect">
943                 <xsl:with-param name="codes">a_t</xsl:with-param>
944             </xsl:call-template>
945             </a>
946             <xsl:choose>
947                 <xsl:when test="position()=last()"></xsl:when>
948                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
949             </xsl:choose>
950         </xsl:for-each>
951         </span>
952         </xsl:if>
953
954         <!-- 780 -->
955         <xsl:if test="marc:datafield[@tag=780]">
956         <xsl:for-each select="marc:datafield[@tag=780]">
957         <xsl:if test="@ind1=0">
958         <span class="results_summary preceeding_entry">
959         <xsl:choose>
960         <xsl:when test="@ind2=0">
961             <span class="label">Continues:</span>
962         </xsl:when>
963         <xsl:when test="@ind2=1">
964             <span class="label">Continues in part:</span>
965         </xsl:when>
966         <xsl:when test="@ind2=2">
967             <span class="label">Supersedes:</span>
968         </xsl:when>
969         <xsl:when test="@ind2=3">
970             <span class="label">Supersedes in part:</span>
971         </xsl:when>
972         <xsl:when test="@ind2=4">
973             <span class="label">Formed by the union: ... and: ...</span>
974         </xsl:when>
975         <xsl:when test="@ind2=5">
976             <span class="label">Absorbed:</span>
977         </xsl:when>
978         <xsl:when test="@ind2=6">
979             <span class="label">Absorbed in part:</span>
980         </xsl:when>
981         <xsl:when test="@ind2=7">
982             <span class="label">Separated from:</span>
983         </xsl:when>
984         </xsl:choose>
985         <xsl:text> </xsl:text>
986                 <xsl:variable name="f780">
987                     <xsl:call-template name="subfieldSelect">
988                         <xsl:with-param name="codes">a_t</xsl:with-param>
989                     </xsl:call-template>
990                 </xsl:variable>
991             <xsl:choose>
992                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
993                     <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>
994                         <xsl:value-of select="translate($f780, '()', '')"/>
995                     </a>
996                 </xsl:when>
997                 <xsl:otherwise>
998                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
999                         <xsl:value-of select="translate($f780, '()', '')"/>
1000                     </a>
1001                 </xsl:otherwise>
1002             </xsl:choose>
1003         </span>
1004  
1005         <xsl:if test="marc:subfield[@code='n']">
1006             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1007         </xsl:if>
1008
1009         </xsl:if>
1010         </xsl:for-each>
1011         </xsl:if>
1012
1013         <!-- 785 -->
1014         <xsl:if test="marc:datafield[@tag=785]">
1015         <xsl:for-each select="marc:datafield[@tag=785]">
1016         <span class="results_summary succeeding_entry">
1017         <xsl:choose>
1018         <xsl:when test="@ind2=0">
1019             <span class="label">Continued by:</span>
1020         </xsl:when>
1021         <xsl:when test="@ind2=1">
1022             <span class="label">Continued in part by:</span>
1023         </xsl:when>
1024         <xsl:when test="@ind2=2">
1025             <span class="label">Superseded by:</span>
1026         </xsl:when>
1027         <xsl:when test="@ind2=3">
1028             <span class="label">Superseded in part by:</span>
1029         </xsl:when>
1030         <xsl:when test="@ind2=4">
1031             <span class="label">Absorbed by:</span>
1032         </xsl:when>
1033         <xsl:when test="@ind2=5">
1034             <span class="label">Absorbed in part by:</span>
1035         </xsl:when>
1036         <xsl:when test="@ind2=6">
1037             <span class="label">Split into .. and ...:</span>
1038         </xsl:when>
1039         <xsl:when test="@ind2=7">
1040             <span class="label">Merged with ... to form ...</span>
1041         </xsl:when>
1042         <xsl:when test="@ind2=8">
1043             <span class="label">Changed back to:</span>
1044         </xsl:when>
1045         </xsl:choose>
1046         <xsl:text> </xsl:text>
1047                    <xsl:variable name="f785">
1048                     <xsl:call-template name="subfieldSelect">
1049                         <xsl:with-param name="codes">a_t</xsl:with-param>
1050                     </xsl:call-template>
1051                 </xsl:variable>
1052
1053             <xsl:choose>
1054                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1055                     <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>
1056                         <xsl:value-of select="translate($f785, '()', '')"/>
1057                     </a>
1058                 </xsl:when>
1059                 <xsl:otherwise>
1060                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
1061                         <xsl:value-of select="translate($f785, '()', '')"/>
1062                     </a>
1063                 </xsl:otherwise>
1064             </xsl:choose>
1065
1066         </span>
1067         </xsl:for-each>
1068         </xsl:if>
1069
1070         <xsl:if test="$OPACBaseURL!=''">
1071         <span class="results_summary"><span class="label">OPAC view: </span>
1072             <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>.
1073         </span>
1074         </xsl:if>
1075
1076     </xsl:template>
1077
1078     <xsl:template name="nameABCQ">
1079             <xsl:call-template name="chopPunctuation">
1080                 <xsl:with-param name="chopString">
1081                     <xsl:call-template name="subfieldSelect">
1082                         <xsl:with-param name="codes">abcq</xsl:with-param>
1083                     </xsl:call-template>
1084                 </xsl:with-param>
1085                 <xsl:with-param name="punctuation">
1086                     <xsl:text>:,;/ </xsl:text>
1087                 </xsl:with-param>
1088             </xsl:call-template>
1089     </xsl:template>
1090
1091     <xsl:template name="nameABCDN">
1092             <xsl:call-template name="chopPunctuation">
1093                 <xsl:with-param name="chopString">
1094                     <xsl:call-template name="subfieldSelect">
1095                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1096                     </xsl:call-template>
1097                 </xsl:with-param>
1098                 <xsl:with-param name="punctuation">
1099                     <xsl:text>:,;/ </xsl:text>
1100                 </xsl:with-param>
1101             </xsl:call-template>
1102     </xsl:template>
1103
1104     <xsl:template name="nameACDEQ">
1105             <xsl:call-template name="subfieldSelect">
1106                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1107             </xsl:call-template>
1108     </xsl:template>
1109
1110     <xsl:template name="part">
1111         <xsl:variable name="partNumber">
1112             <xsl:call-template name="specialSubfieldSelect">
1113                 <xsl:with-param name="axis">n</xsl:with-param>
1114                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1115                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1116             </xsl:call-template>
1117         </xsl:variable>
1118         <xsl:variable name="partName">
1119             <xsl:call-template name="specialSubfieldSelect">
1120                 <xsl:with-param name="axis">p</xsl:with-param>
1121                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1122                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1123             </xsl:call-template>
1124         </xsl:variable>
1125         <xsl:if test="string-length(normalize-space($partNumber))">
1126                 <xsl:call-template name="chopPunctuation">
1127                     <xsl:with-param name="chopString" select="$partNumber"/>
1128                 </xsl:call-template>
1129         </xsl:if>
1130         <xsl:if test="string-length(normalize-space($partName))">
1131                 <xsl:call-template name="chopPunctuation">
1132                     <xsl:with-param name="chopString" select="$partName"/>
1133                 </xsl:call-template>
1134         </xsl:if>
1135     </xsl:template>
1136
1137     <xsl:template name="specialSubfieldSelect">
1138         <xsl:param name="anyCodes"/>
1139         <xsl:param name="axis"/>
1140         <xsl:param name="beforeCodes"/>
1141         <xsl:param name="afterCodes"/>
1142         <xsl:variable name="str">
1143             <xsl:for-each select="marc:subfield">
1144                 <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])">
1145                     <xsl:value-of select="text()"/>
1146                     <xsl:text> </xsl:text>
1147                 </xsl:if>
1148             </xsl:for-each>
1149         </xsl:variable>
1150         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1151     </xsl:template>
1152
1153     <xsl:template name="showAuthor">
1154         <xsl:param name="authorfield"/>
1155     <xsl:param name="UseAuthoritiesForTracings"/>
1156         <xsl:if test="count($authorfield)&gt;0">
1157         <h5 class="author">
1158         <xsl:for-each select="$authorfield">
1159         <xsl:choose>
1160           <xsl:when test="position()&gt;1"/>
1161           <!-- #13383 -->
1162           <xsl:when test="@tag&lt;700">By: </xsl:when>
1163           <!--#13382 Changed Additional author to contributor -->
1164           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1165         </xsl:choose>
1166         <a>
1167         <xsl:choose>
1168             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1169                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
1170             </xsl:when>
1171             <xsl:otherwise>
1172             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
1173             </xsl:otherwise>
1174         </xsl:choose>
1175         <xsl:choose>
1176             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1177                 <!-- #13383 -->
1178                 <xsl:call-template name="chopPunctuation">
1179                     <xsl:with-param name="chopString">
1180                         <xsl:call-template name="subfieldSelect">
1181                             <xsl:with-param name="codes">
1182                                 <xsl:choose>
1183                                     <!-- #13383 include subfield e for field 111  -->
1184                                     <xsl:when test="@tag=111">abcdeqt</xsl:when>
1185                                     <xsl:otherwise>abcdjqt</xsl:otherwise>
1186                                 </xsl:choose>
1187                             </xsl:with-param>
1188                         </xsl:call-template>
1189                     </xsl:with-param>
1190                     <xsl:with-param name="punctuation">
1191                         <xsl:text>:,;/ </xsl:text>
1192                     </xsl:with-param>
1193                 </xsl:call-template>
1194             </xsl:when>
1195             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1196             <!--#13382 Added all relevant subfields 4, e, are handled separately -->
1197             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1198                 <xsl:variable name="str">
1199                     <xsl:call-template name="subfieldSelect">
1200                         <xsl:with-param name="codes">abcdfghiklmnoprstux</xsl:with-param>
1201                     </xsl:call-template>
1202                 </xsl:variable>
1203                 <xsl:call-template name="chopPunctuation">
1204                     <xsl:with-param name="chopString">
1205                         <xsl:value-of select="$str"/>
1206                     </xsl:with-param>
1207                     <xsl:with-param name="punctuation">
1208                         <xsl:text>:,;/. </xsl:text>
1209                     </xsl:with-param>
1210                 </xsl:call-template>
1211             </xsl:when>
1212         </xsl:choose>
1213
1214         <!-- add relator code too between brackets-->
1215     <!-- #13383 include relator code j for field 111 -->
1216             <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'][. != ''])">
1217                 <span class="relatorcode">
1218                     <xsl:text> [</xsl:text>
1219                     <xsl:choose>
1220                         <xsl:when test="@tag=111">
1221                             <xsl:choose>
1222                                 <!-- Prefer j over 4 -->
1223                                 <xsl:when test="marc:subfield[@code='j']">
1224                                     <xsl:for-each select="marc:subfield[@code='j']">
1225                                         <xsl:value-of select="."/>
1226                                         <xsl:if test="position() != last()">, </xsl:if>
1227                                     </xsl:for-each>
1228                                 </xsl:when>
1229                                 <xsl:otherwise>
1230                                     <xsl:for-each select="marc:subfield[@code=4]">
1231                                         <xsl:value-of select="."/>
1232                                         <xsl:if test="position() != last()">, </xsl:if>
1233                                     </xsl:for-each>
1234                                 </xsl:otherwise>
1235                             </xsl:choose>
1236                         </xsl:when>
1237                         <!-- Prefer e over 4 -->
1238                         <xsl:when test="marc:subfield[@code='e']">
1239                             <xsl:for-each select="marc:subfield[@code='e']">
1240                                 <xsl:value-of select="."/>
1241                                 <xsl:if test="position() != last()">, </xsl:if>
1242                             </xsl:for-each>
1243                         </xsl:when>
1244                         <xsl:otherwise>
1245                             <xsl:for-each select="marc:subfield[@code=4]">
1246                                 <xsl:value-of select="."/>
1247                                 <xsl:if test="position() != last()">, </xsl:if>
1248                             </xsl:for-each>
1249                         </xsl:otherwise>
1250                     </xsl:choose>
1251                     <xsl:text>]</xsl:text>
1252                 </span>
1253             </xsl:if>
1254         </a>
1255         <xsl:choose>
1256             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1257         </xsl:choose>
1258         </xsl:for-each>
1259         </h5>
1260
1261         </xsl:if>
1262     </xsl:template>
1263
1264     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1265     <xsl:template name="subfieldSelectSubject">
1266         <xsl:param name="codes"/>
1267         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1268         <xsl:param name="subdivCodes"/>
1269         <xsl:param name="subdivDelimiter"/>
1270         <xsl:param name="prefix"/>
1271         <xsl:param name="suffix"/>
1272         <xsl:variable name="str">
1273             <xsl:for-each select="marc:subfield">
1274                 <xsl:if test="contains($codes, @code)">
1275                     <xsl:if test="contains($subdivCodes, @code)">
1276                         <xsl:value-of select="$subdivDelimiter"/>
1277                     </xsl:if>
1278                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1279                 </xsl:if>
1280             </xsl:for-each>
1281         </xsl:variable>
1282         <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1283     </xsl:template>
1284
1285 </xsl:stylesheet>