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