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