Bug 10265: Keep punctuation for 8xx series added entry fields (MARC21)
[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>
5 <xsl:stylesheet version="1.0"
6   xmlns:marc="http://www.loc.gov/MARC21/slim"
7   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8   xmlns:str="http://exslt.org/strings"
9   exclude-result-prefixes="marc str">
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='UseICUStyleQuotes']='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='UseICUStyleQuotes']='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'">VM</xsl:when>
66                 <xsl:when test="$leader6='k'">PK</xsl:when>
67                 <xsl:when test="$leader6='r'">OB</xsl:when>
68                 <xsl:when test="$leader6='i'">MU</xsl:when>
69                 <xsl:when test="$leader6='j'">MU</xsl:when>
70                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
71             </xsl:choose>
72         </xsl:variable>
73         <xsl:variable name="materialTypeLabel">
74             <xsl:choose>
75                 <xsl:when test="$leader19='a'">Set</xsl:when>
76                 <xsl:when test="$leader6='a'">
77                     <xsl:choose>
78                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Text</xsl:when>
79                         <xsl:when test="$leader7='i' or $leader7='s'">
80                             <xsl:choose>
81                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
82                                 <xsl:otherwise>Series</xsl:otherwise>
83                             </xsl:choose>
84                         </xsl:when>
85                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
86                     </xsl:choose>
87                 </xsl:when>
88                 <xsl:when test="$leader6='t'">Text</xsl:when>
89                                 <xsl:when test="$leader6='o'">Kit</xsl:when>
90                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
91                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
92                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
93                 <xsl:when test="$leader6='g'">Film</xsl:when>
94                 <xsl:when test="$leader6='k'">Picture</xsl:when>
95                 <xsl:when test="$leader6='r'">Object</xsl:when>
96                 <xsl:when test="$leader6='j'">Music</xsl:when>
97                 <xsl:when test="$leader6='i'">Sound</xsl:when>
98                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
99             </xsl:choose>
100         </xsl:variable>
101
102         <!-- Schema.org type -->
103         <xsl:variable name="schemaOrgType">
104             <xsl:choose>
105                 <xsl:when test="$materialTypeLabel='Book'">Book</xsl:when>
106                 <xsl:when test="$materialTypeLabel='Map'">Map</xsl:when>
107                 <xsl:when test="$materialTypeLabel='Music'">MusicAlbum</xsl:when>
108                 <xsl:otherwise>CreativeWork</xsl:otherwise>
109             </xsl:choose>
110         </xsl:variable>
111
112         <!-- Wrapper div for our schema.org object -->
113         <xsl:element name="div">
114             <xsl:attribute name="class"><xsl:value-of select="'record'" /></xsl:attribute>
115             <xsl:attribute name="vocab">http://schema.org/</xsl:attribute>
116             <xsl:attribute name="typeof"><xsl:value-of select='$schemaOrgType' /> Product</xsl:attribute>
117             <xsl:attribute name="resource">#record</xsl:attribute>
118
119         <!-- Title Statement -->
120         <!-- Alternate Graphic Representation (MARC 880) -->
121         <xsl:if test="$display880">
122             <h2 class="title" property="alternateName">
123                 <xsl:call-template name="m880Select">
124                     <xsl:with-param name="basetags">245</xsl:with-param>
125                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
126                 </xsl:call-template>
127             </h2>
128         </xsl:if>
129
130             <!--Bug 13381 -->
131             <xsl:if test="marc:datafield[@tag=245]">
132                 <h1 class="title" property="name">
133                     <xsl:for-each select="marc:datafield[@tag=245]">
134                         <xsl:call-template name="subfieldSelect">
135                             <xsl:with-param name="codes">a</xsl:with-param>
136                         </xsl:call-template>
137                         <xsl:text> </xsl:text>
138                         <!-- 13381 add additional subfields-->
139                         <!-- bug17625 adding f and g subfields -->
140                         <xsl:for-each select="marc:subfield[contains('bcfghknps', @code)]">
141                             <xsl:choose>
142                                 <xsl:when test="@code='h'">
143                                     <!--  13381 Span class around subfield h so it can be suppressed via css -->
144                                     <span class="title_medium"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
145                                 </xsl:when>
146                                 <xsl:when test="@code='c'">
147                                     <!--  13381 Span class around subfield c so it can be suppressed via css -->
148                                     <span class="title_resp_stmt"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
149                                 </xsl:when>
150                                 <xsl:otherwise>
151                                     <xsl:apply-templates/>
152                                     <xsl:text> </xsl:text>
153                                 </xsl:otherwise>
154                             </xsl:choose>
155                         </xsl:for-each>
156                     </xsl:for-each>
157                 </h1>
158             </xsl:if>
159
160
161         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
162         <xsl:if test="$display880">
163             <span class="results_summary author h3">
164                 <xsl:call-template name="m880Select">
165                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
166                     <xsl:with-param name="codes">abc</xsl:with-param>
167                     <xsl:with-param name="index">au</xsl:with-param>
168                     <!-- do not use label 'by ' here, it would be repeated for every occurrence of 100,110,111,700,710,711 -->
169                 </xsl:call-template>
170             </span>
171         </xsl:if>
172
173         <!--#13382 Added Author Statement to separate Authors and Contributors -->
174         <xsl:call-template name="showAuthor">
175             <xsl:with-param name="authorfield" select="marc:datafield[(@tag=100 or @tag=110 or @tag=111)]"/>
176             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
177             <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
178             <xsl:with-param name="theme" select="$theme"/>
179         </xsl:call-template>
180
181         <xsl:call-template name="showAuthor">
182             <!-- #13382 suppress 700$i and 7xx/@ind2=2 -->
183             <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'])]"/>
184             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
185             <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
186             <xsl:with-param name="theme" select="$theme"/>
187         </xsl:call-template>
188
189    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
190         <xsl:if test="$materialTypeCode!=''">
191         <span class="results_summary type"><span class="label">Material type: </span>
192         <xsl:element name="img">
193             <xsl:attribute name="src">/opac-tmpl/lib/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute>
194             <xsl:attribute name="alt"><xsl:value-of select="$materialTypeLabel"/></xsl:attribute>
195             <xsl:attribute name="class">materialtype mt_icon_<xsl:value-of select="$materialTypeCode"/></xsl:attribute>
196         </xsl:element>
197         <xsl:value-of select="$materialTypeLabel"/>
198         </span>
199         </xsl:if>
200     </xsl:if>
201
202
203     <!-- Publisher or Distributor Number -->
204     <xsl:if test="marc:datafield[@tag=028]">
205         <span class="results_summary publisher_number ">
206             <span class="label">Publisher number: </span>
207             <xsl:for-each select="marc:datafield[@tag=028]">
208                 <xsl:call-template name="subfieldSelect">
209                     <xsl:with-param name="codes">abq</xsl:with-param>
210                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
211                 </xsl:call-template>
212             </xsl:for-each>
213         </span>
214     </xsl:if>
215
216     <xsl:call-template name="show-lang-041"/>
217
218         <!--Series: Alternate Graphic Representation (MARC 880) -->
219         <xsl:if test="$display880">
220             <xsl:call-template name="m880Select">
221                 <xsl:with-param name="basetags">440,490</xsl:with-param>
222                 <xsl:with-param name="codes">av</xsl:with-param>
223                 <xsl:with-param name="class">results_summary series</xsl:with-param>
224                 <xsl:with-param name="label">Series: </xsl:with-param>
225                 <xsl:with-param name="index">se</xsl:with-param>
226             </xsl:call-template>
227         </xsl:if>
228
229     <xsl:call-template name="show-series">
230         <xsl:with-param name="searchurl">/cgi-bin/koha/opac-search.pl</xsl:with-param>
231         <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
232         <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
233     </xsl:call-template>
234
235         <!-- Analytics information -->
236         <xsl:variable name="leader7_class">
237             <xsl:choose>
238                 <!--xsl:when test="$leader7='a'">analytic_mcp</xsl:when-->
239                 <!--xsl:when test="$leader7='b'">analytic_scp</xsl:when-->
240                 <xsl:when test="$leader7='c'">analytic_collection</xsl:when>
241                 <xsl:when test="$leader7='d'">analytic_subunit</xsl:when>
242                 <xsl:when test="$leader7='i'">analytic_ires</xsl:when>
243                 <xsl:when test="$leader7='m'">analytic_monograph</xsl:when>
244                 <xsl:when test="$leader7='s'">analytic_serial</xsl:when>
245                 <xsl:otherwise>analytic_undefined</xsl:otherwise>
246             </xsl:choose>
247         </xsl:variable>
248
249         <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
250         <xsl:if test="$show_analytics_link='1'">
251             <xsl:element name="span">
252                 <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
253                 <span class="label">Analytics: </span>
254                 <a>
255                 <xsl:choose>
256                     <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
257                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute>
258                     </xsl:when>
259                     <xsl:otherwise>
260                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:(<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/>)</xsl:attribute>
261                     </xsl:otherwise>
262                 </xsl:choose>
263                 <xsl:text>Show analytics</xsl:text>
264                 </a>
265             </xsl:element>
266         </xsl:if>
267
268         <!-- Volumes of sets and traced series -->
269         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
270         <span class="results_summary volumes"><span class="label">Volumes: </span>
271             <a>
272             <xsl:choose>
273             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
274                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
275             </xsl:when>
276             <xsl:otherwise>
277                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
278             </xsl:otherwise>
279             </xsl:choose>
280             <xsl:text>Show volumes</xsl:text>
281             </a>
282         </span>
283         </xsl:if>
284
285         <!-- Set -->
286         <xsl:if test="$leader19='c'">
287         <span class="results_summary set"><span class="label">Set: </span>
288         <xsl:for-each select="marc:datafield[@tag=773]">
289             <a>
290             <xsl:choose>
291             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
292                 <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>
293             </xsl:when>
294             <xsl:otherwise>
295                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', ''), true())"/></xsl:attribute>
296             </xsl:otherwise>
297             </xsl:choose>
298             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
299             </a>
300             <xsl:choose>
301                 <xsl:when test="position()=last()"></xsl:when>
302                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
303             </xsl:choose>
304         </xsl:for-each>
305         </span>
306         </xsl:if>
307
308         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
309         <xsl:if test="$display880">
310             <xsl:call-template name="m880Select">
311                 <xsl:with-param name="basetags">260</xsl:with-param>
312                 <xsl:with-param name="codes">abcg</xsl:with-param>
313                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
314                 <xsl:with-param name="label">Publication details: </xsl:with-param>
315             </xsl:call-template>
316         </xsl:if>
317
318         <!-- Publisher info and RDA related info from tags 260, 264 -->
319         <xsl:choose>
320             <xsl:when test="marc:datafield[@tag=264]">
321                 <xsl:call-template name="showRDAtag264">
322                    <xsl:with-param name="show_url">1</xsl:with-param>
323                 </xsl:call-template>
324             </xsl:when>
325             <xsl:when test="marc:datafield[@tag=260]">
326              <span class="results_summary publisher"><span class="label">Publication details: </span>
327                  <xsl:for-each select="marc:datafield[@tag=260]">
328                      <span property="publisher" typeof="Organization">
329                          <xsl:for-each select="marc:subfield[@code='a']">
330                             <span class="publisher_place" property="location">
331                                 <a>
332                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=pl:"<xsl:value-of select="str:encode-uri(., true())"/>"</xsl:attribute>
333                                     <xsl:value-of select="."/>
334                                 </a>
335                             </span>
336                             <xsl:if test="position() != last()">
337                                 <xsl:text> </xsl:text>
338                             </xsl:if>
339                          </xsl:for-each>
340                      <xsl:text> </xsl:text>
341                      <xsl:if test="marc:subfield[@code='b']">
342                         <span property="name" class="publisher_name">
343                             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/></xsl:attribute>
344                                 <xsl:call-template name="subfieldSelect">
345                                     <xsl:with-param name="codes">b</xsl:with-param>
346                                 </xsl:call-template>
347                             </a>
348                         </span>
349                      </xsl:if>
350                      </span>
351                      <xsl:text> </xsl:text>
352                      <xsl:for-each select="marc:subfield[@code='c']">
353                          <span property="datePublished" class="publisher_date">
354                              <a>
355                                  <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=copydate:"<xsl:value-of select="str:encode-uri(., true())"/>"</xsl:attribute>
356                                  <xsl:value-of select="."/>
357                              </a>
358                              <xsl:if test="position() != last()">
359                                  <xsl:text> </xsl:text>
360                              </xsl:if>
361                          </span>
362                      </xsl:for-each>
363                      <xsl:text> </xsl:text>
364                      <xsl:if test="marc:subfield[@code='g']">
365                         <span property="datePublished" class="publisher_date">
366                            <xsl:call-template name="chopPunctuation">
367                                <xsl:with-param name="chopString">
368                                     <xsl:call-template name="subfieldSelect">
369                                         <xsl:with-param name="codes">g</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">abcefg</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         <!-- 385 - Audience -->
477         <xsl:if test="marc:datafield[@tag=385]">
478             <span class="results_summary audience">
479                 <span class="label">Audience: </span>
480                 <xsl:for-each select="marc:datafield[@tag=385]">
481                     <xsl:if test="marc:subfield[@code='m']">
482                         <xsl:call-template name="chopPunctuation">
483                             <xsl:with-param name="chopString">
484                                 <xsl:call-template name="subfieldSelect">
485                                     <xsl:with-param name="codes">m</xsl:with-param>
486                                 </xsl:call-template>
487                             </xsl:with-param>
488                         </xsl:call-template>
489                         <xsl:text>: </xsl:text>
490                     </xsl:if>
491                         <xsl:call-template name="chopPunctuation">
492                             <xsl:with-param name="chopString">
493                                 <xsl:call-template name="subfieldSelect">
494                                     <xsl:with-param name="codes">a</xsl:with-param>
495                                     <xsl:with-param name="delimeter">, </xsl:with-param>
496                                 </xsl:call-template>
497                             </xsl:with-param>
498                         </xsl:call-template>
499                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise></xsl:choose>
500                 </xsl:for-each>
501             </span>
502         </xsl:if>
503
504         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
505           <span class="results_summary isbn"><span class="label">ISBN: </span>
506             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
507               <span property="isbn">
508                 <xsl:value-of select="."/>
509                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
510               </span>
511             </xsl:for-each>
512           </span>
513         </xsl:if>
514
515         <!-- Build ISSN -->
516         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
517           <span class="results_summary issn"><span class="label">ISSN: </span>
518             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
519               <span property="issn">
520                 <xsl:value-of select="."/>
521                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
522               </span>
523             </xsl:for-each>
524           </span>
525         </xsl:if>
526
527         <xsl:if test="marc:datafield[@tag=013]">
528             <span class="results_summary patent_info">
529                 <span class="label">Patent information: </span>
530                 <xsl:for-each select="marc:datafield[@tag=013]">
531                     <xsl:call-template name="subfieldSelect">
532                         <xsl:with-param name="codes">acdef</xsl:with-param>
533                         <xsl:with-param name="delimeter">, </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         <xsl:if test="marc:datafield[@tag=088]">
541             <span class="results_summary report_number">
542                 <span class="label">Report number: </span>
543                 <xsl:for-each select="marc:datafield[@tag=088]">
544                     <xsl:call-template name="subfieldSelect">
545                         <xsl:with-param name="codes">a</xsl:with-param>
546                     </xsl:call-template>
547                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
548                 </xsl:for-each>
549             </span>
550         </xsl:if>
551
552         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
553         <xsl:if test="$display880">
554             <xsl:call-template name="m880Select">
555                 <xsl:with-param name="basetags">246</xsl:with-param>
556                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
557                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
558                 <xsl:with-param name="label">Other title: </xsl:with-param>
559             </xsl:call-template>
560         </xsl:if>
561
562             <xsl:if test="marc:datafield[@tag=246]">
563                 <span class="results_summary other_title"><span class="label">Other title: </span>
564                     <xsl:for-each select="marc:datafield[@tag=246]">
565                         <span property="alternateName">
566                             <xsl:call-template name="chopPunctuation">
567                                 <xsl:with-param name="chopString">
568                                     <xsl:if test="marc:subfield[@code='i']">
569                                             <xsl:call-template name="subfieldSelect">
570                                                     <xsl:with-param name="codes">i</xsl:with-param>
571                                             </xsl:call-template>
572                                     </xsl:if>
573                                     <xsl:text> </xsl:text>
574                                     <xsl:call-template name="subfieldSelect">
575                                         <xsl:with-param name="codes">abhfgnp</xsl:with-param>
576                                     </xsl:call-template>
577                                 </xsl:with-param>
578                             </xsl:call-template>
579                             <xsl:if test="@ind1=1 and not(marc:subfield[@code='i'])">
580                                 <xsl:choose>
581                                     <xsl:when test="@ind2=0"> [Portion of title]</xsl:when>
582                                     <xsl:when test="@ind2=1"> [Parallel title]</xsl:when>
583                                     <xsl:when test="@ind2=2"> [Distinctive title]</xsl:when>
584                                     <xsl:when test="@ind2=3"> [Other title]</xsl:when>
585                                     <xsl:when test="@ind2=4"> [Cover title]</xsl:when>
586                                     <xsl:when test="@ind2=5"> [Added title page title]</xsl:when>
587                                     <xsl:when test="@ind2=6"> [Caption title]</xsl:when>
588                                     <xsl:when test="@ind2=7"> [Running title]</xsl:when>
589                                     <xsl:when test="@ind2=8"> [Spine title]</xsl:when>
590                                 </xsl:choose>
591                             </xsl:if>
592                         </span>
593                         <!-- #13386 added separator | -->
594                         <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>
595                     </xsl:for-each>
596                 </span>
597             </xsl:if>
598
599
600         <xsl:if test="marc:datafield[@tag=242]">
601         <span class="results_summary translated_title"><span class="label">Title translated: </span>
602             <xsl:for-each select="marc:datafield[@tag=242]">
603                 <span property="alternateName">
604                 <xsl:call-template name="chopPunctuation">
605                   <xsl:with-param name="chopString">
606                     <xsl:call-template name="subfieldSelect">
607                         <xsl:with-param name="codes">abchnp</xsl:with-param>
608                     </xsl:call-template>
609                    </xsl:with-param>
610                </xsl:call-template>
611                 </span>
612                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
613             </xsl:for-each>
614         </span>
615        </xsl:if>
616
617         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
618         <xsl:if test="$display880">
619             <span property="alternateName">
620             <xsl:call-template name="m880Select">
621                 <xsl:with-param name="basetags">130,240</xsl:with-param>
622                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
623                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
624                 <xsl:with-param name="label">Uniform titles: </xsl:with-param>
625             </xsl:call-template>
626             </span>
627         </xsl:if>
628
629             <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
630                 <span class="results_summary uniform_titles"><span class="label">Uniform titles: </span>
631                     <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
632                         <span property="alternateName">
633                             <xsl:if test="marc:subfield[@code='i']">
634                                     <xsl:call-template name="subfieldSelect">
635                                             <xsl:with-param name="codes">i</xsl:with-param>
636                                     </xsl:call-template>
637                             </xsl:if>
638                             <xsl:text> </xsl:text>
639                             <xsl:for-each select="marc:subfield">
640                                 <xsl:if test="contains('adfghklmnoprst',@code)">
641                                     <xsl:value-of select="text()"/>
642                                     <xsl:text> </xsl:text>
643                                 </xsl:if>
644                             </xsl:for-each>
645                         </span>
646                         <xsl:if test="position() != last()">
647                             <span class="separator"><xsl:text> | </xsl:text></span>
648                         </xsl:if>
649                     </xsl:for-each>
650                 </span>
651             </xsl:if>
652
653
654             <!-- #13382 Added Related works 700$i -->
655             <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']]">
656                 <span class="results_summary related_works"><span class="label">Related works: </span>
657                     <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']]">
658                         <xsl:variable name="str">
659                             <xsl:call-template name="subfieldSelect">
660                                 <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
661                             </xsl:call-template>
662                         </xsl:variable>
663                         <xsl:call-template name="chopPunctuation">
664                             <xsl:with-param name="chopString">
665                                 <xsl:value-of select="$str"/>
666                             </xsl:with-param>
667                         </xsl:call-template>
668                         <!-- add relator code too between brackets-->
669                         <xsl:if test="marc:subfield[@code='4' or @code='e']">
670                             <span class="relatorcode">
671                                 <xsl:text> [</xsl:text>
672                                 <xsl:choose>
673                                     <xsl:when test="marc:subfield[@code='e']">
674                                         <xsl:for-each select="marc:subfield[@code='e']">
675                                             <xsl:value-of select="."/>
676                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
677                                         </xsl:for-each>
678                                     </xsl:when>
679                                     <xsl:otherwise>
680                                         <xsl:for-each select="marc:subfield[@code='4']">
681                                             <xsl:value-of select="."/>
682                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
683                                         </xsl:for-each>
684                                     </xsl:otherwise>
685                                 </xsl:choose>
686                                 <xsl:text>]</xsl:text>
687                             </span>
688                         </xsl:if>
689                         <xsl:choose>
690                             <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
691                         </xsl:choose>
692                     </xsl:for-each>
693                 </span>
694             </xsl:if>
695
696             <!-- #13382 Added Contained Works 7xx@ind2=2 -->
697             <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'])]">
698                 <span class="results_summary contained_works"><span class="label">Contained works: </span>
699                     <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'])]">
700                         <xsl:variable name="str">
701                             <xsl:call-template name="subfieldSelect">
702                                 <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
703                             </xsl:call-template>
704                         </xsl:variable>
705                         <xsl:call-template name="chopPunctuation">
706                             <xsl:with-param name="chopString">
707                                 <xsl:value-of select="$str"/>
708                             </xsl:with-param>
709                         </xsl:call-template>
710                         <!-- add relator code too between brackets-->
711                         <xsl:if test="marc:subfield[@code='4' or @code='e']">
712                             <span class="relatorcode">
713                                 <xsl:text> [</xsl:text>
714                                 <xsl:choose>
715                                     <xsl:when test="marc:subfield[@code='e']">
716                                         <xsl:for-each select="marc:subfield[@code='e']">
717                                             <xsl:value-of select="."/>
718                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
719                                         </xsl:for-each>
720                                     </xsl:when>
721                                     <xsl:otherwise>
722                                         <xsl:for-each select="marc:subfield[@code='4']">
723                                             <xsl:value-of select="."/>
724                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
725                                         </xsl:for-each>
726                                     </xsl:otherwise>
727                                 </xsl:choose>
728                                 <xsl:text>]</xsl:text>
729                             </span>
730                         </xsl:if>
731                         <xsl:choose>
732                             <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
733                         </xsl:choose>
734                     </xsl:for-each>
735                 </span>
736             </xsl:if>
737
738             <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
739             <span class="results_summary subjects"><span class="label">Subject(s): </span>
740                 <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
741             <span property="keywords">
742             <a>
743             <xsl:attribute name="class">subject</xsl:attribute>
744             <xsl:choose>
745             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
746                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
747             </xsl:when>
748             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
749             <xsl:when test="$TraceSubjectSubdivisions='1'">
750                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
751                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
752                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
753                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
754                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
755                         <xsl:with-param name="urlencode">1</xsl:with-param>
756                     </xsl:call-template>
757                 </xsl:attribute>
758             </xsl:when>
759                 <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
760             <xsl:otherwise>
761                 <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="str:encode-uri(translate(marc:subfield[@code='a'],'()',''), true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
762             </xsl:otherwise>
763             </xsl:choose>
764             <xsl:call-template name="chopPunctuation">
765                 <xsl:with-param name="chopString">
766                     <xsl:call-template name="subfieldSelect">
767                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
768                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
769                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
770                     </xsl:call-template>
771                 </xsl:with-param>
772             </xsl:call-template>
773             </a>
774             </span>
775             <xsl:if test="marc:subfield[@code=9]">
776                 <a class='authlink'>
777                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
778                     <xsl:element name="i">
779                         <xsl:attribute name="class">fa fa-search</xsl:attribute>
780                     </xsl:element>
781                 </a>
782             </xsl:if>
783             <xsl:choose>
784             <xsl:when test="position()=last()"></xsl:when>
785             <xsl:otherwise> | </xsl:otherwise>
786             </xsl:choose>
787
788             </xsl:for-each>
789             </span>
790         </xsl:if>
791
792             <!-- Genre/Form -->
793             <xsl:if test="marc:datafield[@tag=655]">
794                 <span class="results_summary genre"><span class="label">Genre/Form: </span>
795                     <xsl:for-each select="marc:datafield[@tag=655]">
796                         <a>
797                             <xsl:choose>
798                                 <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
799                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
800                                 </xsl:when>
801                                 <xsl:when test="$TraceSubjectSubdivisions='1'">
802                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
803                                         <xsl:with-param name="codes">avxyz</xsl:with-param>
804                                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
805                                         <xsl:with-param name="prefix">(index-term-genre<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
806                                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
807                                         <xsl:with-param name="urlencode">1</xsl:with-param>
808                                     </xsl:call-template>
809                                     </xsl:attribute>
810                                 </xsl:when>
811                                 <xsl:otherwise>
812                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=index-term-genre<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
813                                 </xsl:otherwise>
814                             </xsl:choose>
815                         <xsl:call-template name="subfieldSelect">
816                             <xsl:with-param name="codes">avxyz</xsl:with-param>
817                             <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
818                             <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
819                         </xsl:call-template>
820                         </a>
821                         <xsl:if test="marc:subfield[@code=9]">
822                             <xsl:text> </xsl:text>
823                             <a class='authlink'>
824                                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
825                                 <xsl:element name="i">
826                                     <xsl:attribute name="class">fa fa-search</xsl:attribute>
827                                 </xsl:element>
828                             </a>
829                         </xsl:if>
830                         <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
831                     </xsl:for-each>
832                 </span>
833             </xsl:if>
834
835 <!-- MARC21 776 Additional Physical Form Entry -->
836     <xsl:if test="marc:datafield[@tag=776]">
837         <span class="results_summary add_physical_form">
838             <span class="label">Additional physical formats: </span>
839             <xsl:for-each select="marc:datafield[@tag=776]">
840                 <xsl:variable name="linktext">
841                     <xsl:choose>
842                     <xsl:when test="marc:subfield[@code='t']">
843                         <xsl:value-of select="marc:subfield[@code='t']"/>
844                     </xsl:when>
845                     <xsl:when test="marc:subfield[@code='a']">
846                         <xsl:value-of select="marc:subfield[@code='a']"/>
847                     </xsl:when>
848                     <xsl:otherwise>
849                         <xsl:text>No title</xsl:text>
850                     </xsl:otherwise>
851                     </xsl:choose>
852                 </xsl:variable>
853                 <xsl:if test="@ind2=8 and marc:subfield[@code='i']">
854                     <xsl:call-template name="subfieldSelect">
855                         <xsl:with-param name="codes">i</xsl:with-param>
856                     </xsl:call-template>
857                     <xsl:text>: </xsl:text>
858                 </xsl:if>
859                 <xsl:choose>
860                 <xsl:when test="marc:subfield[@code='w']">
861                     <a>
862                     <xsl:attribute name="href">
863                         <xsl:text>/cgi-bin/koha/opac-search.pl?q=control-number:</xsl:text>
864                         <xsl:call-template name="extractControlNumber">
865                             <xsl:with-param name="subfieldW">
866                                 <xsl:value-of select="marc:subfield[@code='w']"/>
867                             </xsl:with-param>
868                         </xsl:call-template>
869                     </xsl:attribute>
870                     <xsl:value-of select="$linktext"/>
871                     </a>
872                 </xsl:when>
873                 <xsl:otherwise>
874                     <xsl:value-of select="$linktext"/>
875                 </xsl:otherwise>
876                 </xsl:choose>
877                 <xsl:if test="position() != last()">
878                     <xsl:text>; </xsl:text>
879                 </xsl:if>
880             </xsl:for-each>
881         </span>
882     </xsl:if>
883
884 <!-- MARC21 777 - Issued With Entry -->
885     <xsl:if test="marc:datafield[@tag=777]">
886         <xsl:for-each select="marc:datafield[@tag=777]">
887             <xsl:if test="@ind1 != 1">
888                 <span class="results_summary issued_with">
889                     <span class="label">
890                         <xsl:choose>
891                             <xsl:when test="@ind2=8 and marc:subfield[@code='i']">
892                                 <xsl:value-of select="marc:subfield[@code='i']"/>
893                             </xsl:when>
894                             <xsl:otherwise>
895                                 <xsl:text>Issued with:</xsl:text>
896                             </xsl:otherwise>
897                         </xsl:choose>
898                         <xsl:text> </xsl:text>
899                     </span>
900                     <xsl:variable name="f777">
901                         <xsl:call-template name="chopPunctuation">
902                             <xsl:with-param name="chopString">
903                                 <xsl:call-template name="subfieldSelect">
904                                     <xsl:with-param name="codes">a_t</xsl:with-param>
905                                 </xsl:call-template>
906                             </xsl:with-param>
907                         </xsl:call-template>
908                     </xsl:variable>
909                     <xsl:choose>
910                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
911                             <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>
912                             <xsl:value-of select="translate($f777, '()', '')"/>
913                             </a>
914                         </xsl:when>
915                         <xsl:otherwise>
916                             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(marc:subfield[@code='t'], true())"/></xsl:attribute>
917                             <xsl:value-of select="$f777"/>
918                             </a>
919                         </xsl:otherwise>
920                     </xsl:choose>
921                     <xsl:if test="marc:subfield[@code='g']">
922                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
923                     </xsl:if>
924                 </span>
925                 <xsl:if test="marc:subfield[@code='n']">
926                     <xsl:text> </xsl:text><span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
927                 </xsl:if>
928             </xsl:if>
929         </xsl:for-each>
930     </xsl:if>
931
932 <!-- DDC classification -->
933     <xsl:if test="marc:datafield[@tag=082]">
934         <span class="results_summary ddc">
935             <span class="label">DDC classification: </span>
936             <xsl:for-each select="marc:datafield[@tag=082]">
937                 <xsl:call-template name="subfieldSelect">
938                     <xsl:with-param name="codes">a</xsl:with-param>
939                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
940                 </xsl:call-template>
941                 <xsl:choose>
942                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
943                     <xsl:otherwise> | </xsl:otherwise>
944                 </xsl:choose>
945             </xsl:for-each>
946         </span>
947     </xsl:if>
948
949 <!-- LOC classification -->
950     <xsl:if test="marc:datafield[@tag=050]">
951         <span class="results_summary loc">
952             <span class="label">LOC classification: </span>
953             <xsl:for-each select="marc:datafield[@tag=050]">
954                 <xsl:call-template name="subfieldSelect">
955                     <xsl:with-param name="codes">ab</xsl:with-param>
956                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
957                 </xsl:call-template>
958             </xsl:for-each>
959         </span>
960     </xsl:if>
961
962 <!-- NLM classification -->
963     <xsl:if test="marc:datafield[@tag=060]">
964         <span class="results_summary nlm">
965             <span class="label">NLM classification: </span>
966             <xsl:for-each select="marc:datafield[@tag=060]">
967                 <xsl:call-template name="subfieldSelect">
968                     <xsl:with-param name="codes">a</xsl:with-param>
969                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
970                 </xsl:call-template>
971                 <xsl:if test="not(position()=last())"><xsl:text> | </xsl:text></xsl:if>
972             </xsl:for-each>
973         </span>
974     </xsl:if>
975
976 <!-- Other classification -->
977     <xsl:if test="marc:datafield[@tag=084]">
978        <span class="results_summary oc">
979            <span class="label">Other classification: </span>
980           <xsl:for-each select="marc:datafield[@tag=084]">
981                 <xsl:call-template name="subfieldSelect">
982                    <xsl:with-param name="codes">a</xsl:with-param>
983                    <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
984                 </xsl:call-template>
985                 <xsl:choose>
986                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
987                    <xsl:otherwise> | </xsl:otherwise>
988                 </xsl:choose>
989           </xsl:for-each>
990        </span>
991     </xsl:if>
992
993
994 <!-- Image processing code added here, takes precedence over text links including y3z text   -->
995         <xsl:if test="marc:datafield[@tag=856]">
996         <span class="results_summary online_resources"><span class="label">Online resources: </span>
997         <xsl:for-each select="marc:datafield[@tag=856]">
998             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
999             <a property="url">
1000             <xsl:choose>
1001               <xsl:when test="$OPACTrackClicks='track'">
1002             <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1003               </xsl:when>
1004               <xsl:when test="$OPACTrackClicks='anonymous'">
1005             <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
1006               </xsl:when>
1007               <xsl:otherwise>
1008               <xsl:attribute name="href">
1009                   <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
1010                       <xsl:choose>
1011                           <xsl:when test="@ind1=7">
1012                               <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
1013                           </xsl:when>
1014                           <xsl:when test="@ind1=1">
1015                               <xsl:text>ftp://</xsl:text>
1016                           </xsl:when>
1017                           <xsl:otherwise>
1018                               <xsl:text>http://</xsl:text>
1019                           </xsl:otherwise>
1020                       </xsl:choose>
1021                   </xsl:if>
1022                   <xsl:value-of select="marc:subfield[@code='u']"/>
1023               </xsl:attribute>
1024               </xsl:otherwise>
1025             </xsl:choose>
1026             <xsl:if test="$OPACURLOpenInNewWindow='1'">
1027                 <xsl:attribute name="target">_blank</xsl:attribute>
1028             </xsl:if>
1029             <xsl:choose>
1030             <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')">
1031                 <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>
1032             </xsl:when>
1033             <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1034                 <xsl:call-template name="subfieldSelect">
1035                     <xsl:with-param name="codes">y3z</xsl:with-param>
1036                 </xsl:call-template>
1037             </xsl:when>
1038             <xsl:when test="$URLLinkText!=''">
1039                 <xsl:value-of select="$URLLinkText"/>
1040             </xsl:when>
1041             <xsl:otherwise>
1042                 <xsl:text>Click here to access online</xsl:text>
1043             </xsl:otherwise>
1044             </xsl:choose>
1045             </a>
1046             <xsl:choose>
1047             <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
1048             <xsl:otherwise> | </xsl:otherwise>
1049             </xsl:choose>
1050         </xsl:for-each>
1051         </span>
1052         </xsl:if>
1053
1054         <!-- 530 -->
1055         <xsl:if test="marc:datafield[@tag=530]">
1056         <xsl:for-each select="marc:datafield[@tag=530]">
1057         <span class="results_summary additionalforms">
1058             <xsl:call-template name="subfieldSelect">
1059                 <xsl:with-param name="codes">abcd</xsl:with-param>
1060             </xsl:call-template>
1061             <xsl:for-each select="marc:subfield[@code='u']">
1062                 <a><xsl:attribute name="href"><xsl:value-of select="text()"/></xsl:attribute>
1063                 <xsl:if test="$OPACURLOpenInNewWindow='1'">
1064                     <xsl:attribute name="target">_blank</xsl:attribute>
1065                 </xsl:if>
1066                 <xsl:value-of select="text()"/>
1067                 </a>
1068             </xsl:for-each>
1069         </span>
1070         </xsl:for-each>
1071         </xsl:if>
1072
1073         <!-- 505 - Formatted contents note -->
1074         <xsl:if test="marc:datafield[@tag=505]">
1075             <div class="results_summary contents">
1076                 <xsl:for-each select="marc:datafield[@tag=505]">
1077                     <xsl:if test="position()=1">
1078                         <xsl:choose>
1079                         <xsl:when test="@ind1=1">
1080                             <span class="label">Incomplete contents:</span>
1081                         </xsl:when>
1082                         <xsl:when test="@ind1=2">
1083                             <span class="label">Partial contents:</span>
1084                         </xsl:when>
1085                         <xsl:otherwise>
1086                             <span class="label">Contents:</span>
1087                         </xsl:otherwise>
1088                         </xsl:choose>
1089                     </xsl:if>
1090                     <div class='contentblock' property='description'>
1091                         <xsl:choose>
1092                             <xsl:when test="@ind2=0">
1093                                 <xsl:call-template name="subfieldSelectSpan">
1094                                     <xsl:with-param name="newline">1</xsl:with-param>
1095                                     <xsl:with-param name="codes">trug</xsl:with-param>
1096                                 </xsl:call-template>
1097                             </xsl:when>
1098                             <xsl:otherwise>
1099                                 <xsl:call-template name="subfieldSelectSpan">
1100                                     <xsl:with-param name="newline">1</xsl:with-param>
1101                                     <xsl:with-param name="codes">atrug</xsl:with-param>
1102                                 </xsl:call-template>
1103                             </xsl:otherwise>
1104                         </xsl:choose>
1105                     </div>
1106                 </xsl:for-each>
1107             </div>
1108         </xsl:if>
1109
1110         <!-- 583 -->
1111         <xsl:if test="marc:datafield[@tag=583 and not(@ind1=0)]">
1112             <span class="results_summary actionnote">
1113                 <span class="label">Action note: </span>
1114                 <xsl:for-each select="marc:datafield[@tag=583 and not(@ind1=0)]">
1115                     <xsl:choose>
1116                     <xsl:when test="marc:subfield[@code='z']">
1117                         <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
1118                     </xsl:when>
1119                     <xsl:otherwise>
1120                         <xsl:call-template name="subfieldSelect">
1121                             <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
1122                         </xsl:call-template>
1123                     </xsl:otherwise>
1124                     </xsl:choose>
1125                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1126                 </xsl:for-each>
1127             </span>
1128         </xsl:if>
1129
1130         <!-- 508 -->
1131         <xsl:if test="marc:datafield[@tag=508]">
1132             <span class="results_summary prod_credits">
1133                 <span class="label">Production credits: </span>
1134                 <xsl:for-each select="marc:datafield[@tag=508]">
1135                     <xsl:call-template name="subfieldSelectSpan">
1136                         <xsl:with-param name="codes">a</xsl:with-param>
1137                     </xsl:call-template>
1138                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1139                 </xsl:for-each>
1140             </span>
1141         </xsl:if>
1142
1143         <!-- 586 -->
1144         <xsl:if test="marc:datafield[@tag=586]">
1145             <span class="results_summary awardsnote">
1146                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
1147                     <span class="label">Awards: </span>
1148                 </xsl:if>
1149                 <xsl:for-each select="marc:datafield[@tag=586]">
1150                     <xsl:value-of select="marc:subfield[@code='a']"/>
1151                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1152                 </xsl:for-each>
1153             </span>
1154         </xsl:if>
1155
1156         <!-- 773 -->
1157         <xsl:if test="marc:datafield[@tag=773]">
1158             <xsl:for-each select="marc:datafield[@tag=773]">
1159                 <xsl:if test="@ind1 !=1">
1160                     <span class="results_summary in"><span class="label">
1161                     <xsl:choose>
1162                         <xsl:when test="@ind2=' '">
1163                             In:
1164                         </xsl:when>
1165                         <xsl:when test="@ind2=8">
1166                             <xsl:if test="marc:subfield[@code='i']">
1167                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1168                             </xsl:if>
1169                         </xsl:when>
1170                     </xsl:choose>
1171                     </span>
1172                     <xsl:variable name="f773">
1173                         <xsl:call-template name="chopPunctuation">
1174                             <xsl:with-param name="chopString">
1175                                 <xsl:call-template name="subfieldSelect">
1176                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1177                                 </xsl:call-template>
1178                             </xsl:with-param>
1179                         </xsl:call-template>
1180                     </xsl:variable>
1181                     <xsl:choose>
1182                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1183                             <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>
1184                             <xsl:value-of select="translate($f773, '()', '')"/>
1185                             </a>
1186                         </xsl:when>
1187                         <xsl:when test="marc:subfield[@code='0']">
1188                             <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
1189                             <xsl:value-of select="$f773"/>
1190                             </a>
1191                         </xsl:when>
1192                         <xsl:otherwise>
1193                             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f773, '()', ''), true())"/></xsl:attribute>
1194                             <xsl:value-of select="$f773"/>
1195                             </a>
1196                         </xsl:otherwise>
1197                     </xsl:choose>
1198                     <xsl:if test="marc:subfield[@code='g']">
1199                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
1200                     </xsl:if>
1201                     </span>
1202
1203                     <xsl:if test="marc:subfield[@code='n']">
1204                         <span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1205                     </xsl:if>
1206
1207                 </xsl:if>
1208             </xsl:for-each>
1209         </xsl:if>
1210
1211         <xsl:for-each select="marc:datafield[@tag=511]">
1212             <span class="results_summary perf_note">
1213                 <span class="label">
1214                     <xsl:if test="@ind1=1"><xsl:text>Cast: </xsl:text></xsl:if>
1215                 </span>
1216                 <xsl:call-template name="subfieldSelect">
1217                     <xsl:with-param name="codes">a</xsl:with-param>
1218                 </xsl:call-template>
1219             </span>
1220         </xsl:for-each>
1221
1222         <xsl:if test="marc:datafield[@tag=502]">
1223             <span class="results_summary diss_note">
1224                 <span class="label">Dissertation note: </span>
1225                 <xsl:for-each select="marc:datafield[@tag=502]">
1226                     <xsl:call-template name="subfieldSelect">
1227                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1228                     </xsl:call-template>
1229                 </xsl:for-each>
1230                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1231             </span>
1232         </xsl:if>
1233
1234         <xsl:for-each select="marc:datafield[@tag=520]">
1235         <span class="results_summary summary"><span class="label">
1236         <xsl:choose>
1237           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
1238           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
1239           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
1240           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
1241           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
1242           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
1243         </xsl:choose>
1244         </span>
1245         <xsl:call-template name="subfieldSelect">
1246           <xsl:with-param name="codes">abcu</xsl:with-param>
1247         </xsl:call-template>
1248         </span>
1249         </xsl:for-each>
1250
1251         <!-- 866 textual holdings -->
1252         <xsl:if test="marc:datafield[@tag=866]">
1253             <span class="results_summary holdings_note basic_bibliographic_unit"><span class="label">Holdings: </span>
1254                 <xsl:for-each select="marc:datafield[@tag=866]">
1255                     <span class="holdings_note_data">
1256                         <xsl:call-template name="subfieldSelect">
1257                             <xsl:with-param name="codes">az</xsl:with-param>
1258                         </xsl:call-template>
1259                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1260                     </span>
1261                 </xsl:for-each>
1262             </span>
1263         </xsl:if>
1264
1265         <!-- 867 textual holdings -->
1266         <xsl:if test="marc:datafield[@tag=867]">
1267             <span class="results_summary holdings_note supplementary_material"><span class="label">Supplements: </span>
1268                 <xsl:for-each select="marc:datafield[@tag=867]">
1269                     <span class="holdings_note_data">
1270                         <xsl:call-template name="subfieldSelect">
1271                             <xsl:with-param name="codes">az</xsl:with-param>
1272                         </xsl:call-template>
1273                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1274                     </span>
1275                 </xsl:for-each>
1276             </span>
1277         </xsl:if>
1278
1279         <!-- 868 textual holdings -->
1280         <xsl:if test="marc:datafield[@tag=868]">
1281             <span class="results_summary holdings_note indexes"><span class="label">Indexes: </span>
1282                 <xsl:for-each select="marc:datafield[@tag=868]">
1283                     <span class="holdings_note_data">
1284                         <xsl:call-template name="subfieldSelect">
1285                             <xsl:with-param name="codes">az</xsl:with-param>
1286                         </xsl:call-template>
1287                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1288                     </span>
1289                 </xsl:for-each>
1290             </span>
1291         </xsl:if>
1292
1293         <!-- 770 - Supplement/Special issue entry -->
1294         <xsl:if test="marc:datafield[@tag=770]">
1295             <span class="results_summary supplement"><span class="label">Supplement: </span>
1296                 <xsl:for-each select="marc:datafield[@tag=770]">
1297                     <xsl:if test="marc:subfield[@code='i']">
1298                         <span class="770_rel_info">
1299                             <xsl:call-template name="subfieldSelect">
1300                                 <xsl:with-param name="codes">i</xsl:with-param>
1301                             </xsl:call-template>
1302                             <xsl:text> </xsl:text>
1303                         </span>
1304                     </xsl:if>
1305                     <a>
1306                         <xsl:choose>
1307                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1308                                 <xsl:attribute name="href">
1309                                     /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>
1310                                 </xsl:attribute>
1311                             </xsl:when>
1312                             <xsl:otherwise>
1313                                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
1314                             </xsl:otherwise>
1315                         </xsl:choose>
1316                         <xsl:choose>
1317                             <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1318                                 <xsl:call-template name="subfieldSelect">
1319                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1320                                 </xsl:call-template>
1321                             </xsl:when>
1322                         </xsl:choose>
1323                     </a>
1324                     <xsl:text> </xsl:text>
1325                     <xsl:call-template name="subfieldSelect">
1326                         <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1327                     </xsl:call-template>
1328                     <xsl:choose>
1329                         <xsl:when test="position()=last()"></xsl:when>
1330                         <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
1331                     </xsl:choose>
1332                 </xsl:for-each>
1333             </span>
1334         </xsl:if>
1335
1336         <!-- 772 - Supplement parent entry -->
1337         <xsl:if test="marc:datafield[@tag=772]">
1338             <span class="results_summary supplement_parent"><span class="label">Supplement to: </span>
1339                 <xsl:for-each select="marc:datafield[@tag=772]">
1340                     <xsl:if test="marc:subfield[@code='i']">
1341                         <span class="772_rel_info">
1342                             <xsl:call-template name="subfieldSelect">
1343                                 <xsl:with-param name="codes">i</xsl:with-param>
1344                             </xsl:call-template>
1345                             <xsl:text> </xsl:text>
1346                         </span>
1347                     </xsl:if>
1348                     <a>
1349                         <xsl:choose>
1350                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1351                                 <xsl:attribute name="href">
1352                                     /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>
1353                                 </xsl:attribute>
1354                             </xsl:when>
1355                             <xsl:otherwise>
1356                                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
1357                             </xsl:otherwise>
1358                         </xsl:choose>
1359                         <xsl:choose>
1360                             <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1361                                 <xsl:call-template name="subfieldSelect">
1362                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1363                                 </xsl:call-template>
1364                             </xsl:when>
1365                         </xsl:choose>
1366                     </a>
1367                     <xsl:call-template name="subfieldSelect">
1368                         <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1369                     </xsl:call-template>
1370                     <xsl:choose>
1371                         <xsl:when test="position()=last()"></xsl:when>
1372                         <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
1373                     </xsl:choose>
1374                 </xsl:for-each>
1375             </span>
1376         </xsl:if>
1377
1378         <!--  775 Other Edition  -->
1379         <xsl:if test="marc:datafield[@tag=775]">
1380         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1381         <xsl:for-each select="marc:datafield[@tag=775]">
1382             <xsl:variable name="f775">
1383                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1384                 <xsl:with-param name="codes">a_t</xsl:with-param>
1385                 </xsl:call-template></xsl:with-param></xsl:call-template>
1386             </xsl:variable>
1387             <xsl:if test="marc:subfield[@code='i']">
1388                 <xsl:call-template name="subfieldSelect">
1389                     <xsl:with-param name="codes">i</xsl:with-param>
1390                 </xsl:call-template>
1391                 <xsl:text>: </xsl:text>
1392             </xsl:if>
1393             <a>
1394             <xsl:choose>
1395             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1396                 <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>
1397             </xsl:when>
1398             <xsl:otherwise>
1399                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f775, '()', ''), true())"/></xsl:attribute>
1400             </xsl:otherwise>
1401             </xsl:choose>
1402             <xsl:call-template name="subfieldSelect">
1403                 <xsl:with-param name="codes">a_t</xsl:with-param>
1404             </xsl:call-template>
1405             </a>
1406             <xsl:choose>
1407                 <xsl:when test="position()=last()"></xsl:when>
1408                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1409             </xsl:choose>
1410         </xsl:for-each>
1411         </span>
1412         </xsl:if>
1413
1414         <!-- 780 -->
1415         <xsl:if test="marc:datafield[@tag=780]">
1416             <xsl:for-each select="marc:datafield[@tag=780]">
1417                 <xsl:if test="@ind1=0">
1418                     <span class="results_summary preceeding_entry">
1419                         <xsl:choose>
1420                             <xsl:when test="@ind2=0">
1421                                 <span class="label">Continues:</span>
1422                             </xsl:when>
1423                             <xsl:when test="@ind2=1">
1424                                 <span class="label">Continues in part:</span>
1425                             </xsl:when>
1426                             <xsl:when test="@ind2=2">
1427                                 <span class="label">Supersedes:</span>
1428                             </xsl:when>
1429                             <xsl:when test="@ind2=3">
1430                                 <span class="label">Supersedes in part:</span>
1431                             </xsl:when>
1432                             <xsl:when test="@ind2=4">
1433                                 <span class="label">Formed by the union: ... and: ...</span>
1434                             </xsl:when>
1435                             <xsl:when test="@ind2=5">
1436                                 <span class="label">Absorbed:</span>
1437                             </xsl:when>
1438                             <xsl:when test="@ind2=6">
1439                                 <span class="label">Absorbed in part:</span>
1440                             </xsl:when>
1441                             <xsl:when test="@ind2=7">
1442                                 <span class="label">Separated from:</span>
1443                             </xsl:when>
1444                         </xsl:choose>
1445                         <xsl:text> </xsl:text>
1446
1447                         <xsl:if test="marc:subfield[@code='i']">
1448                             <span class="780_rel_info">
1449                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1450                                     <xsl:text> </xsl:text>
1451                             </span>
1452                         </xsl:if>
1453
1454                         <xsl:variable name="f780">
1455                             <xsl:call-template name="subfieldSelect">
1456                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1457                             </xsl:call-template>
1458                         </xsl:variable>
1459
1460                         <xsl:choose>
1461                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1462                                 <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>
1463                                     <xsl:value-of select="$f780"/>
1464                                 </a>
1465                             </xsl:when>
1466                             <xsl:otherwise>
1467                                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute>
1468                                     <xsl:value-of select="$f780"/>
1469                                 </a>
1470                             </xsl:otherwise>
1471                         </xsl:choose>
1472                     </span>
1473
1474                     <xsl:if test="marc:subfield[@code='n']">
1475                         <span class="results_summary preceeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1476                     </xsl:if>
1477
1478                 </xsl:if>
1479             </xsl:for-each>
1480         </xsl:if>
1481
1482         <!-- 785 -->
1483         <xsl:if test="marc:datafield[@tag=785]">
1484             <xsl:for-each select="marc:datafield[@tag=785]">
1485                 <xsl:if test="@ind1=0">
1486                     <span class="results_summary succeeding_entry">
1487                         <xsl:choose>
1488                             <xsl:when test="@ind2=0">
1489                                 <span class="label">Continued by:</span>
1490                             </xsl:when>
1491                             <xsl:when test="@ind2=1">
1492                                 <span class="label">Continued in part by:</span>
1493                             </xsl:when>
1494                             <xsl:when test="@ind2=2">
1495                                 <span class="label">Superseded by:</span>
1496                             </xsl:when>
1497                             <xsl:when test="@ind2=3">
1498                                 <span class="label">Superseded in part by:</span>
1499                             </xsl:when>
1500                             <xsl:when test="@ind2=4">
1501                                 <span class="label">Absorbed by:</span>
1502                             </xsl:when>
1503                             <xsl:when test="@ind2=5">
1504                                 <span class="label">Absorbed in part by:</span>
1505                             </xsl:when>
1506                             <xsl:when test="@ind2=6">
1507                                 <span class="label">Split into .. and ...:</span>
1508                             </xsl:when>
1509                             <xsl:when test="@ind2=7">
1510                                 <span class="label">Merged with ... to form ...</span>
1511                             </xsl:when>
1512                             <xsl:when test="@ind2=8">
1513                                 <span class="label">Changed back to:</span>
1514                             </xsl:when>
1515                         </xsl:choose>
1516                         <xsl:text> </xsl:text>
1517
1518                         <xsl:if test="marc:subfield[@code='i']">
1519                             <span class="785_rel_info">
1520                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1521                                 <xsl:text> </xsl:text>
1522                             </span>
1523                         </xsl:if>
1524
1525                         <xsl:variable name="f785">
1526                             <xsl:call-template name="subfieldSelect">
1527                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1528                             </xsl:call-template>
1529                         </xsl:variable>
1530
1531                         <xsl:choose>
1532                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1533                                 <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>
1534                                     <xsl:value-of select="$f785"/>
1535                                 </a>
1536                             </xsl:when>
1537                             <xsl:otherwise>
1538                                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute>
1539                                     <xsl:value-of select="$f785"/>
1540                                 </a>
1541                             </xsl:otherwise>
1542                         </xsl:choose>
1543                     </span>
1544
1545                     <xsl:if test="marc:subfield[@code='n']">
1546                         <span class="results_summary succeeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1547                     </xsl:if>
1548
1549                 </xsl:if>
1550             </xsl:for-each>
1551         </xsl:if>
1552
1553         <!-- OpenURL -->
1554         <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1555         <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1556         <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1557         <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
1558
1559         <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
1560           <xsl:variable name="openurltext">
1561             <xsl:choose>
1562               <xsl:when test="$OpenURLText != ''">
1563                 <xsl:value-of select="$OpenURLText" />
1564               </xsl:when>
1565               <xsl:otherwise>
1566                 <xsl:text>OpenURL</xsl:text>
1567               </xsl:otherwise>
1568             </xsl:choose>
1569           </xsl:variable>
1570
1571           <span class="results_summary"><a>
1572             <xsl:attribute name="href">
1573               <xsl:value-of select="$OpenURLResolverURL" />
1574             </xsl:attribute>
1575             <xsl:attribute name="title">
1576               <xsl:value-of select="$openurltext" />
1577             </xsl:attribute>
1578             <xsl:attribute name="class">
1579               <xsl:text>OpenURL</xsl:text>
1580             </xsl:attribute>
1581             <xsl:if test="$OPACURLOpenInNewWindow='1'">
1582               <xsl:attribute name="target">
1583                 <xsl:text>_blank</xsl:text>
1584               </xsl:attribute>
1585             </xsl:if>
1586             <xsl:choose>
1587               <xsl:when test="$OpenURLImageLocation != ''">
1588                 <img>
1589                   <xsl:attribute name="src">
1590                     <xsl:value-of select="$OpenURLImageLocation" />
1591                   </xsl:attribute>
1592                 </img>
1593               </xsl:when>
1594               <xsl:otherwise>
1595                 <xsl:value-of select="$openurltext" />
1596               </xsl:otherwise>
1597             </xsl:choose>
1598           </a></span>
1599         </xsl:if>
1600         <!-- End of OpenURL -->
1601
1602         <xsl:variable name="OPACShowMusicalInscripts" select="marc:sysprefs/marc:syspref[@name='OPACShowMusicalInscripts']" />
1603         <xsl:variable name="OPACPlayMusicalInscripts" select="marc:sysprefs/marc:syspref[@name='OPACPlayMusicalInscripts']" />
1604
1605         <xsl:if test="$OPACShowMusicalInscripts = 1 and marc:datafield[@tag=031]">
1606             <xsl:for-each select="marc:datafield[@tag=031]">
1607
1608                 <span class="results_summary musical_inscripts">
1609                     <xsl:if test="marc:subfield[@code='u']">
1610                         <span class="uri">
1611                             <a>
1612                                 <xsl:attribute name="href">
1613                                     <xsl:value-of select="marc:subfield[@code='u']"/>
1614                                 </xsl:attribute>
1615                                 <xsl:text>Audio file</xsl:text>
1616                             </a>
1617                         </span>
1618                     </xsl:if>
1619                     <xsl:if test="marc:subfield[@code='2'] and marc:subfield[@code='2']/text() = 'pe' and marc:subfield[@code='g'] and marc:subfield[@code='n'] and marc:subfield[@code='o'] and marc:subfield[@code='p']">
1620                         <div class="inscript" data-system="pae">
1621                             <xsl:attribute name="data-clef">
1622                                 <xsl:value-of select="marc:subfield[@code='g']"/>
1623                             </xsl:attribute>
1624                             <xsl:attribute name="data-keysig">
1625                                 <xsl:value-of select="marc:subfield[@code='n']"/>
1626                             </xsl:attribute>
1627                             <xsl:attribute name="data-timesig">
1628                                 <xsl:value-of select="marc:subfield[@code='o']"/>
1629                             </xsl:attribute>
1630                             <xsl:attribute name="data-notation">
1631                                 <xsl:value-of select="marc:subfield[@code='p']"/>
1632                             </xsl:attribute>
1633                         </div>
1634                         <xsl:if test="$OPACPlayMusicalInscripts = 1">
1635                             <div class="audio_controls hide">
1636                                 <button class="btn play_btn">
1637                                     <i id="carticon" class="fa fa-play"></i>
1638                                     <xsl:text> Play this sample</xsl:text>
1639                                 </button>
1640                             </div>
1641                         </xsl:if>
1642                     </xsl:if>
1643                 </span>
1644             </xsl:for-each>
1645             <xsl:if test="$OPACPlayMusicalInscripts = 1">
1646                 <div class="results_summary">
1647                     <span class="inscript_audio hide"></span>
1648                 </div>
1649             </xsl:if>
1650         </xsl:if>
1651
1652     </xsl:element>
1653     </xsl:template>
1654
1655     <xsl:template name="showAuthor">
1656         <xsl:param name="authorfield" />
1657         <xsl:param name="UseAuthoritiesForTracings" />
1658         <xsl:param name="materialTypeLabel" />
1659         <xsl:param name="theme" />
1660         <xsl:if test="count($authorfield)&gt;0">
1661         <span class="results_summary author h3">
1662             <xsl:for-each select="$authorfield">
1663                 <xsl:choose>
1664                     <xsl:when test="position()&gt;1"/>
1665                     <!-- #13383 -->
1666                     <xsl:when test="@tag&lt;700"><span class="byAuthor">By: </span></xsl:when>
1667                     <!--#13382 Changed Additional author to contributor -->
1668                     <xsl:otherwise>Contributor(s): </xsl:otherwise>
1669                 </xsl:choose>
1670             <xsl:choose>
1671                 <xsl:when test="not(@tag=111) or @tag=700 or @tag=710 or @tag=711"/>
1672                 <xsl:when test="marc:subfield[@code='n']">
1673                     <xsl:text> </xsl:text>
1674                     <xsl:call-template name="subfieldSelect">
1675                         <xsl:with-param name="codes">n</xsl:with-param>
1676                     </xsl:call-template>
1677                     <xsl:text> </xsl:text>
1678                 </xsl:when>
1679             </xsl:choose>
1680             <a>
1681                 <xsl:choose>
1682                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1683                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:"<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/>"</xsl:attribute>
1684                     </xsl:when>
1685                     <xsl:otherwise>
1686                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
1687                     </xsl:otherwise>
1688                 </xsl:choose>
1689                 <xsl:attribute name="class">contributors</xsl:attribute>
1690                 <span resource="#record"><span>
1691                     <xsl:choose>
1692                         <xsl:when test="substring(@tag, 1, 1)='1'">
1693                             <xsl:choose>
1694                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="property">byArtist</xsl:attribute></xsl:when>
1695                                 <xsl:otherwise><xsl:attribute name="property">author</xsl:attribute></xsl:otherwise>
1696                             </xsl:choose>
1697                         </xsl:when>
1698                         <xsl:otherwise><xsl:attribute name="property">contributor</xsl:attribute></xsl:otherwise>
1699                     </xsl:choose>
1700                     <xsl:choose>
1701                         <xsl:when test="substring(@tag, 2, 1)='0'">
1702                             <xsl:choose>
1703                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="typeof">MusicGroup</xsl:attribute></xsl:when>
1704                                 <xsl:otherwise><xsl:attribute name="typeof">Person</xsl:attribute></xsl:otherwise>
1705                             </xsl:choose>
1706                         </xsl:when>
1707                         <xsl:otherwise><xsl:attribute name="typeof">Organization</xsl:attribute></xsl:otherwise>
1708                     </xsl:choose>
1709                 <span property="name">
1710                 <xsl:choose>
1711                     <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1712                         <!-- #13383 -->
1713                         <xsl:call-template name="chopPunctuation">
1714                             <xsl:with-param name="chopString">
1715                                 <xsl:call-template name="subfieldSelect">
1716                                     <xsl:with-param name="codes">
1717                                         <xsl:choose>
1718                                             <!-- #13383 include subfield e for field 111, Display only name portion in 1XX  -->
1719                                             <xsl:when test="@tag=111">aeq</xsl:when>
1720                                             <xsl:when test="@tag=110">ab</xsl:when>
1721                                             <xsl:otherwise>abcjq</xsl:otherwise>
1722                                         </xsl:choose>
1723                                     </xsl:with-param>
1724                                 </xsl:call-template>
1725                             </xsl:with-param>
1726                             <xsl:with-param name="punctuation">
1727                                 <xsl:text>:,;/ </xsl:text>
1728                             </xsl:with-param>
1729                         </xsl:call-template>
1730                     <!-- Display only name and title portion in 110 field -->
1731                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1732                     <span class="titleportion">
1733                     <xsl:choose>
1734                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1735                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1736                     </xsl:choose>
1737                     <xsl:call-template name="chopPunctuation">
1738                         <xsl:with-param name="chopString">
1739                         <xsl:call-template name="subfieldSelect">
1740                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1741                         </xsl:call-template>
1742                         </xsl:with-param>
1743                     </xsl:call-template>
1744                     </span>
1745                     </xsl:if>
1746                     <!-- Display only name and title portion in 111 field -->
1747             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1748                     <span class="titleportion">
1749                     <xsl:choose>
1750                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1751                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1752                     </xsl:choose>
1753
1754                     <xsl:call-template name="chopPunctuation">
1755                         <xsl:with-param name="chopString">
1756                         <xsl:call-template name="subfieldSelect">
1757                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1758                         </xsl:call-template>
1759                         </xsl:with-param>
1760                     </xsl:call-template>
1761                     </span>
1762             </xsl:if>
1763             <!-- Display only dates in 100 field -->
1764                         <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1765                         <span class="authordates">
1766                         <xsl:text>, </xsl:text>
1767                         <xsl:call-template name="chopPunctuation">
1768                             <xsl:with-param name="chopString">
1769                             <xsl:call-template name="subfieldSelect">
1770                                <xsl:with-param name="codes">d</xsl:with-param>
1771                             </xsl:call-template>
1772                             </xsl:with-param>
1773                         </xsl:call-template>
1774                         </span>
1775                         </xsl:if>
1776                     </xsl:when>
1777                     <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1778                     <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1779                     <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1780                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1781                     <xsl:if test="@tag=710 or @tag=711">
1782                     <xsl:call-template name="chopPunctuation">
1783                         <xsl:with-param name="chopString">
1784                             <xsl:call-template name="subfieldSelect">
1785                             <xsl:with-param name="codes">
1786                             <xsl:choose>
1787                                 <xsl:when test="@tag=711">aeq</xsl:when>
1788                                 <xsl:otherwise>ab</xsl:otherwise>
1789                             </xsl:choose>
1790                             </xsl:with-param>
1791                             </xsl:call-template>
1792                         </xsl:with-param>
1793                         <xsl:with-param name="punctuation">
1794                             <xsl:text>:,;/ </xsl:text>
1795                         </xsl:with-param>
1796                     </xsl:call-template>
1797                     <!-- Display only name and title portion in 711 field -->
1798                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1799                     <span class="titleportion">
1800                     <xsl:choose>
1801                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1802                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1803                     </xsl:choose>
1804
1805                     <xsl:call-template name="chopPunctuation">
1806                         <xsl:with-param name="chopString">
1807                         <xsl:call-template name="subfieldSelect">
1808                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1809                         </xsl:call-template>
1810                         </xsl:with-param>
1811                     </xsl:call-template>
1812                     </span>
1813                     </xsl:if>
1814                     <!-- Display only name and title portion in 710 field -->
1815                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1816                     <span class="titleportion">
1817                     <xsl:choose>
1818                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1819                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1820                     </xsl:choose>
1821                     <xsl:call-template name="chopPunctuation">
1822                         <xsl:with-param name="chopString">
1823                         <xsl:call-template name="subfieldSelect">
1824                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1825                         </xsl:call-template>
1826                         </xsl:with-param>
1827                     </xsl:call-template>
1828                     </span>
1829                     </xsl:if>
1830
1831                     </xsl:if>
1832                         <!-- Display only name portion in 700 field -->
1833                         <xsl:if test="@tag=700">
1834                            <xsl:call-template name="chopPunctuation">
1835                                <xsl:with-param name="chopString">
1836                                <xsl:call-template name="subfieldSelect">
1837                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1838                                </xsl:call-template>
1839                                </xsl:with-param>
1840                         </xsl:call-template>
1841                         </xsl:if>
1842                         <!-- Display class "authordates" in 700 field -->
1843                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1844                         <span class="authordates">
1845                         <xsl:text>, </xsl:text>
1846                         <xsl:call-template name="chopPunctuation">
1847                             <xsl:with-param name="chopString">
1848                             <xsl:call-template name="subfieldSelect">
1849                                <xsl:with-param name="codes">d</xsl:with-param>
1850                             </xsl:call-template>
1851                             </xsl:with-param>
1852                         </xsl:call-template>
1853                         </span>
1854                         </xsl:if>
1855                         <!-- Display class "titleportion" in 700 field -->
1856                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1857                         <xsl:if test="@tag=700 and $titleportionfields">
1858                         <span class="titleportion">
1859                         <xsl:text>. </xsl:text>
1860                         <xsl:call-template name="chopPunctuation">
1861                             <xsl:with-param name="chopString">
1862                             <xsl:call-template name="subfieldSelect">
1863                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1864                             </xsl:call-template>
1865                             </xsl:with-param>
1866                         </xsl:call-template>
1867                         </span>
1868                         </xsl:if>
1869
1870                     </xsl:when>
1871                 </xsl:choose>
1872                 </span></span></span>
1873
1874                 <!-- #13383 include relator code j for field 111 also include 711$e 'Subordinate unit' -->
1875                 <xsl:if test="(@tag!=111 and @tag!=711 and marc:subfield[@code='4' or @code='e']) or ((@tag=111 or @tag=711) and marc:subfield[@code='4' or @code='j'])">
1876
1877                     <span class="relatorcode">
1878                         <xsl:text> [</xsl:text>
1879                         <xsl:choose>
1880                             <xsl:when test="@tag=111 or @tag=711">
1881                                 <xsl:choose>
1882                                     <!-- Prefer j over 4 for 111 and 711 -->
1883                                     <xsl:when test="marc:subfield[@code='j']">
1884                                         <xsl:for-each select="marc:subfield[@code='j']">
1885                                             <xsl:value-of select="."/>
1886                                             <xsl:if test="position() != last()">, </xsl:if>
1887                                         </xsl:for-each>
1888                                     </xsl:when>
1889                                     <xsl:otherwise>
1890                                         <xsl:for-each select="marc:subfield[@code=4]">
1891                                             <xsl:value-of select="."/>
1892                                             <xsl:if test="position() != last()">, </xsl:if>
1893                                         </xsl:for-each>
1894                                     </xsl:otherwise>
1895                                 </xsl:choose>
1896                             </xsl:when>
1897                             <!-- Prefer e over 4 on 100 and 110-->
1898                             <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1899                                 <xsl:for-each select="marc:subfield[@code='e']">
1900                                     <xsl:value-of select="."/>
1901                                     <xsl:if test="position() != last()">, </xsl:if>
1902                                 </xsl:for-each>
1903                             </xsl:when>
1904                             <xsl:otherwise>
1905                                 <xsl:for-each select="marc:subfield[@code=4]">
1906                                     <xsl:value-of select="."/>
1907                                     <xsl:if test="position() != last()">, </xsl:if>
1908                                 </xsl:for-each>
1909                             </xsl:otherwise>
1910                         </xsl:choose>
1911                         <xsl:text>]</xsl:text>
1912                     </span>
1913                 </xsl:if>
1914             </a>
1915             <xsl:if test="marc:subfield[@code=9]">
1916                 <a class='authlink'>
1917                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
1918                     <xsl:element name="i">
1919                         <xsl:attribute name="class">fa fa-search</xsl:attribute>
1920                     </xsl:element>
1921                 </a>
1922             </xsl:if>
1923                 <xsl:choose>
1924                     <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1925                 </xsl:choose>
1926             </xsl:for-each>
1927         </span>
1928         </xsl:if>
1929     </xsl:template>
1930
1931     <xsl:template name="nameABCQ">
1932             <xsl:call-template name="chopPunctuation">
1933                 <xsl:with-param name="chopString">
1934                     <xsl:call-template name="subfieldSelect">
1935                         <xsl:with-param name="codes">abcq</xsl:with-param>
1936                     </xsl:call-template>
1937                 </xsl:with-param>
1938                 <xsl:with-param name="punctuation">
1939                     <xsl:text>:,;/ </xsl:text>
1940                 </xsl:with-param>
1941             </xsl:call-template>
1942     </xsl:template>
1943
1944     <xsl:template name="nameABCDN">
1945             <xsl:call-template name="chopPunctuation">
1946                 <xsl:with-param name="chopString">
1947                     <xsl:call-template name="subfieldSelect">
1948                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1949                     </xsl:call-template>
1950                 </xsl:with-param>
1951                 <xsl:with-param name="punctuation">
1952                     <xsl:text>:,;/ </xsl:text>
1953                 </xsl:with-param>
1954             </xsl:call-template>
1955     </xsl:template>
1956
1957     <xsl:template name="nameACDEQ">
1958             <xsl:call-template name="subfieldSelect">
1959                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1960             </xsl:call-template>
1961     </xsl:template>
1962
1963     <xsl:template name="specialSubfieldSelect">
1964         <xsl:param name="anyCodes"/>
1965         <xsl:param name="axis"/>
1966         <xsl:param name="beforeCodes"/>
1967         <xsl:param name="afterCodes"/>
1968         <xsl:variable name="str">
1969             <xsl:for-each select="marc:subfield">
1970                 <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])">
1971                     <xsl:value-of select="text()"/>
1972                     <xsl:text> </xsl:text>
1973                 </xsl:if>
1974             </xsl:for-each>
1975         </xsl:variable>
1976         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1977     </xsl:template>
1978
1979     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1980     <xsl:template name="subfieldSelectSubject">
1981         <xsl:param name="codes"/>
1982         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1983         <xsl:param name="subdivCodes"/>
1984         <xsl:param name="subdivDelimiter"/>
1985         <xsl:param name="prefix"/>
1986         <xsl:param name="suffix"/>
1987         <xsl:param name="urlencode"/>
1988         <xsl:variable name="str">
1989             <xsl:for-each select="marc:subfield">
1990                 <xsl:if test="contains($codes, @code)">
1991                     <xsl:if test="contains($subdivCodes, @code)">
1992                         <xsl:value-of select="$subdivDelimiter"/>
1993                     </xsl:if>
1994                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1995                 </xsl:if>
1996             </xsl:for-each>
1997         </xsl:variable>
1998         <xsl:choose>
1999             <xsl:when test="$urlencode=1">
2000                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
2001             </xsl:when>
2002             <xsl:otherwise>
2003                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
2004             </xsl:otherwise>
2005         </xsl:choose>
2006     </xsl:template>
2007 </xsl:stylesheet>