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