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