Bug 13382 - RDA: 700/710/711 display in XSLT
[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   exclude-result-prefixes="marc items">
10     <xsl:import href="MARC21slimUtils.xsl"/>
11     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
12
13     <xsl:template match="/">
14             <xsl:apply-templates/>
15     </xsl:template>
16
17     <xsl:template match="marc:record">
18
19         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21
22     <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
23     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
24     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
25     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
26
27     <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
28     <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
29     <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
30     <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='OPACDisplay856uAsImage']"/>
31     <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>
32     <xsl:variable name="theme" select="marc:sysprefs/marc:syspref[@name='opacthemes']"/>
33     <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
34     <xsl:variable name="TracingQuotesLeft">
35       <xsl:choose>
36         <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
37         <xsl:otherwise>"</xsl:otherwise>
38       </xsl:choose>
39     </xsl:variable>
40     <xsl:variable name="TracingQuotesRight">
41       <xsl:choose>
42         <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
43         <xsl:otherwise>"</xsl:otherwise>
44       </xsl:choose>
45     </xsl:variable>
46         <xsl:variable name="leader" select="marc:leader"/>
47         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
48         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
49         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
50         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
51         <xsl:variable name="materialTypeCode">
52             <xsl:choose>
53                 <xsl:when test="$leader19='a'">ST</xsl:when>
54                 <xsl:when test="$leader6='a'">
55                     <xsl:choose>
56                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
57                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
58                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
59                     </xsl:choose>
60                 </xsl:when>
61                 <xsl:when test="$leader6='t'">BK</xsl:when>
62                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
63                 <xsl:when test="$leader6='m'">CF</xsl:when>
64                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
65                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
66                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
67                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
68             </xsl:choose>
69         </xsl:variable>
70         <xsl:variable name="materialTypeLabel">
71             <xsl:choose>
72                 <xsl:when test="$leader19='a'">Set</xsl:when>
73                 <xsl:when test="$leader6='a'">
74                     <xsl:choose>
75                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
76                         <xsl:when test="$leader7='i' or $leader7='s'">
77                             <xsl:choose>
78                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
79                                 <xsl:otherwise>Series</xsl:otherwise>
80                             </xsl:choose>
81                         </xsl:when>
82                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
83                     </xsl:choose>
84                 </xsl:when>
85                 <xsl:when test="$leader6='t'">Book</xsl:when>
86                                 <xsl:when test="$leader6='o'">Kit</xsl:when>
87                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
88                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
89                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
90                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual material</xsl:when>
91                 <xsl:when test="$leader6='j'">Music</xsl:when>
92                 <xsl:when test="$leader6='i'">Sound</xsl:when>
93                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
94             </xsl:choose>
95         </xsl:variable>
96
97         <!-- Schema.org type -->
98         <xsl:variable name="schemaOrgType">
99             <xsl:choose>
100                 <xsl:when test="$materialTypeLabel='Book'">Book</xsl:when>
101                 <xsl:when test="$materialTypeLabel='Map'">Map</xsl:when>
102                 <xsl:when test="$materialTypeLabel='Music'">MusicAlbum</xsl:when>
103                 <xsl:otherwise>CreativeWork</xsl:otherwise>
104             </xsl:choose>
105         </xsl:variable>
106
107         <!-- Wrapper div for our schema.org object -->
108         <xsl:element name="div">
109             <xsl:attribute name="class">record</xsl:attribute>
110             <xsl:attribute name="vocab">http://schema.org/</xsl:attribute>
111             <xsl:attribute name="typeof"><xsl:value-of select='$schemaOrgType' /> Product</xsl:attribute>
112             <xsl:attribute name="resource">#record</xsl:attribute>
113
114         <!-- Title Statement -->
115         <!-- Alternate Graphic Representation (MARC 880) -->
116         <xsl:if test="$display880">
117             <h1 class="title" property="alternateName">
118                 <xsl:call-template name="m880Select">
119                     <xsl:with-param name="basetags">245</xsl:with-param>
120                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
121                 </xsl:call-template>
122             </h1>
123         </xsl:if>
124
125             <!--Bug 13381 -->
126             <xsl:if test="marc:datafield[@tag=245]">
127                 <h1 class="title" property="name">
128                     <xsl:for-each select="marc:datafield[@tag=245]">
129                         <xsl:call-template name="subfieldSelect">
130                             <xsl:with-param name="codes">a</xsl:with-param>
131                         </xsl:call-template>
132                         <xsl:text> </xsl:text>
133                         <!-- 13381 add additional subfields-->
134                         <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
135                             <xsl:choose>
136                                 <xsl:when test="@code='h'">
137                                     <!--  13381 Span class around subfield h so it can be suppressed via css -->
138                                     <span class="title_medium"><xsl:apply-templates/> </span>
139                                 </xsl:when>
140                                 <xsl:when test="@code='c'">
141                                     <!--  13381 Span class around subfield c so it can be suppressed via css -->
142                                     <span class="title_resp_stmt"><xsl:apply-templates/> </span>
143                                 </xsl:when>
144                                 <xsl:otherwise>
145                                     <xsl:apply-templates/>
146                                     <xsl:text> </xsl:text>
147                                 </xsl:otherwise>
148                             </xsl:choose>
149                         </xsl:for-each>
150                     </xsl:for-each>
151                 </h1>
152             </xsl:if>
153
154
155         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
156         <xsl:if test="$display880">
157             <h5 class="author">
158                 <xsl:call-template name="m880Select">
159                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
160                     <xsl:with-param name="codes">abc</xsl:with-param>
161                     <xsl:with-param name="index">au</xsl:with-param>
162                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
163                 </xsl:call-template>
164             </h5>
165         </xsl:if>
166
167         <!--#13382 Added Author Statement to seperate Authors and Contributors -->
168         <xsl:call-template name="showAuthor">
169             <xsl:with-param name="authorfield" select="marc:datafield[(@tag=100 or @tag=110 or @tag=111)]"/>
170             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
171             <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
172             <xsl:with-param name="theme" select="$theme"/>
173         </xsl:call-template>
174
175         <xsl:call-template name="showAuthor">
176             <!-- #13382 suppress 700$i and 7xx/@ind2=2 -->
177             <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'])]"/>
178             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
179         </xsl:call-template>
180
181    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
182         <xsl:if test="$materialTypeCode!=''">
183         <span class="results_summary type"><span class="label">Material type: </span>
184         <xsl:element name="img"><xsl:attribute name="src">/opac-tmpl/lib/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt">materialTypeLabel</xsl:attribute><xsl:attribute name="class">materialtype</xsl:attribute></xsl:element>
185         <xsl:value-of select="$materialTypeLabel"/>
186         </span>
187         </xsl:if>
188    </xsl:if>
189
190         <!--Series: Alternate Graphic Representation (MARC 880) -->
191         <xsl:if test="$display880">
192             <xsl:call-template name="m880Select">
193                 <xsl:with-param name="basetags">440,490</xsl:with-param>
194                 <xsl:with-param name="codes">av</xsl:with-param>
195                 <xsl:with-param name="class">results_summary series</xsl:with-param>
196                 <xsl:with-param name="label">Series: </xsl:with-param>
197                 <xsl:with-param name="index">se</xsl:with-param>
198             </xsl:call-template>
199         </xsl:if>
200
201         <!-- Series -->
202         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
203         <span class="results_summary series"><span class="label">Series: </span>
204         <!-- 440 -->
205         <xsl:for-each select="marc:datafield[@tag=440]">
206             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
207             <xsl:call-template name="chopPunctuation">
208                             <xsl:with-param name="chopString">
209                                 <xsl:call-template name="subfieldSelect">
210                                     <xsl:with-param name="codes">av</xsl:with-param>
211                                 </xsl:call-template>
212                             </xsl:with-param>
213                         </xsl:call-template>
214             </a>
215             <xsl:call-template name="part"/>
216             <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
217         </xsl:for-each>
218
219         <!-- 490 Series not traced, Ind1 = 0 -->
220         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
221             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
222                         <xsl:call-template name="chopPunctuation">
223                             <xsl:with-param name="chopString">
224                                 <xsl:call-template name="subfieldSelect">
225                                     <xsl:with-param name="codes">av</xsl:with-param>
226                                 </xsl:call-template>
227                             </xsl:with-param>
228                         </xsl:call-template>
229             </a>
230                     <xsl:call-template name="part"/>
231         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
232         </xsl:for-each>
233         <!-- 490 Series traced, Ind1 = 1 -->
234         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
235             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
236                 <xsl:choose>
237                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
238                         <a href="/cgi-bin/koha/opac-search.pl?q=rcn:{marc:subfield[@code='w']}">
239                             <xsl:call-template name="chopPunctuation">
240                                 <xsl:with-param name="chopString">
241                                     <xsl:call-template name="subfieldSelect">
242                                         <xsl:with-param name="codes">a_t</xsl:with-param>
243                                     </xsl:call-template>
244                                 </xsl:with-param>
245                             </xsl:call-template>
246                         </a>
247                     </xsl:when>
248                     <xsl:otherwise>
249                         <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
250                             <xsl:call-template name="chopPunctuation">
251                                 <xsl:with-param name="chopString">
252                                     <xsl:call-template name="subfieldSelect">
253                                         <xsl:with-param name="codes">a_t</xsl:with-param>
254                                     </xsl:call-template>
255                                 </xsl:with-param>
256                             </xsl:call-template>
257                         </a>
258                         <xsl:call-template name="part"/>
259                     </xsl:otherwise>
260                 </xsl:choose>
261                 <xsl:text>: </xsl:text>
262                 <xsl:value-of  select="marc:subfield[@code='v']" />
263             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
264             </xsl:for-each>
265         </xsl:if>
266         </span>
267         </xsl:if>
268
269         <!-- Analytics -->
270         <xsl:if test="$leader7='s'">
271         <span class="results_summary analytics"><span class="label">Analytics: </span>
272             <a>
273             <xsl:choose>
274             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
275                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
276             </xsl:when>
277             <xsl:otherwise>
278                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
279             </xsl:otherwise>
280             </xsl:choose>
281             <xsl:text>Show analytics</xsl:text>
282             </a>
283         </span>
284         </xsl:if>
285
286         <!-- Volumes of sets and traced series -->
287         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
288         <span class="results_summary volumes"><span class="label">Volumes: </span>
289             <a>
290             <xsl:choose>
291             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
292                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute>
293             </xsl:when>
294             <xsl:otherwise>
295                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
296             </xsl:otherwise>
297             </xsl:choose>
298             <xsl:text>Show volumes</xsl:text>
299             </a>
300         </span>
301         </xsl:if>
302
303         <!-- Set -->
304         <xsl:if test="$leader19='c'">
305         <span class="results_summary set"><span class="label">Set: </span>
306         <xsl:for-each select="marc:datafield[@tag=773]">
307             <a>
308             <xsl:choose>
309             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
310                 <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>
311             </xsl:when>
312             <xsl:otherwise>
313                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
314             </xsl:otherwise>
315             </xsl:choose>
316             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
317             </a>
318             <xsl:choose>
319                 <xsl:when test="position()=last()"></xsl:when>
320                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
321             </xsl:choose>
322         </xsl:for-each>
323         </span>
324         </xsl:if>
325
326         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
327         <xsl:if test="$display880">
328             <xsl:call-template name="m880Select">
329                 <xsl:with-param name="basetags">260</xsl:with-param>
330                 <xsl:with-param name="codes">abcg</xsl:with-param>
331                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
332                 <xsl:with-param name="label">Publisher: </xsl:with-param>
333             </xsl:call-template>
334         </xsl:if>
335
336         <!-- Publisher info and RDA related info from tags 260, 264 -->
337         <xsl:choose>
338         <xsl:when test="marc:datafield[@tag=260]">
339         <span class="results_summary publisher"><span class="label">Publisher: </span>
340             <xsl:for-each select="marc:datafield[@tag=260]">
341                 <span property="publisher" typeof="Organization">
342                 <xsl:if test="marc:subfield[@code='a']">
343                     <span property="location">
344                     <xsl:call-template name="subfieldSelect">
345                         <xsl:with-param name="codes">a</xsl:with-param>
346                     </xsl:call-template>
347                     </span>
348                 </xsl:if>
349                 <xsl:text> </xsl:text>
350                 <xsl:if test="marc:subfield[@code='b']">
351                 <span property="name"><a href="/cgi-bin/koha/opac-search.pl?q=pb:{marc:subfield[@code='b']}">
352                     <xsl:call-template name="subfieldSelect">
353                         <xsl:with-param name="codes">b</xsl:with-param>
354                     </xsl:call-template>
355                 </a></span>
356                 </xsl:if>
357                 </span>
358                 <xsl:text> </xsl:text>
359                 <xsl:if test="marc:subfield[@code='c' or @code='g']">
360                 <span property="datePublished">
361                     <xsl:call-template name="chopPunctuation">
362                       <xsl:with-param name="chopString">
363                         <xsl:call-template name="subfieldSelect">
364                             <xsl:with-param name="codes">cg</xsl:with-param>
365                         </xsl:call-template>
366                        </xsl:with-param>
367                    </xsl:call-template>
368                 </span>
369                 </xsl:if>
370                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
371             </xsl:for-each>
372             <xsl:if test="marc:datafield[@tag=264]">
373                 <xsl:text>; </xsl:text>
374                 <xsl:call-template name="showRDAtag264"/>
375             </xsl:if>
376         </span>
377         </xsl:when>
378         <xsl:when test="marc:datafield[@tag=264]">
379             <span class="results_summary">
380                 <xsl:call-template name="showRDAtag264"/>
381             </span>
382         </xsl:when>
383         </xsl:choose>
384
385         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
386         <xsl:if test="$display880">
387             <xsl:call-template name="m880Select">
388                 <xsl:with-param name="basetags">250</xsl:with-param>
389                 <xsl:with-param name="codes">ab</xsl:with-param>
390                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
391                 <xsl:with-param name="label">Edition: </xsl:with-param>
392             </xsl:call-template>
393         </xsl:if>
394
395         <xsl:if test="marc:datafield[@tag=250]">
396         <span class="results_summary edition"><span class="label">Edition: </span>
397             <xsl:for-each select="marc:datafield[@tag=250]">
398                 <span property="bookEdition">
399                 <xsl:call-template name="chopPunctuation">
400                   <xsl:with-param name="chopString">
401                     <xsl:call-template name="subfieldSelect">
402                         <xsl:with-param name="codes">ab</xsl:with-param>
403                     </xsl:call-template>
404                    </xsl:with-param>
405                </xsl:call-template>
406                 </span>
407                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
408             </xsl:for-each>
409         </span>
410         </xsl:if>
411
412         <!-- Description: Alternate Graphic Representation (MARC 880) -->
413         <xsl:if test="$display880">
414             <xsl:call-template name="m880Select">
415                 <xsl:with-param name="basetags">300</xsl:with-param>
416                 <xsl:with-param name="codes">abceg</xsl:with-param>
417                 <xsl:with-param name="class">results_summary description</xsl:with-param>
418                 <xsl:with-param name="label">Description: </xsl:with-param>
419             </xsl:call-template>
420         </xsl:if>
421
422         <xsl:if test="marc:datafield[@tag=300]">
423         <span class="results_summary description"><span class="label">Description: </span>
424             <xsl:for-each select="marc:datafield[@tag=300]">
425                 <span property="description">
426                 <xsl:call-template name="chopPunctuation">
427                   <xsl:with-param name="chopString">
428                     <xsl:call-template name="subfieldSelect">
429                         <xsl:with-param name="codes">abceg</xsl:with-param>
430                     </xsl:call-template>
431                    </xsl:with-param>
432                </xsl:call-template>
433                 </span>
434                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
435             </xsl:for-each>
436         </span>
437        </xsl:if>
438
439         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
440           <span class="results_summary isbn"><span class="label">ISBN: </span>
441             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
442               <span property="isbn">
443                 <xsl:value-of select="."/>
444                 <xsl:choose>
445                   <xsl:when test="position()=last()">
446                     <xsl:text>.</xsl:text>
447                   </xsl:when>
448                   <xsl:otherwise>
449                     <xsl:text>; </xsl:text>
450                   </xsl:otherwise>
451                 </xsl:choose>
452               </span>
453             </xsl:for-each>
454           </span>
455         </xsl:if>
456
457         <!-- Build ISSN -->
458         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
459           <span class="results_summary issn"><span class="label">ISSN: </span>
460             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
461               <span property="issn">
462                 <xsl:value-of select="."/>
463                 <xsl:choose>
464                   <xsl:when test="position()=last()">
465                     <xsl:text>.</xsl:text>
466                   </xsl:when>
467                   <xsl:otherwise>
468                     <xsl:text>; </xsl:text>
469                   </xsl:otherwise>
470                 </xsl:choose>
471               </span>
472             </xsl:for-each>
473           </span>
474         </xsl:if>
475
476         <xsl:if test="marc:datafield[@tag=013]">
477             <span class="results_summary patent_info">
478                 <span class="label">Patent information: </span>
479                 <xsl:for-each select="marc:datafield[@tag=013]">
480                     <xsl:call-template name="subfieldSelect">
481                         <xsl:with-param name="codes">acdef</xsl:with-param>
482                         <xsl:with-param name="delimeter">, </xsl:with-param>
483                     </xsl:call-template>
484                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
485                 </xsl:for-each>
486             </span>
487         </xsl:if>
488
489         <xsl:if test="marc:datafield[@tag=088]">
490             <span class="results_summary report_number">
491                 <span class="label">Report number: </span>
492                 <xsl:for-each select="marc:datafield[@tag=088]">
493                     <xsl:call-template name="subfieldSelect">
494                         <xsl:with-param name="codes">a</xsl:with-param>
495                     </xsl:call-template>
496                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
497                 </xsl:for-each>
498             </span>
499         </xsl:if>
500
501         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
502         <xsl:if test="$display880">
503             <xsl:call-template name="m880Select">
504                 <xsl:with-param name="basetags">246</xsl:with-param>
505                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
506                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
507                 <xsl:with-param name="label">Other title: </xsl:with-param>
508             </xsl:call-template>
509         </xsl:if>
510
511         <xsl:if test="marc:datafield[@tag=246]">
512         <span class="results_summary other_title"><span class="label">Other title: </span>
513             <xsl:for-each select="marc:datafield[@tag=246]">
514                 <span property="alternateName">
515                 <xsl:call-template name="chopPunctuation">
516                   <xsl:with-param name="chopString">
517                     <xsl:call-template name="subfieldSelect">
518                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
519                     </xsl:call-template>
520                    </xsl:with-param>
521                </xsl:call-template>
522                 </span>
523                 <!-- #13386 added separator | -->
524                 <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>
525             </xsl:for-each>
526         </span>
527        </xsl:if>
528
529
530         <xsl:if test="marc:datafield[@tag=242]">
531         <span class="results_summary translated_title"><span class="label">Title translated: </span>
532             <xsl:for-each select="marc:datafield[@tag=242]">
533                 <span property="alternateName">
534                 <xsl:call-template name="chopPunctuation">
535                   <xsl:with-param name="chopString">
536                     <xsl:call-template name="subfieldSelect">
537                         <xsl:with-param name="codes">abchnp</xsl:with-param>
538                     </xsl:call-template>
539                    </xsl:with-param>
540                </xsl:call-template>
541                 </span>
542                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
543             </xsl:for-each>
544         </span>
545        </xsl:if>
546
547         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
548         <xsl:if test="$display880">
549             <span property="alternateName">
550             <xsl:call-template name="m880Select">
551                 <xsl:with-param name="basetags">130,240</xsl:with-param>
552                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
553                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
554                 <xsl:with-param name="label">Uniform titles: </xsl:with-param>
555             </xsl:call-template>
556             </span>
557         </xsl:if>
558
559         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
560         <span class="results_summary uniform_titles"><span class="label">Uniform titles: </span>
561         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
562             <span property="alternateName">
563             <xsl:variable name="str">
564                 <xsl:for-each select="marc:subfield">
565                     <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
566                         <xsl:value-of select="text()"/>
567                         <xsl:text> </xsl:text>
568                      </xsl:if>
569                 </xsl:for-each>
570             </xsl:variable>
571             <xsl:call-template name="chopPunctuation">
572                 <xsl:with-param name="chopString">
573                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
574
575                 </xsl:with-param>
576             </xsl:call-template>
577             </span>
578             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
579         </xsl:for-each>
580         </span>
581         </xsl:if>
582
583
584             <!-- #13382 Added Related works 700$i -->
585             <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']]">
586                 <span class="results_summary related_works"><span class="label">Related Works: </span>
587                     <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']]">
588                         <xsl:variable name="str">
589                             <xsl:call-template name="subfieldSelect">
590                                 <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
591                             </xsl:call-template>
592                         </xsl:variable>
593                         <xsl:call-template name="chopPunctuation">
594                             <xsl:with-param name="chopString">
595                                 <xsl:value-of select="$str"/>
596                             </xsl:with-param>
597                         </xsl:call-template>
598                         <!-- add relator code too between brackets-->
599                         <xsl:if test="marc:subfield[@code='4' or @code='e']">
600                             <span class="relatorcode">
601                                 <xsl:text> [</xsl:text>
602                                 <xsl:choose>
603                                     <xsl:when test="marc:subfield[@code='e']">
604                                         <xsl:for-each select="marc:subfield[@code='e']">
605                                             <xsl:value-of select="."/>
606                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
607                                         </xsl:for-each>
608                                     </xsl:when>
609                                     <xsl:otherwise>
610                                         <xsl:for-each select="marc:subfield[@code='4']">
611                                             <xsl:value-of select="."/>
612                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
613                                         </xsl:for-each>
614                                     </xsl:otherwise>
615                                 </xsl:choose>
616                                 <xsl:text>]</xsl:text>
617                             </span>
618                         </xsl:if>
619                         <xsl:choose>
620                             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
621                         </xsl:choose>
622                     </xsl:for-each>
623                 </span>
624             </xsl:if>
625
626             <!-- #13382 Added Contained Works 7xx@ind2=2 -->
627             <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'])]">
628                 <span class="results_summary contained_works"><span class="label">Contained Works: </span>
629                     <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'])]">
630                         <xsl:variable name="str">
631                             <xsl:call-template name="subfieldSelect">
632                                 <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
633                             </xsl:call-template>
634                         </xsl:variable>
635                         <xsl:call-template name="chopPunctuation">
636                             <xsl:with-param name="chopString">
637                                 <xsl:value-of select="$str"/>
638                             </xsl:with-param>
639                         </xsl:call-template>
640                         <!-- add relator code too between brackets-->
641                         <xsl:if test="marc:subfield[@code='4' or @code='e']">
642                             <span class="relatorcode">
643                                 <xsl:text> [</xsl:text>
644                                 <xsl:choose>
645                                     <xsl:when test="marc:subfield[@code='e']">
646                                         <xsl:for-each select="marc:subfield[@code='e']">
647                                             <xsl:value-of select="."/>
648                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
649                                         </xsl:for-each>
650                                     </xsl:when>
651                                     <xsl:otherwise>
652                                         <xsl:for-each select="marc:subfield[@code='4']">
653                                             <xsl:value-of select="."/>
654                                             <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
655                                         </xsl:for-each>
656                                     </xsl:otherwise>
657                                 </xsl:choose>
658                                 <xsl:text>]</xsl:text>
659                             </span>
660                         </xsl:if>
661                         <xsl:choose>
662                             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
663                         </xsl:choose>
664                     </xsl:for-each>
665                 </span>
666             </xsl:if>
667
668             <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
669             <span class="results_summary subjects"><span class="label">Subject(s): </span>
670                 <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
671             <span property="keywords">
672             <a>
673             <xsl:choose>
674             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
675                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
676             </xsl:when>
677             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
678             <xsl:when test="$TraceSubjectSubdivisions='1'">
679                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
680                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
681                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
682                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
683                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
684                     </xsl:call-template>
685                 </xsl:attribute>
686             </xsl:when>
687                 <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
688             <xsl:otherwise>
689                 <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="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
690             </xsl:otherwise>
691             </xsl:choose>
692             <xsl:call-template name="chopPunctuation">
693                 <xsl:with-param name="chopString">
694                     <xsl:call-template name="subfieldSelect">
695                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
696                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
697                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
698                     </xsl:call-template>
699                 </xsl:with-param>
700             </xsl:call-template>
701             </a>
702             </span>
703             <xsl:if test="marc:subfield[@code=9]">
704                 <a class='authlink'>
705                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
706                     <xsl:element name="img">
707                         <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
708                         <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
709                         <xsl:attribute name="height">15</xsl:attribute>
710                         <xsl:attribute name="width">15</xsl:attribute>
711                     </xsl:element>
712                 </a>
713             </xsl:if>
714             <xsl:choose>
715             <xsl:when test="position()=last()"></xsl:when>
716             <xsl:otherwise> | </xsl:otherwise>
717             </xsl:choose>
718
719             </xsl:for-each>
720             </span>
721         </xsl:if>
722
723             <!-- Genre/Form -->
724             <xsl:if test="marc:datafield[@tag=655]">
725                 <span class="results_summary genre"><span class="label">Genre/Form: </span>
726                     <xsl:for-each select="marc:datafield[@tag=655]">
727                         <a>
728                             <xsl:choose>
729                                 <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
730                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
731                                 </xsl:when>
732                                 <xsl:when test="$TraceSubjectSubdivisions='1'">
733                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelect">
734                                         <xsl:with-param name="codes">avxyz</xsl:with-param>
735                                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
736                                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
737                                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
738                                     </xsl:call-template>
739                                     </xsl:attribute>
740                                 </xsl:when>
741                                 <xsl:otherwise>
742                                     <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="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
743                                 </xsl:otherwise>
744                             </xsl:choose>
745                         </a>
746                         <xsl:call-template name="subfieldSelect">
747                             <xsl:with-param name="codes">avxyz</xsl:with-param>
748                             <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
749                             <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
750                         </xsl:call-template>
751                         <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
752                     </xsl:for-each>
753                 </span>
754             </xsl:if>
755
756 <!-- DDC classification -->
757     <xsl:if test="marc:datafield[@tag=082]">
758         <span class="results_summary ddc">
759             <span class="label">DDC classification: </span>
760             <xsl:for-each select="marc:datafield[@tag=082]">
761                 <xsl:call-template name="subfieldSelect">
762                     <xsl:with-param name="codes">a</xsl:with-param>
763                 </xsl:call-template>
764                 <xsl:choose>
765                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
766                     <xsl:otherwise> | </xsl:otherwise>
767                 </xsl:choose>
768             </xsl:for-each>
769         </span>
770     </xsl:if>
771
772
773 <!-- Image processing code added here, takes precedence over text links including y3z text   -->
774         <xsl:if test="marc:datafield[@tag=856]">
775         <span class="results_summary online_resources"><span class="label">Online resources: </span>
776         <xsl:for-each select="marc:datafield[@tag=856]">
777             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
778             <a property="url">
779             <xsl:choose>
780               <xsl:when test="$OPACTrackClicks='track'">
781                 <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="marc:subfield[@code='u']"/>;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
782               </xsl:when>
783               <xsl:when test="$OPACTrackClicks='anonymous'">
784                 <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="marc:subfield[@code='u']"/>;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
785               </xsl:when>
786               <xsl:otherwise>
787                 <xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
788               </xsl:otherwise>
789             </xsl:choose>
790             <xsl:if test="$OPACURLOpenInNewWindow='1'">
791                 <xsl:attribute name="target">_blank</xsl:attribute>
792             </xsl:if>
793             <xsl:choose>
794             <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')">
795                 <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>
796             </xsl:when>
797             <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
798                 <xsl:call-template name="subfieldSelect">
799                     <xsl:with-param name="codes">y3z</xsl:with-param>
800                 </xsl:call-template>
801             </xsl:when>
802             <xsl:when test="$URLLinkText!=''">
803                 <xsl:value-of select="$URLLinkText"/>
804             </xsl:when>
805             <xsl:otherwise>
806                 <xsl:text>Click here to access online</xsl:text>
807             </xsl:otherwise>
808             </xsl:choose>
809             </a>
810             <xsl:choose>
811             <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
812             <xsl:otherwise> | </xsl:otherwise>
813             </xsl:choose>
814         </xsl:for-each>
815         </span>
816         </xsl:if>
817
818         <!-- 530 -->
819         <xsl:if test="marc:datafield[@tag=530]">
820         <xsl:for-each select="marc:datafield[@tag=530]">
821         <span class="results_summary additionalforms">
822             <xsl:call-template name="subfieldSelect">
823                 <xsl:with-param name="codes">abcd</xsl:with-param>
824             </xsl:call-template>
825             <xsl:for-each select="marc:subfield[@code='u']">
826                 <a><xsl:attribute name="href"><xsl:value-of select="text()"/></xsl:attribute>
827                 <xsl:if test="$OPACURLOpenInNewWindow='1'">
828                     <xsl:attribute name="target">_blank</xsl:attribute>
829                 </xsl:if>
830                 <xsl:value-of select="text()"/>
831                 </a>
832             </xsl:for-each>
833         </span>
834         </xsl:for-each>
835         </xsl:if>
836
837         <!-- 505 -->
838         <xsl:if test="marc:datafield[@tag=505]">
839         <div class="results_summary contents">
840         <xsl:for-each select="marc:datafield[@tag=505]">
841         <xsl:if test="position()=1">
842             <xsl:choose>
843             <xsl:when test="@ind1=1">
844                 <span class="label">Incomplete contents:</span>
845             </xsl:when>
846             <xsl:when test="@ind1=2">
847                 <span class="label">Partial contents:</span>
848             </xsl:when>
849             <xsl:otherwise>
850                 <span class="label">Contents:</span>
851             </xsl:otherwise>
852             </xsl:choose>
853         </xsl:if>
854         <div class='contentblock' property='description'>
855         <xsl:choose>
856         <xsl:when test="@ind2=0">
857             <xsl:call-template name="subfieldSelectSpan">
858                 <xsl:with-param name="codes">tru</xsl:with-param>
859             </xsl:call-template>
860         </xsl:when>
861         <xsl:otherwise>
862             <xsl:call-template name="subfieldSelectSpan">
863                 <xsl:with-param name="codes">atru</xsl:with-param>
864             </xsl:call-template>
865         </xsl:otherwise>
866         </xsl:choose>
867         </div>
868         </xsl:for-each>
869         </div>
870         </xsl:if>
871
872         <!-- 583 -->
873         <xsl:if test="marc:datafield[@tag=583]">
874         <xsl:for-each select="marc:datafield[@tag=583]">
875             <xsl:if test="@ind1=1 or @ind1=' '">
876             <span class="results_summary actionnote">
877                 <xsl:choose>
878                 <xsl:when test="marc:subfield[@code='z']">
879                     <xsl:value-of select="marc:subfield[@code='z']"/>
880                 </xsl:when>
881                 <xsl:otherwise>
882                     <xsl:call-template name="subfieldSelect">
883                         <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
884                     </xsl:call-template>
885                 </xsl:otherwise>
886                 </xsl:choose>
887             </span>
888             </xsl:if>
889         </xsl:for-each>
890         </xsl:if>
891
892         <!-- 508 -->
893             <xsl:if test="marc:datafield[@tag=508]">
894                 <div class="results_summary prod_credits">
895                     <span class="label">Production Credits: </span>
896                     <xsl:for-each select="marc:datafield[@tag=508]">
897                         <xsl:call-template name="subfieldSelectSpan">
898                             <xsl:with-param name="codes">a</xsl:with-param>
899                         </xsl:call-template>
900                     </xsl:for-each>
901                 </div>
902             </xsl:if>
903
904         <!-- 586 -->
905         <xsl:if test="marc:datafield[@tag=586]">
906             <span class="results_summary awardsnote">
907                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
908                     <span class="label">Awards: </span>
909                 </xsl:if>
910                 <xsl:for-each select="marc:datafield[@tag=586]">
911                     <xsl:value-of select="marc:subfield[@code='a']"/>
912                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
913                 </xsl:for-each>
914             </span>
915         </xsl:if>
916
917         <!-- 773 -->
918         <xsl:if test="marc:datafield[@tag=773]">
919         <xsl:for-each select="marc:datafield[@tag=773]">
920         <xsl:if test="@ind1=0">
921         <span class="results_summary in"><span class="label">
922         <xsl:choose>
923         <xsl:when test="@ind2=' '">
924             In:
925         </xsl:when>
926         <xsl:when test="@ind2=8">
927             <xsl:if test="marc:subfield[@code='i']">
928                 <xsl:value-of select="marc:subfield[@code='i']"/>
929             </xsl:if>
930         </xsl:when>
931         </xsl:choose>
932         </span>
933                 <xsl:variable name="f773">
934                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
935                         <xsl:with-param name="codes">a_t</xsl:with-param>
936                     </xsl:call-template></xsl:with-param></xsl:call-template>
937                 </xsl:variable>
938             <xsl:choose>
939                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
940                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
941                         <xsl:value-of select="translate($f773, '()', '')"/>
942                     </a>
943                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
944                 </xsl:when>
945                 <xsl:when test="marc:subfield[@code='0']">
946                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
947                         <xsl:value-of select="$f773"/>
948                     </a>
949                 </xsl:when>
950                 <xsl:otherwise>
951                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
952                         <xsl:value-of select="$f773"/>
953                     </a>
954                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
955                 </xsl:otherwise>
956             </xsl:choose>
957         </span>
958
959         <xsl:if test="marc:subfield[@code='n']">
960             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
961         </xsl:if>
962
963         </xsl:if>
964         </xsl:for-each>
965         </xsl:if>
966
967         <xsl:for-each select="marc:datafield[@tag=511]">
968             <span class="results_summary perf_note">
969                 <span class="label">
970                     <xsl:if test="@ind1=1"><xsl:text>Cast: </xsl:text></xsl:if>
971                 </span>
972                 <xsl:call-template name="subfieldSelect">
973                     <xsl:with-param name="codes">a</xsl:with-param>
974                 </xsl:call-template>
975             </span>
976         </xsl:for-each>
977
978         <xsl:if test="marc:datafield[@tag=502]">
979             <span class="results_summary diss_note">
980                 <span class="label">Dissertation note: </span>
981                 <xsl:for-each select="marc:datafield[@tag=502]">
982                     <xsl:call-template name="subfieldSelect">
983                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
984                     </xsl:call-template>
985                 </xsl:for-each>
986                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
987             </span>
988         </xsl:if>
989
990         <xsl:for-each select="marc:datafield[@tag=520]">
991         <span class="results_summary summary"><span class="label">
992         <xsl:choose>
993           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
994           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
995           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
996           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
997           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
998           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
999         </xsl:choose>
1000         </span>
1001         <xsl:call-template name="subfieldSelect">
1002           <xsl:with-param name="codes">abcu</xsl:with-param>
1003         </xsl:call-template>
1004         </span>
1005         </xsl:for-each>
1006
1007         <!-- 866 textual holdings -->
1008         <xsl:if test="marc:datafield[@tag=866]">
1009             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
1010                 <xsl:for-each select="marc:datafield[@tag=866]">
1011                     <xsl:call-template name="subfieldSelect">
1012                         <xsl:with-param name="codes">az</xsl:with-param>
1013                     </xsl:call-template>
1014                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1015                 </xsl:for-each>
1016             </span>
1017         </xsl:if>
1018
1019         <!--  775 Other Edition  -->
1020         <xsl:if test="marc:datafield[@tag=775]">
1021         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1022         <xsl:for-each select="marc:datafield[@tag=775]">
1023             <xsl:variable name="f775">
1024                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1025                 <xsl:with-param name="codes">a_t</xsl:with-param>
1026                 </xsl:call-template></xsl:with-param></xsl:call-template>
1027             </xsl:variable>
1028             <xsl:if test="marc:subfield[@code='i']">
1029                 <xsl:call-template name="subfieldSelect">
1030                     <xsl:with-param name="codes">i</xsl:with-param>
1031                 </xsl:call-template>
1032                 <xsl:text>: </xsl:text>
1033             </xsl:if>
1034             <a>
1035             <xsl:choose>
1036             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1037                 <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>
1038             </xsl:when>
1039             <xsl:otherwise>
1040                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
1041             </xsl:otherwise>
1042             </xsl:choose>
1043             <xsl:call-template name="subfieldSelect">
1044                 <xsl:with-param name="codes">a_t</xsl:with-param>
1045             </xsl:call-template>
1046             </a>
1047             <xsl:choose>
1048                 <xsl:when test="position()=last()"></xsl:when>
1049                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1050             </xsl:choose>
1051         </xsl:for-each>
1052         </span>
1053         </xsl:if>
1054
1055         <!-- 780 -->
1056         <xsl:if test="marc:datafield[@tag=780]">
1057         <xsl:for-each select="marc:datafield[@tag=780]">
1058         <xsl:if test="@ind1=0">
1059         <span class="results_summary preceeding_entry">
1060         <xsl:choose>
1061         <xsl:when test="@ind2=0">
1062             <span class="label">Continues:</span>
1063         </xsl:when>
1064         <xsl:when test="@ind2=1">
1065             <span class="label">Continues in part:</span>
1066         </xsl:when>
1067         <xsl:when test="@ind2=2">
1068             <span class="label">Supersedes:</span>
1069         </xsl:when>
1070         <xsl:when test="@ind2=3">
1071             <span class="label">Supersedes in part:</span>
1072         </xsl:when>
1073         <xsl:when test="@ind2=4">
1074             <span class="label">Formed by the union: ... and: ...</span>
1075         </xsl:when>
1076         <xsl:when test="@ind2=5">
1077             <span class="label">Absorbed:</span>
1078         </xsl:when>
1079         <xsl:when test="@ind2=6">
1080             <span class="label">Absorbed in part:</span>
1081         </xsl:when>
1082         <xsl:when test="@ind2=7">
1083             <span class="label">Separated from:</span>
1084         </xsl:when>
1085         </xsl:choose>
1086         <xsl:text> </xsl:text>
1087                 <xsl:variable name="f780">
1088                     <xsl:call-template name="subfieldSelect">
1089                         <xsl:with-param name="codes">a_t</xsl:with-param>
1090                     </xsl:call-template>
1091                 </xsl:variable>
1092             <xsl:choose>
1093                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1094                     <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>
1095                         <xsl:value-of select="translate($f780, '()', '')"/>
1096                     </a>
1097                 </xsl:when>
1098                 <xsl:otherwise>
1099                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
1100                         <xsl:value-of select="translate($f780, '()', '')"/>
1101                     </a>
1102                 </xsl:otherwise>
1103             </xsl:choose>
1104         </span>
1105
1106         <xsl:if test="marc:subfield[@code='n']">
1107             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1108         </xsl:if>
1109
1110         </xsl:if>
1111         </xsl:for-each>
1112         </xsl:if>
1113
1114         <!-- 785 -->
1115         <xsl:if test="marc:datafield[@tag=785]">
1116         <xsl:for-each select="marc:datafield[@tag=785]">
1117         <xsl:if test="@ind1=0">
1118         <span class="results_summary succeeding_entry">
1119         <xsl:choose>
1120         <xsl:when test="@ind2=0">
1121             <span class="label">Continued by:</span>
1122         </xsl:when>
1123         <xsl:when test="@ind2=1">
1124             <span class="label">Continued in part by:</span>
1125         </xsl:when>
1126         <xsl:when test="@ind2=2">
1127             <span class="label">Superseded by:</span>
1128         </xsl:when>
1129         <xsl:when test="@ind2=3">
1130             <span class="label">Superseded in part by:</span>
1131         </xsl:when>
1132         <xsl:when test="@ind2=4">
1133             <span class="label">Absorbed by:</span>
1134         </xsl:when>
1135         <xsl:when test="@ind2=5">
1136             <span class="label">Absorbed in part by:</span>
1137         </xsl:when>
1138         <xsl:when test="@ind2=6">
1139             <span class="label">Split into .. and ...:</span>
1140         </xsl:when>
1141         <xsl:when test="@ind2=7">
1142             <span class="label">Merged with ... to form ...</span>
1143         </xsl:when>
1144         <xsl:when test="@ind2=8">
1145             <span class="label">Changed back to:</span>
1146         </xsl:when>
1147         </xsl:choose>
1148         <xsl:text> </xsl:text>
1149                    <xsl:variable name="f785">
1150                     <xsl:call-template name="subfieldSelect">
1151                         <xsl:with-param name="codes">a_t</xsl:with-param>
1152                     </xsl:call-template>
1153                 </xsl:variable>
1154
1155             <xsl:choose>
1156                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1157                     <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>
1158                         <xsl:value-of select="translate($f785, '()', '')"/>
1159                     </a>
1160                 </xsl:when>
1161                 <xsl:otherwise>
1162                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
1163                         <xsl:value-of select="translate($f785, '()', '')"/>
1164                     </a>
1165                 </xsl:otherwise>
1166             </xsl:choose>
1167
1168         </span>
1169
1170         <xsl:if test="marc:subfield[@code='n']">
1171             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1172         </xsl:if>
1173
1174         </xsl:if>
1175         </xsl:for-each>
1176         </xsl:if>
1177
1178     </xsl:element>
1179     </xsl:template>
1180
1181     <xsl:template name="showAuthor">
1182         <xsl:param name="authorfield" />
1183         <xsl:param name="UseAuthoritiesForTracings" />
1184         <xsl:param name="materialTypeLabel" />
1185         <xsl:param name="theme" />
1186         <xsl:if test="count($authorfield)&gt;0">
1187         <h5 class="author">
1188             <xsl:for-each select="$authorfield">
1189                 <xsl:choose>
1190                     <xsl:when test="position()&gt;1"/>
1191                     <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
1192                     <!--#13382 Changed Additional author to contributor -->
1193                     <xsl:otherwise>Contributor(s): </xsl:otherwise>
1194                 </xsl:choose>
1195             <xsl:choose>
1196                 <xsl:when test="not(@tag=111) or @tag=700 or @tag=710 or @tag=711"/>
1197                 <xsl:when test="marc:subfield[@code='n']">
1198                     <xsl:text> </xsl:text>
1199                     <xsl:call-template name="subfieldSelect">
1200                         <xsl:with-param name="codes">n</xsl:with-param>
1201                     </xsl:call-template>
1202                     <xsl:text> </xsl:text>
1203                 </xsl:when>
1204             </xsl:choose>
1205             <a>
1206                 <xsl:choose>
1207                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1208                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:"<xsl:value-of select="marc:subfield[@code=9]"/>"</xsl:attribute>
1209                     </xsl:when>
1210                     <xsl:otherwise>
1211                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
1212                     </xsl:otherwise>
1213                 </xsl:choose>
1214                 <span resource="#record"><span>
1215                     <xsl:choose>
1216                         <xsl:when test="substring(@tag, 1, 1)='1'">
1217                             <xsl:choose>
1218                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="property">byArtist</xsl:attribute></xsl:when>
1219                                 <xsl:otherwise><xsl:attribute name="property">author</xsl:attribute></xsl:otherwise>
1220                             </xsl:choose>
1221                         </xsl:when>
1222                         <xsl:otherwise><xsl:attribute name="property">contributor</xsl:attribute></xsl:otherwise>
1223                     </xsl:choose>
1224                     <xsl:choose>
1225                         <xsl:when test="substring(@tag, 2, 1)='0'">
1226                             <xsl:choose>
1227                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="typeof">MusicGroup</xsl:attribute></xsl:when>
1228                                 <xsl:otherwise><xsl:attribute name="typeof">Person</xsl:attribute></xsl:otherwise>
1229                             </xsl:choose>
1230                         </xsl:when>
1231                         <xsl:otherwise><xsl:attribute name="typeof">Organization</xsl:attribute></xsl:otherwise>
1232                     </xsl:choose>
1233                 <span property="name">
1234                 <xsl:choose>
1235                     <xsl:when test="@tag=100"><xsl:call-template name="nameABCQ"/></xsl:when>
1236                     <xsl:when test="@tag=110"><xsl:call-template name="nameABCDN"/></xsl:when>
1237                     <xsl:when test="@tag=111"><xsl:call-template name="nameACDEQ"/></xsl:when>
1238                     <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1239                     <!--#13382 Added all relevant subfields 4, e, are handled separately -->
1240                     <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1241                         <xsl:variable name="str">
1242                             <xsl:call-template name="subfieldSelect">
1243                                 <xsl:with-param name="codes">abcdfghiklmnoprstux</xsl:with-param>
1244                             </xsl:call-template>
1245                         </xsl:variable>
1246                         <xsl:call-template name="chopPunctuation">
1247                             <xsl:with-param name="chopString">
1248                                 <xsl:value-of select="$str"/>
1249                             </xsl:with-param>
1250                             <xsl:with-param name="punctuation">
1251                                 <xsl:text>:,;/. </xsl:text>
1252                             </xsl:with-param>
1253                         </xsl:call-template>
1254                     </xsl:when>
1255                 </xsl:choose>
1256                 </span></span></span>
1257                 <!-- add relator code too between brackets-->
1258                 <xsl:if test="marc:subfield[@code='4' or @code='e']">
1259                     <span class="relatorcode">
1260                         <xsl:text> [</xsl:text>
1261                         <xsl:choose>
1262                             <xsl:when test="marc:subfield[@code='e']">
1263                                 <xsl:for-each select="marc:subfield[@code='e']">
1264                                     <xsl:value-of select="."/>
1265                                     <xsl:if test="position() != last()">, </xsl:if>
1266                                 </xsl:for-each>
1267                             </xsl:when>
1268                             <xsl:otherwise>
1269                                 <xsl:for-each select="marc:subfield[@code=4]">
1270                                     <xsl:value-of select="."/>
1271                                     <xsl:if test="position() != last()">, </xsl:if>
1272                                 </xsl:for-each>
1273                             </xsl:otherwise>
1274                         </xsl:choose>
1275                         <xsl:text>]</xsl:text>
1276                     </span>
1277                 </xsl:if>
1278             </a>
1279             <xsl:if test="marc:subfield[@code=9]">
1280                 <a class='authlink'>
1281                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
1282                     <xsl:element name="img">
1283                         <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
1284                         <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
1285                         <xsl:attribute name="height">15</xsl:attribute>
1286                         <xsl:attribute name="width">15</xsl:attribute>
1287                     </xsl:element>
1288                 </a>
1289             </xsl:if>
1290         </xsl:for-each>
1291             <xsl:choose>
1292                 <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1293             </xsl:choose>
1294         </h5>
1295         </xsl:if>
1296     </xsl:template>
1297
1298     <xsl:template name="nameABCQ">
1299             <xsl:call-template name="chopPunctuation">
1300                 <xsl:with-param name="chopString">
1301                     <xsl:call-template name="subfieldSelect">
1302                         <xsl:with-param name="codes">abcq</xsl:with-param>
1303                     </xsl:call-template>
1304                 </xsl:with-param>
1305                 <xsl:with-param name="punctuation">
1306                     <xsl:text>:,;/ </xsl:text>
1307                 </xsl:with-param>
1308             </xsl:call-template>
1309     </xsl:template>
1310
1311     <xsl:template name="nameABCDN">
1312             <xsl:call-template name="chopPunctuation">
1313                 <xsl:with-param name="chopString">
1314                     <xsl:call-template name="subfieldSelect">
1315                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1316                     </xsl:call-template>
1317                 </xsl:with-param>
1318                 <xsl:with-param name="punctuation">
1319                     <xsl:text>:,;/ </xsl:text>
1320                 </xsl:with-param>
1321             </xsl:call-template>
1322     </xsl:template>
1323
1324     <xsl:template name="nameACDEQ">
1325             <xsl:call-template name="subfieldSelect">
1326                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1327             </xsl:call-template>
1328     </xsl:template>
1329
1330     <xsl:template name="part">
1331         <xsl:variable name="partNumber">
1332             <xsl:call-template name="specialSubfieldSelect">
1333                 <xsl:with-param name="axis">n</xsl:with-param>
1334                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1335                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1336             </xsl:call-template>
1337         </xsl:variable>
1338         <xsl:variable name="partName">
1339             <xsl:call-template name="specialSubfieldSelect">
1340                 <xsl:with-param name="axis">p</xsl:with-param>
1341                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1342                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1343             </xsl:call-template>
1344         </xsl:variable>
1345         <xsl:if test="string-length(normalize-space($partNumber))">
1346                 <xsl:call-template name="chopPunctuation">
1347                     <xsl:with-param name="chopString" select="$partNumber"/>
1348                 </xsl:call-template>
1349         </xsl:if>
1350         <xsl:if test="string-length(normalize-space($partName))">
1351                 <xsl:call-template name="chopPunctuation">
1352                     <xsl:with-param name="chopString" select="$partName"/>
1353                 </xsl:call-template>
1354         </xsl:if>
1355     </xsl:template>
1356
1357     <xsl:template name="specialSubfieldSelect">
1358         <xsl:param name="anyCodes"/>
1359         <xsl:param name="axis"/>
1360         <xsl:param name="beforeCodes"/>
1361         <xsl:param name="afterCodes"/>
1362         <xsl:variable name="str">
1363             <xsl:for-each select="marc:subfield">
1364                 <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])">
1365                     <xsl:value-of select="text()"/>
1366                     <xsl:text> </xsl:text>
1367                 </xsl:if>
1368             </xsl:for-each>
1369         </xsl:variable>
1370         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1371     </xsl:template>
1372
1373     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1374     <xsl:template name="subfieldSelectSubject">
1375         <xsl:param name="codes"/>
1376         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1377         <xsl:param name="subdivCodes"/>
1378         <xsl:param name="subdivDelimiter"/>
1379         <xsl:param name="prefix"/>
1380         <xsl:param name="suffix"/>
1381         <xsl:variable name="str">
1382             <xsl:for-each select="marc:subfield">
1383                 <xsl:if test="contains($codes, @code)">
1384                     <xsl:if test="contains($subdivCodes, @code)">
1385                         <xsl:value-of select="$subdivDelimiter"/>
1386                     </xsl:if>
1387                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1388                 </xsl:if>
1389             </xsl:for-each>
1390         </xsl:variable>
1391         <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1392     </xsl:template>
1393 </xsl:stylesheet>