f8f0ba16c9454f9b1ac0145caef0492ca361ef7f
[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   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
738                     <xsl:if test="marc:subfield[@code=9]">
739                         <xsl:text> </xsl:text>
740                         <a class='authlink'>
741                             <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>
742                             <xsl:element name="img">
743                                 <xsl:attribute name="src">/intranet-tmpl/prog/img/filefind.png</xsl:attribute>
744                                 <xsl:attribute name="alt"></xsl:attribute>
745                                 <xsl:attribute name="height">15</xsl:attribute>
746                                 <xsl:attribute name="width">15</xsl:attribute>
747                             </xsl:element>
748                         </a>
749                     </xsl:if>
750                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
751                 </xsl:for-each>
752             </span>
753         </xsl:if>
754
755 <!-- MARC21 776 Additional Physical Form Entry -->
756     <xsl:if test="marc:datafield[@tag=776]">
757         <span class="results_summary add_physical_form">
758             <span class="label">Additional physical formats: </span>
759             <xsl:for-each select="marc:datafield[@tag=776]">
760                 <xsl:variable name="linktext">
761                     <xsl:choose>
762                     <xsl:when test="marc:subfield[@code='t']">
763                         <xsl:value-of select="marc:subfield[@code='t']"/>
764                     </xsl:when>
765                     <xsl:when test="marc:subfield[@code='a']">
766                         <xsl:value-of select="marc:subfield[@code='a']"/>
767                     </xsl:when>
768                     <xsl:otherwise>
769                         <xsl:text>No title</xsl:text>
770                     </xsl:otherwise>
771                     </xsl:choose>
772                 </xsl:variable>
773                 <xsl:if test="@ind2=8 and marc:subfield[@code='i']">
774                     <xsl:call-template name="subfieldSelect">
775                         <xsl:with-param name="codes">i</xsl:with-param>
776                     </xsl:call-template>
777                     <xsl:text>: </xsl:text>
778                 </xsl:if>
779                 <xsl:choose>
780                 <xsl:when test="marc:subfield[@code='w']">
781                     <a>
782                     <xsl:attribute name="href">
783                         <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=control-number:</xsl:text>
784                         <xsl:call-template name="extractControlNumber">
785                             <xsl:with-param name="subfieldW">
786                                 <xsl:value-of select="marc:subfield[@code='w']"/>
787                             </xsl:with-param>
788                         </xsl:call-template>
789                     </xsl:attribute>
790                     <xsl:value-of select="$linktext"/>
791                     </a>
792                 </xsl:when>
793                 <xsl:otherwise>
794                     <xsl:value-of select="$linktext"/>
795                 </xsl:otherwise>
796                 </xsl:choose>
797                 <xsl:if test="position() != last()">
798                     <xsl:text>; </xsl:text>
799                 </xsl:if>
800             </xsl:for-each>
801         </span>
802     </xsl:if>
803
804 <!-- DDC classification -->
805     <xsl:if test="marc:datafield[@tag=082]">
806         <span class="results_summary ddc">
807             <span class="label">DDC classification: </span>
808             <xsl:for-each select="marc:datafield[@tag=082]">
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 <!-- Other classification -->
822     <xsl:if test="marc:datafield[@tag=084]">
823        <span class="results_summary oc">
824            <span class="label">Other classification: </span>
825           <xsl:for-each select="marc:datafield[@tag=084]">
826                 <xsl:call-template name="subfieldSelect">
827                    <xsl:with-param name="codes">a</xsl:with-param>
828                    <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
829                 </xsl:call-template>
830                 <xsl:choose>
831                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
832                    <xsl:otherwise> | </xsl:otherwise>
833                 </xsl:choose>
834           </xsl:for-each>
835        </span>
836     </xsl:if>
837
838         <xsl:if test="marc:datafield[@tag=856]">
839         <span class="results_summary online_resources"><span class="label">Online resources: </span>
840         <xsl:for-each select="marc:datafield[@tag=856]">
841                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
842                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
843                                     <xsl:choose>
844                                     <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')">
845                                         <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>
846                                     </xsl:when>
847                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
848                                         <xsl:call-template name="subfieldSelect">
849                                         <xsl:with-param name="codes">y3z</xsl:with-param>
850                                         </xsl:call-template>
851                                     </xsl:when>
852                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
853                                         <xsl:choose>
854                                         <xsl:when test="$URLLinkText!=''">
855                                                 <xsl:value-of select="$URLLinkText"/>
856                                         </xsl:when>
857                                         <xsl:otherwise>
858                                                 <xsl:text>Click here to access online</xsl:text>
859                                         </xsl:otherwise>
860                                         </xsl:choose>
861                                     </xsl:when>
862                                     </xsl:choose>
863                                     </a>
864                                     <xsl:choose>
865                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
866                                     <xsl:otherwise> | </xsl:otherwise>
867                                     </xsl:choose>
868
869         </xsl:for-each>
870         </span>
871         </xsl:if>
872         <xsl:if test="marc:datafield[@tag=505]">
873             <div class="results_summary contents">
874             <xsl:choose>
875             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
876                 <span class="label">Contents:</span>
877             </xsl:when>
878             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
879                 <span class="label">Incomplete contents:</span>
880             </xsl:when>
881             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
882                 <span class="label">Partial contents:</span>
883             </xsl:when>
884             </xsl:choose>
885                 <xsl:for-each select="marc:datafield[@tag=505]">
886                     <div class='contentblock'>
887                         <xsl:choose>
888                         <xsl:when test="@ind2=0">
889                             <xsl:call-template name="subfieldSelectSpan">
890                                 <xsl:with-param name="codes">tru</xsl:with-param>
891                             </xsl:call-template>
892                         </xsl:when>
893                         <xsl:otherwise>
894                             <xsl:call-template name="subfieldSelectSpan">
895                                 <xsl:with-param name="codes">atru</xsl:with-param>
896                             </xsl:call-template>
897                         </xsl:otherwise>
898                         </xsl:choose>
899                     </div>
900                 </xsl:for-each>
901             </div>
902         </xsl:if>
903
904         <!-- 586 -->
905         <xsl:if test="marc:datafield[@tag=586]">
906             <span class="results_summary awardsnote">
907                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
908                     <span class="label">Awards: </span>
909                 </xsl:if>
910                 <xsl:for-each select="marc:datafield[@tag=586]">
911                     <xsl:value-of select="marc:subfield[@code='a']"/>
912                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
913                 </xsl:for-each>
914             </span>
915         </xsl:if>
916
917          <!-- 583 -->
918              <xsl:if test="marc:datafield[@tag=583]">
919                  <xsl:for-each select="marc:datafield[@tag=583]">
920                     <xsl:if test="@ind1=1 or @ind1=' '">
921                       <span class="results_summary actionnote">
922                           <span class="label">Action note: </span>
923                              <xsl:choose>
924                                  <xsl:when test="marc:subfield[@code='z']">
925                                      <xsl:value-of select="marc:subfield[@code='z']"/>
926                                  </xsl:when>
927                                  <xsl:otherwise>
928                                      <xsl:call-template name="subfieldSelect">
929                                          <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
930                                      </xsl:call-template>
931                                  </xsl:otherwise>
932                              </xsl:choose>
933                          </span>
934                      </xsl:if>
935                  </xsl:for-each>
936              </xsl:if>
937
938         <!-- 508 -->
939         <xsl:if test="marc:datafield[@tag=508]">
940             <div class="results_summary prod_credits">
941                 <span class="label">Production credits: </span>
942                 <xsl:for-each select="marc:datafield[@tag=508]">
943                     <xsl:call-template name="subfieldSelectSpan">
944                         <xsl:with-param name="codes">a</xsl:with-param>
945                     </xsl:call-template>
946                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
947                 </xsl:for-each>
948             </div>
949         </xsl:if>
950
951         <!-- 773 -->
952         <xsl:if test="marc:datafield[@tag=773]">
953             <xsl:for-each select="marc:datafield[@tag=773]">
954                 <xsl:if test="@ind1 !=1">
955                     <span class="results_summary in"><span class="label">
956                     <xsl:choose>
957                         <xsl:when test="@ind2=' '">
958                             In:
959                         </xsl:when>
960                         <xsl:when test="@ind2=8">
961                             <xsl:if test="marc:subfield[@code='i']">
962                                 <xsl:value-of select="marc:subfield[@code='i']"/>
963                             </xsl:if>
964                         </xsl:when>
965                     </xsl:choose>
966                     </span>
967                     <xsl:variable name="f773">
968                         <xsl:call-template name="chopPunctuation">
969                             <xsl:with-param name="chopString">
970                                 <xsl:call-template name="subfieldSelect">
971                                     <xsl:with-param name="codes">a_t</xsl:with-param>
972                                 </xsl:call-template>
973                             </xsl:with-param>
974                         </xsl:call-template>
975                     </xsl:variable>
976                     <xsl:choose>
977                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
978                             <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>
979                             <xsl:value-of select="translate($f773, '()', '')"/>
980                             </a>
981                         </xsl:when>
982                         <xsl:when test="marc:subfield[@code='0']">
983                             <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>
984                             <xsl:value-of select="$f773"/>
985                             </a>
986                         </xsl:when>
987                         <xsl:otherwise>
988                             <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>
989                             <xsl:value-of select="$f773"/>
990                             </a>
991                         </xsl:otherwise>
992                     </xsl:choose>
993                     <xsl:if test="marc:subfield[@code='g']">
994                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
995                     </xsl:if>
996                     </span>
997
998                     <xsl:if test="marc:subfield[@code='n']">
999                         <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1000                     </xsl:if>
1001
1002                 </xsl:if>
1003             </xsl:for-each>
1004         </xsl:if>
1005
1006         <xsl:if test="marc:datafield[@tag=502]">
1007             <span class="results_summary diss_note">
1008                 <span class="label">Dissertation note: </span>
1009                 <xsl:for-each select="marc:datafield[@tag=502]">
1010                     <xsl:call-template name="subfieldSelect">
1011                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1012                     </xsl:call-template>
1013                 </xsl:for-each>
1014                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1015             </span>
1016         </xsl:if>
1017
1018         <!-- 866 textual holdings -->
1019         <xsl:if test="marc:datafield[@tag=866]">
1020             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
1021                 <xsl:for-each select="marc:datafield[@tag=866]">
1022                     <xsl:call-template name="subfieldSelect">
1023                         <xsl:with-param name="codes">axz</xsl:with-param>
1024                     </xsl:call-template>
1025                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1026                 </xsl:for-each>
1027             </span>
1028         </xsl:if>
1029
1030         <!--  775 Other Edition  -->
1031         <xsl:if test="marc:datafield[@tag=775]">
1032         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1033         <xsl:for-each select="marc:datafield[@tag=775]">
1034             <xsl:variable name="f775">
1035                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1036                 <xsl:with-param name="codes">a_t</xsl:with-param>
1037                 </xsl:call-template></xsl:with-param></xsl:call-template>
1038             </xsl:variable>
1039             <xsl:if test="marc:subfield[@code='i']">
1040                 <xsl:call-template name="subfieldSelect">
1041                     <xsl:with-param name="codes">i</xsl:with-param>
1042                 </xsl:call-template>
1043                 <xsl:text>: </xsl:text>
1044             </xsl:if>
1045             <a>
1046             <xsl:choose>
1047             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1048                 <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>
1049             </xsl:when>
1050             <xsl:otherwise>
1051                 <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>
1052             </xsl:otherwise>
1053             </xsl:choose>
1054             <xsl:call-template name="subfieldSelect">
1055                 <xsl:with-param name="codes">a_t</xsl:with-param>
1056             </xsl:call-template>
1057             </a>
1058             <xsl:choose>
1059                 <xsl:when test="position()=last()"></xsl:when>
1060                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1061             </xsl:choose>
1062         </xsl:for-each>
1063         </span>
1064         </xsl:if>
1065
1066         <!-- 780 -->
1067         <xsl:if test="marc:datafield[@tag=780]">
1068         <xsl:for-each select="marc:datafield[@tag=780]">
1069         <xsl:if test="@ind1=0">
1070         <span class="results_summary preceeding_entry">
1071         <xsl:choose>
1072         <xsl:when test="@ind2=0">
1073             <span class="label">Continues:</span>
1074         </xsl:when>
1075         <xsl:when test="@ind2=1">
1076             <span class="label">Continues in part:</span>
1077         </xsl:when>
1078         <xsl:when test="@ind2=2">
1079             <span class="label">Supersedes:</span>
1080         </xsl:when>
1081         <xsl:when test="@ind2=3">
1082             <span class="label">Supersedes in part:</span>
1083         </xsl:when>
1084         <xsl:when test="@ind2=4">
1085             <span class="label">Formed by the union: ... and: ...</span>
1086         </xsl:when>
1087         <xsl:when test="@ind2=5">
1088             <span class="label">Absorbed:</span>
1089         </xsl:when>
1090         <xsl:when test="@ind2=6">
1091             <span class="label">Absorbed in part:</span>
1092         </xsl:when>
1093         <xsl:when test="@ind2=7">
1094             <span class="label">Separated from:</span>
1095         </xsl:when>
1096         </xsl:choose>
1097         <xsl:text> </xsl:text>
1098                 <xsl:variable name="f780">
1099                     <xsl:call-template name="subfieldSelect">
1100                         <xsl:with-param name="codes">a_t</xsl:with-param>
1101                     </xsl:call-template>
1102                 </xsl:variable>
1103             <xsl:choose>
1104                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1105                     <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>
1106                         <xsl:value-of select="translate($f780, '()', '')"/>
1107                     </a>
1108                 </xsl:when>
1109                 <xsl:otherwise>
1110                     <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>
1111                         <xsl:value-of select="translate($f780, '()', '')"/>
1112                     </a>
1113                 </xsl:otherwise>
1114             </xsl:choose>
1115         </span>
1116  
1117         <xsl:if test="marc:subfield[@code='n']">
1118             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1119         </xsl:if>
1120
1121         </xsl:if>
1122         </xsl:for-each>
1123         </xsl:if>
1124
1125         <!-- 785 -->
1126         <xsl:if test="marc:datafield[@tag=785]">
1127         <xsl:for-each select="marc:datafield[@tag=785]">
1128         <span class="results_summary succeeding_entry">
1129         <xsl:choose>
1130         <xsl:when test="@ind2=0">
1131             <span class="label">Continued by:</span>
1132         </xsl:when>
1133         <xsl:when test="@ind2=1">
1134             <span class="label">Continued in part by:</span>
1135         </xsl:when>
1136         <xsl:when test="@ind2=2">
1137             <span class="label">Superseded by:</span>
1138         </xsl:when>
1139         <xsl:when test="@ind2=3">
1140             <span class="label">Superseded in part by:</span>
1141         </xsl:when>
1142         <xsl:when test="@ind2=4">
1143             <span class="label">Absorbed by:</span>
1144         </xsl:when>
1145         <xsl:when test="@ind2=5">
1146             <span class="label">Absorbed in part by:</span>
1147         </xsl:when>
1148         <xsl:when test="@ind2=6">
1149             <span class="label">Split into .. and ...:</span>
1150         </xsl:when>
1151         <xsl:when test="@ind2=7">
1152             <span class="label">Merged with ... to form ...</span>
1153         </xsl:when>
1154         <xsl:when test="@ind2=8">
1155             <span class="label">Changed back to:</span>
1156         </xsl:when>
1157         </xsl:choose>
1158         <xsl:text> </xsl:text>
1159                    <xsl:variable name="f785">
1160                     <xsl:call-template name="subfieldSelect">
1161                         <xsl:with-param name="codes">a_t</xsl:with-param>
1162                     </xsl:call-template>
1163                 </xsl:variable>
1164
1165             <xsl:choose>
1166                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1167                     <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>
1168                         <xsl:value-of select="translate($f785, '()', '')"/>
1169                     </a>
1170                 </xsl:when>
1171                 <xsl:otherwise>
1172                     <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>
1173                         <xsl:value-of select="translate($f785, '()', '')"/>
1174                     </a>
1175                 </xsl:otherwise>
1176             </xsl:choose>
1177
1178         </span>
1179         </xsl:for-each>
1180         </xsl:if>
1181
1182         <xsl:if test="$OPACBaseURL!=''">
1183         <span class="results_summary"><span class="label">OPAC view: </span>
1184             <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>.
1185         </span>
1186         </xsl:if>
1187
1188     </xsl:template>
1189
1190     <xsl:template name="nameABCQ">
1191             <xsl:call-template name="chopPunctuation">
1192                 <xsl:with-param name="chopString">
1193                     <xsl:call-template name="subfieldSelect">
1194                         <xsl:with-param name="codes">abcq</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="nameABCDN">
1204             <xsl:call-template name="chopPunctuation">
1205                 <xsl:with-param name="chopString">
1206                     <xsl:call-template name="subfieldSelect">
1207                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1208                     </xsl:call-template>
1209                 </xsl:with-param>
1210                 <xsl:with-param name="punctuation">
1211                     <xsl:text>:,;/ </xsl:text>
1212                 </xsl:with-param>
1213             </xsl:call-template>
1214     </xsl:template>
1215
1216     <xsl:template name="nameACDEQ">
1217             <xsl:call-template name="subfieldSelect">
1218                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1219             </xsl:call-template>
1220     </xsl:template>
1221
1222     <xsl:template name="part">
1223         <xsl:variable name="partNumber">
1224             <xsl:call-template name="specialSubfieldSelect">
1225                 <xsl:with-param name="axis">n</xsl:with-param>
1226                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1227                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1228             </xsl:call-template>
1229         </xsl:variable>
1230         <xsl:variable name="partName">
1231             <xsl:call-template name="specialSubfieldSelect">
1232                 <xsl:with-param name="axis">p</xsl:with-param>
1233                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1234                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1235             </xsl:call-template>
1236         </xsl:variable>
1237         <xsl:if test="string-length(normalize-space($partNumber))">
1238                 <xsl:call-template name="chopPunctuation">
1239                     <xsl:with-param name="chopString" select="$partNumber"/>
1240                 </xsl:call-template>
1241         </xsl:if>
1242         <xsl:if test="string-length(normalize-space($partName))">
1243                 <xsl:call-template name="chopPunctuation">
1244                     <xsl:with-param name="chopString" select="$partName"/>
1245                 </xsl:call-template>
1246         </xsl:if>
1247     </xsl:template>
1248
1249     <xsl:template name="specialSubfieldSelect">
1250         <xsl:param name="anyCodes"/>
1251         <xsl:param name="axis"/>
1252         <xsl:param name="beforeCodes"/>
1253         <xsl:param name="afterCodes"/>
1254         <xsl:variable name="str">
1255             <xsl:for-each select="marc:subfield">
1256                 <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])">
1257                     <xsl:value-of select="text()"/>
1258                     <xsl:text> </xsl:text>
1259                 </xsl:if>
1260             </xsl:for-each>
1261         </xsl:variable>
1262         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1263     </xsl:template>
1264
1265     <xsl:template name="showAuthor">
1266         <xsl:param name="authorfield"/>
1267     <xsl:param name="UseAuthoritiesForTracings"/>
1268         <xsl:if test="count($authorfield)&gt;0">
1269         <h5 class="author">
1270         <xsl:for-each select="$authorfield">
1271         <xsl:choose>
1272           <xsl:when test="position()&gt;1"/>
1273           <!-- #13383 -->
1274           <xsl:when test="@tag&lt;700">By: </xsl:when>
1275           <!--#13382 Changed Additional author to contributor -->
1276           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1277         </xsl:choose>
1278         <a>
1279         <xsl:choose>
1280             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1281                 <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>
1282             </xsl:when>
1283             <xsl:otherwise>
1284             <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>
1285             </xsl:otherwise>
1286         </xsl:choose>
1287         <xsl:choose>
1288             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1289                 <!-- #13383 -->
1290                 <xsl:call-template name="chopPunctuation">
1291                     <xsl:with-param name="chopString">
1292                         <xsl:call-template name="subfieldSelect">
1293                             <xsl:with-param name="codes">
1294                                 <xsl:choose>
1295                                     <!-- #13383 include subfield e for field 111, Display only name portion in 1XX -->
1296                                     <xsl:when test="@tag=111">aeq</xsl:when>
1297                                     <xsl:when test="@tag=110">ab</xsl:when>
1298                                     <xsl:otherwise>abcjq</xsl:otherwise>
1299                                 </xsl:choose>
1300                             </xsl:with-param>
1301                         </xsl:call-template>
1302                     </xsl:with-param>
1303                     <xsl:with-param name="punctuation">
1304                         <xsl:text>:,;/ </xsl:text>
1305                     </xsl:with-param>
1306                 </xsl:call-template>
1307                     <!-- Display only name and title portion in 110 field -->
1308                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1309                     <span class="titleportion">
1310                     <xsl:choose>
1311                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1312                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1313                     </xsl:choose>
1314                     <xsl:call-template name="chopPunctuation">
1315                         <xsl:with-param name="chopString">
1316                         <xsl:call-template name="subfieldSelect">
1317                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1318                         </xsl:call-template>
1319                         </xsl:with-param>
1320                     </xsl:call-template>
1321                     </span>
1322                     </xsl:if>
1323                     <!-- Display only name and title portion in 111 field -->
1324             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1325                     <span class="titleportion">
1326                     <xsl:choose>
1327                         <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>
1328                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1329                     </xsl:choose>
1330
1331                     <xsl:call-template name="chopPunctuation">
1332                         <xsl:with-param name="chopString">
1333                         <xsl:call-template name="subfieldSelect">
1334                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1335                         </xsl:call-template>
1336                         </xsl:with-param>
1337                     </xsl:call-template>
1338                     </span>
1339             </xsl:if>
1340             <!-- Display only dates in 100 field -->
1341             <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1342                 <span class="authordates">
1343                 <xsl:text>, </xsl:text>
1344                 <xsl:call-template name="chopPunctuation">
1345                     <xsl:with-param name="chopString">
1346                         <xsl:call-template name="subfieldSelect">
1347                            <xsl:with-param name="codes">d</xsl:with-param>
1348                         </xsl:call-template>
1349                         </xsl:with-param>
1350                     </xsl:call-template>
1351                     </span>
1352             </xsl:if>
1353
1354             </xsl:when>
1355             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1356             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1357             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1358                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1359                     <xsl:if test="@tag=710 or @tag=711">
1360                     <xsl:call-template name="chopPunctuation">
1361                         <xsl:with-param name="chopString">
1362                             <xsl:call-template name="subfieldSelect">
1363                             <xsl:with-param name="codes">
1364                             <xsl:choose>
1365                                 <xsl:when test="@tag=711">aeq</xsl:when>
1366                                 <xsl:otherwise>ab</xsl:otherwise>
1367                             </xsl:choose>
1368                             </xsl:with-param>
1369                             </xsl:call-template>
1370                         </xsl:with-param>
1371                         <xsl:with-param name="punctuation">
1372                             <xsl:text>:,;/ </xsl:text>
1373                         </xsl:with-param>
1374                     </xsl:call-template>
1375                     <!-- Display only name and title portion in 711 field -->
1376                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1377                     <span class="titleportion">
1378                     <xsl:choose>
1379                         <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>
1380                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1381                     </xsl:choose>
1382
1383                     <xsl:call-template name="chopPunctuation">
1384                         <xsl:with-param name="chopString">
1385                         <xsl:call-template name="subfieldSelect">
1386                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1387                         </xsl:call-template>
1388                         </xsl:with-param>
1389                     </xsl:call-template>
1390                     </span>
1391                     </xsl:if>
1392                     <!-- Display only name and title portion in 710 field -->
1393                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1394                     <span class="titleportion">
1395                     <xsl:choose>
1396                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1397                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1398                     </xsl:choose>
1399                     <xsl:call-template name="chopPunctuation">
1400                         <xsl:with-param name="chopString">
1401                         <xsl:call-template name="subfieldSelect">
1402                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1403                         </xsl:call-template>
1404                         </xsl:with-param>
1405                     </xsl:call-template>
1406                     </span>
1407                     </xsl:if>
1408
1409                     </xsl:if>
1410                         <!-- Display only name portion in 700 field -->
1411                         <xsl:if test="@tag=700">
1412                            <xsl:call-template name="chopPunctuation">
1413                                <xsl:with-param name="chopString">
1414                                <xsl:call-template name="subfieldSelect">
1415                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1416                                </xsl:call-template>
1417                                </xsl:with-param>
1418                         </xsl:call-template>
1419                         </xsl:if>
1420                         <!-- Display class "authordates" in 700 field -->
1421                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1422                         <span class="authordates">
1423                         <xsl:text>, </xsl:text>
1424                         <xsl:call-template name="chopPunctuation">
1425                             <xsl:with-param name="chopString">
1426                             <xsl:call-template name="subfieldSelect">
1427                                <xsl:with-param name="codes">d</xsl:with-param>
1428                             </xsl:call-template>
1429                             </xsl:with-param>
1430                         </xsl:call-template>
1431                         </span>
1432                         </xsl:if>
1433                         <!-- Display class "titleportion" in 700 field -->
1434                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1435                         <xsl:if test="@tag=700 and $titleportionfields">
1436                         <span class="titleportion">
1437                         <xsl:text>. </xsl:text>
1438                         <xsl:call-template name="chopPunctuation">
1439                             <xsl:with-param name="chopString">
1440                             <xsl:call-template name="subfieldSelect">
1441                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1442                             </xsl:call-template>
1443                             </xsl:with-param>
1444                         </xsl:call-template>
1445                         </span>
1446                         </xsl:if>
1447
1448         </xsl:when>
1449         </xsl:choose>
1450
1451     <!-- add relator code too between brackets-->
1452     <!-- #13383 include relator code j for field 111 -->
1453             <xsl:if test="(@tag!=111 and @tag!=711 and marc:subfield[@code='4' or @code='e']) or ((@tag=111 or @tag=711) and marc:subfield[@code='4' or @code='j'])">
1454                 <span class="relatorcode">
1455                     <xsl:text> [</xsl:text>
1456                     <xsl:choose>
1457                         <xsl:when test="@tag=111 or @tag=711">
1458                             <xsl:choose>
1459                                 <!-- Prefer j over 4 for fields 111 and 711-->
1460                                 <xsl:when test="marc:subfield[@code='j']">
1461                                     <xsl:for-each select="marc:subfield[@code='j']">
1462                                         <xsl:value-of select="."/>
1463                                         <xsl:if test="position() != last()">, </xsl:if>
1464                                     </xsl:for-each>
1465                                 </xsl:when>
1466                                 <xsl:otherwise>
1467                                     <xsl:for-each select="marc:subfield[@code=4]">
1468                                         <xsl:value-of select="."/>
1469                                         <xsl:if test="position() != last()">, </xsl:if>
1470                                     </xsl:for-each>
1471                                 </xsl:otherwise>
1472                             </xsl:choose>
1473                         </xsl:when>
1474                         <!-- Prefer e over 4 for fields 111 and 711-->
1475                         <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1476                             <xsl:for-each select="marc:subfield[@code='e']">
1477                                 <xsl:value-of select="."/>
1478                                 <xsl:if test="position() != last()">, </xsl:if>
1479                             </xsl:for-each>
1480                         </xsl:when>
1481                         <xsl:otherwise>
1482                             <xsl:for-each select="marc:subfield[@code=4]">
1483                                 <xsl:value-of select="."/>
1484                                 <xsl:if test="position() != last()">, </xsl:if>
1485                             </xsl:for-each>
1486                         </xsl:otherwise>
1487                     </xsl:choose>
1488                     <xsl:text>]</xsl:text>
1489                 </span>
1490             </xsl:if>
1491         </a>
1492         <xsl:choose>
1493             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1494         </xsl:choose>
1495         </xsl:for-each>
1496         </h5>
1497
1498         </xsl:if>
1499     </xsl:template>
1500
1501     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1502     <xsl:template name="subfieldSelectSubject">
1503         <xsl:param name="codes"/>
1504         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1505         <xsl:param name="subdivCodes"/>
1506         <xsl:param name="subdivDelimiter"/>
1507         <xsl:param name="prefix"/>
1508         <xsl:param name="suffix"/>
1509         <xsl:param name="urlencode"/>
1510         <xsl:variable name="str">
1511             <xsl:for-each select="marc:subfield">
1512                 <xsl:if test="contains($codes, @code)">
1513                     <xsl:if test="contains($subdivCodes, @code)">
1514                         <xsl:value-of select="$subdivDelimiter"/>
1515                     </xsl:if>
1516                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1517                 </xsl:if>
1518             </xsl:for-each>
1519         </xsl:variable>
1520         <xsl:choose>
1521             <xsl:when test="$urlencode=1">
1522                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
1523             </xsl:when>
1524             <xsl:otherwise>
1525                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1526             </xsl:otherwise>
1527         </xsl:choose>
1528     </xsl:template>
1529
1530 </xsl:stylesheet>