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