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