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