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