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