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