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