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