Bug 20986: Add 867 and 868 holdings display
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
6 <!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com  -->
7 <xsl:stylesheet version="1.0"
8   xmlns:marc="http://www.loc.gov/MARC21/slim"
9   xmlns:items="http://www.koha-community.org/items"
10   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11   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]">
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
254             <xsl:for-each select="marc:datafield[@tag=830]">
255                 <xsl:choose>
256                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
257                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
258                             <xsl:call-template name="chopPunctuation">
259                                 <xsl:with-param name="chopString">
260                                     <xsl:call-template name="subfieldSelect">
261                                         <xsl:with-param name="codes">a_t</xsl:with-param>
262                                     </xsl:call-template>
263                                 </xsl:with-param>
264                             </xsl:call-template>
265                         </a>
266                     </xsl:when>
267                     <xsl:otherwise>
268                         <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
269                             <xsl:call-template name="chopPunctuation">
270                                 <xsl:with-param name="chopString">
271                                     <xsl:call-template name="subfieldSelect">
272                                         <xsl:with-param name="codes">a_t</xsl:with-param>
273                                     </xsl:call-template>
274                                 </xsl:with-param>
275                             </xsl:call-template>
276                         </a>
277                         <xsl:call-template name="part"/>
278                     </xsl:otherwise>
279                 </xsl:choose>
280                 <xsl:text>: </xsl:text>
281                 <xsl:value-of  select="marc:subfield[@code='v']" />
282             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
283             </xsl:for-each>
284         </xsl:if>
285
286         </span>
287         </xsl:if>
288
289         <!-- Analytics -->
290         <xsl:if test="$leader7='s'">
291         <span class="results_summary analytics"><span class="label">Analytics: </span>
292             <a>
293             <xsl:choose>
294             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
295                 <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>
296             </xsl:when>
297             <xsl:otherwise>
298                 <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>
299             </xsl:otherwise>
300             </xsl:choose>
301             <xsl:text>Show analytics</xsl:text>
302             </a>
303         </span>
304         </xsl:if>
305
306         <!-- Volumes of sets and traced series -->
307         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
308         <span class="results_summary volumes"><span class="label">Volumes: </span>
309             <a>
310             <xsl:choose>
311             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
312                 <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>
313             </xsl:when>
314             <xsl:otherwise>
315                 <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>
316             </xsl:otherwise>
317             </xsl:choose>
318             <xsl:text>Show volumes</xsl:text>
319             </a>
320         </span>
321         </xsl:if>
322
323         <!-- Set -->
324         <xsl:if test="$leader19='c'">
325         <span class="results_summary set"><span class="label">Set: </span>
326         <xsl:for-each select="marc:datafield[@tag=773]">
327             <a>
328             <xsl:choose>
329             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
330                 <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>
331             </xsl:when>
332             <xsl:otherwise>
333                 <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>
334             </xsl:otherwise>
335             </xsl:choose>
336             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
337             </a>
338             <xsl:choose>
339                 <xsl:when test="position()=last()"></xsl:when>
340                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
341             </xsl:choose>
342         </xsl:for-each>
343         </span>
344         </xsl:if>
345
346         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
347         <xsl:if test="$display880">
348             <xsl:call-template name="m880Select">
349                 <xsl:with-param name="basetags">260</xsl:with-param>
350                 <xsl:with-param name="codes">abcg</xsl:with-param>
351                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
352                 <xsl:with-param name="label">Publisher: </xsl:with-param>
353             </xsl:call-template>
354         </xsl:if>
355
356         <!-- Publisher info and RDA related info from tags 260, 264 -->
357         <xsl:choose>
358             <xsl:when test="marc:datafield[@tag=264]">
359                 <xsl:call-template name="showRDAtag264">
360                    <xsl:with-param name="show_url">1</xsl:with-param>
361                 </xsl:call-template>
362             </xsl:when>
363             <xsl:when test="marc:datafield[@tag=260]">
364                 <span class="results_summary publisher"><span class="label">Publisher: </span>
365                     <xsl:for-each select="marc:datafield[@tag=260]">
366                         <xsl:if test="marc:subfield[@code='a']">
367                             <xsl:call-template name="subfieldSelect">
368                                 <xsl:with-param name="codes">a</xsl:with-param>
369                             </xsl:call-template>
370                         </xsl:if>
371                         <xsl:text> </xsl:text>
372                         <xsl:if test="marc:subfield[@code='b']">
373                         <a>
374                             <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>
375                             <xsl:call-template name="subfieldSelect">
376                                 <xsl:with-param name="codes">b</xsl:with-param>
377                             </xsl:call-template>
378                        </a>
379                        </xsl:if>
380                        <xsl:text> </xsl:text>
381                         <xsl:call-template name="chopPunctuation">
382                           <xsl:with-param name="chopString">
383                             <xsl:call-template name="subfieldSelect">
384                                 <xsl:with-param name="codes">cg</xsl:with-param>
385                             </xsl:call-template>
386                            </xsl:with-param>
387                        </xsl:call-template>
388                             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
389                     </xsl:for-each>
390                 </span>
391             </xsl:when>
392         </xsl:choose>
393
394         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
395         <xsl:if test="$display880">
396             <xsl:call-template name="m880Select">
397                 <xsl:with-param name="basetags">250</xsl:with-param>
398                 <xsl:with-param name="codes">ab</xsl:with-param>
399                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
400                 <xsl:with-param name="label">Edition: </xsl:with-param>
401             </xsl:call-template>
402         </xsl:if>
403         
404         <xsl:if test="marc:datafield[@tag=250]">
405         <span class="results_summary edition"><span class="label">Edition: </span>
406             <xsl:for-each select="marc:datafield[@tag=250]">
407                 <xsl:call-template name="chopPunctuation">
408                   <xsl:with-param name="chopString">
409                     <xsl:call-template name="subfieldSelect">
410                         <xsl:with-param name="codes">ab</xsl:with-param>
411                     </xsl:call-template>
412                    </xsl:with-param>
413                </xsl:call-template>
414                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
415             </xsl:for-each>
416         </span>
417         </xsl:if>
418
419         <!-- Description: Alternate Graphic Representation (MARC 880) -->
420         <xsl:if test="$display880">
421             <xsl:call-template name="m880Select">
422                 <xsl:with-param name="basetags">300</xsl:with-param>
423                 <xsl:with-param name="codes">abceg</xsl:with-param>
424                 <xsl:with-param name="class">results_summary description</xsl:with-param>
425                 <xsl:with-param name="label">Description: </xsl:with-param>
426             </xsl:call-template>
427         </xsl:if>
428         
429         <xsl:if test="marc:datafield[@tag=300]">
430         <span class="results_summary description"><span class="label">Description: </span>
431             <xsl:for-each select="marc:datafield[@tag=300]">
432                 <xsl:call-template name="chopPunctuation">
433                   <xsl:with-param name="chopString">
434                     <xsl:call-template name="subfieldSelect">
435                         <xsl:with-param name="codes">abcefg</xsl:with-param>
436                     </xsl:call-template>
437                    </xsl:with-param>
438                </xsl:call-template>
439                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
440             </xsl:for-each>
441         </span>
442        </xsl:if>
443
444         <!-- Content Type -->
445         <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
446             <span class="results_summary" id="content_type">
447                 <xsl:if test="marc:datafield[@tag=336]">
448                     <span class="label">Content type: </span>
449                     <xsl:for-each select="marc:datafield[@tag=336]">
450                         <xsl:call-template name="subfieldSelect">
451                             <xsl:with-param name="codes">a</xsl:with-param>
452                             <xsl:with-param name="delimeter">, </xsl:with-param>
453                         </xsl:call-template>
454                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
455                     </xsl:for-each>
456                 </xsl:if>
457                 <xsl:text> </xsl:text>
458                 <!-- Media Type -->
459                 <xsl:if test="marc:datafield[@tag=337]">
460                     <span class="label">Media type: </span>
461                     <xsl:for-each select="marc:datafield[@tag=337]">
462                         <xsl:call-template name="subfieldSelect">
463                             <xsl:with-param name="codes">a</xsl:with-param>
464                             <xsl:with-param name="delimeter">, </xsl:with-param>
465                         </xsl:call-template>
466                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
467                     </xsl:for-each>
468                 </xsl:if>
469                 <xsl:text> </xsl:text>
470                 <!-- Media Type -->
471                 <xsl:if test="marc:datafield[@tag=338]">
472                     <span class="label">Carrier type: </span>
473                     <xsl:for-each select="marc:datafield[@tag=338]">
474                         <xsl:call-template name="subfieldSelect">
475                             <xsl:with-param name="codes">a</xsl:with-param>
476                             <xsl:with-param name="delimeter">, </xsl:with-param>
477                         </xsl:call-template>
478                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
479                     </xsl:for-each>
480                 </xsl:if>
481             </span>
482         </xsl:if>
483
484
485         <xsl:call-template name="showISBNISSN"/>
486
487         <xsl:if test="marc:datafield[@tag=013]">
488             <span class="results_summary patent_info">
489                 <span class="label">Patent information: </span>
490                 <xsl:for-each select="marc:datafield[@tag=013]">
491                     <xsl:call-template name="subfieldSelect">
492                         <xsl:with-param name="codes">acdef</xsl:with-param>
493                         <xsl:with-param name="delimeter">, </xsl:with-param>
494                     </xsl:call-template>
495                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
496                 </xsl:for-each>
497             </span>
498         </xsl:if>
499
500         <xsl:if test="marc:datafield[@tag=088]">
501             <span class="results_summary report_number">
502                 <span class="label">Report number: </span>
503                 <xsl:for-each select="marc:datafield[@tag=088]">
504                     <xsl:call-template name="subfieldSelect">
505                         <xsl:with-param name="codes">a</xsl:with-param>
506                     </xsl:call-template>
507                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
508                 </xsl:for-each>
509             </span>
510         </xsl:if>
511
512         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
513         <xsl:if test="$display880">
514             <xsl:call-template name="m880Select">
515                 <xsl:with-param name="basetags">246</xsl:with-param>
516                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
517                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
518                 <xsl:with-param name="label">Other title: </xsl:with-param>
519             </xsl:call-template>
520         </xsl:if>
521
522         <xsl:if test="marc:datafield[@tag=246]">
523             <span class="results_summary other_title"><span class="label">Other title: </span>
524                 <xsl:for-each select="marc:datafield[@tag=246]">
525                     <xsl:call-template name="chopPunctuation">
526                         <xsl:with-param name="chopString">
527                             <xsl:call-template name="subfieldSelect">
528                                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
529                             </xsl:call-template>
530                         </xsl:with-param>
531                     </xsl:call-template>
532                     <xsl:if test="@ind1=1 and not(marc:subfield[@code='i'])">
533                         <xsl:choose>
534                             <xsl:when test="@ind2=0"> [Portion of title]</xsl:when>
535                             <xsl:when test="@ind2=1"> [Parallel title]</xsl:when>
536                             <xsl:when test="@ind2=2"> [Distinctive title]</xsl:when>
537                             <xsl:when test="@ind2=3"> [Other title]</xsl:when>
538                             <xsl:when test="@ind2=4"> [Cover title]</xsl:when>
539                             <xsl:when test="@ind2=5"> [Added title page title]</xsl:when>
540                             <xsl:when test="@ind2=6"> [Caption title]</xsl:when>
541                             <xsl:when test="@ind2=7"> [Running title]</xsl:when>
542                             <xsl:when test="@ind2=8"> [Spine title]</xsl:when>
543                         </xsl:choose>
544                     </xsl:if>
545                     <xsl:if test="marc:subfield[@code='i']">
546                         <xsl:value-of select="concat(' [',marc:subfield[@code='i'],']')"/>
547                     </xsl:if>
548                     <!-- #13386 added separator | -->
549                     <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>
550                 </xsl:for-each>
551             </span>
552         </xsl:if>
553
554         <xsl:if test="marc:datafield[@tag=242]">
555         <span class="results_summary translated_title"><span class="label">Title translated: </span>
556             <xsl:for-each select="marc:datafield[@tag=242]">
557                 <xsl:call-template name="chopPunctuation">
558                   <xsl:with-param name="chopString">
559                     <xsl:call-template name="subfieldSelect">
560                         <xsl:with-param name="codes">abchnp</xsl:with-param>
561                     </xsl:call-template>
562                    </xsl:with-param>
563                </xsl:call-template>
564                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
565             </xsl:for-each>
566         </span>
567        </xsl:if>
568
569         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
570         <xsl:if test="$display880">
571             <xsl:call-template name="m880Select">
572                 <xsl:with-param name="basetags">130,240</xsl:with-param>
573                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
574                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
575                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
576             </xsl:call-template>
577         </xsl:if>
578
579         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
580             <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
581                 <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
582                     <xsl:for-each select="marc:subfield">
583                         <xsl:if test="contains('adfghklmnoprst',@code)">
584                             <xsl:value-of select="text()"/>
585                             <xsl:text> </xsl:text>
586                         </xsl:if>
587                     </xsl:for-each>
588                     <xsl:if test="position() != last()">
589                         <span class="separator"><xsl:text> | </xsl:text></span>
590                     </xsl:if>
591                 </xsl:for-each>
592             </span>
593         </xsl:if>
594
595         <!-- #13382 Added Related works 700$i -->
596         <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']]">
597             <span class="results_summary related_works"><span class="label">Related works: </span>
598                 <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']]">
599                     <xsl:variable name="str">
600                         <xsl:call-template name="subfieldSelect">
601                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
602                         </xsl:call-template>
603                     </xsl:variable>
604                     <xsl:call-template name="chopPunctuation">
605                         <xsl:with-param name="chopString">
606                             <xsl:value-of select="$str"/>
607                         </xsl:with-param>
608                     </xsl:call-template>
609                     <!-- add relator code too between brackets-->
610                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
611                         <span class="relatorcode">
612                             <xsl:text> [</xsl:text>
613                             <xsl:choose>
614                                 <xsl:when test="marc:subfield[@code='e']">
615                                     <xsl:for-each select="marc:subfield[@code='e']">
616                                         <xsl:value-of select="."/>
617                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
618                                     </xsl:for-each>
619                                 </xsl:when>
620                                 <xsl:otherwise>
621                                     <xsl:for-each select="marc:subfield[@code='4']">
622                                         <xsl:value-of select="."/>
623                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
624                                     </xsl:for-each>
625                                 </xsl:otherwise>
626                             </xsl:choose>
627                             <xsl:text>]</xsl:text>
628                         </span>
629                     </xsl:if>
630                     <xsl:choose>
631                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
632                     </xsl:choose>
633                 </xsl:for-each>
634             </span>
635         </xsl:if>
636
637         <!-- #13382 Added Contained Works 7xx@ind2=2 -->
638         <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'])]">
639             <span class="results_summary contained_works"><span class="label">Contained works: </span>
640                 <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'])]">
641                     <xsl:variable name="str">
642                         <xsl:call-template name="subfieldSelect">
643                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
644                         </xsl:call-template>
645                     </xsl:variable>
646                     <xsl:call-template name="chopPunctuation">
647                         <xsl:with-param name="chopString">
648                             <xsl:value-of select="$str"/>
649                         </xsl:with-param>
650                     </xsl:call-template>
651                     <!-- add relator code too between brackets-->
652                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
653                         <span class="relatorcode">
654                             <xsl:text> [</xsl:text>
655                             <xsl:choose>
656                                 <xsl:when test="marc:subfield[@code='e']">
657                                     <xsl:for-each select="marc:subfield[@code='e']">
658                                         <xsl:value-of select="."/>
659                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
660                                     </xsl:for-each>
661                                 </xsl:when>
662                                 <xsl:otherwise>
663                                     <xsl:for-each select="marc:subfield[@code='4']">
664                                         <xsl:value-of select="."/>
665                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
666                                     </xsl:for-each>
667                                 </xsl:otherwise>
668                             </xsl:choose>
669                             <xsl:text>]</xsl:text>
670                         </span>
671                     </xsl:if>
672                     <xsl:choose>
673                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
674                     </xsl:choose>
675                 </xsl:for-each>
676             </span>
677         </xsl:if>
678
679
680         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
681             <span class="results_summary subjects"><span class="label">Subject(s): </span>
682             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
683             <a>
684             <xsl:choose>
685             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
686             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
687                 <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>
688             </xsl:when>
689             <xsl:when test="$TraceSubjectSubdivisions='1'">
690                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
691                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
692                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
693                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
694                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
695                         <xsl:with-param name="urlencode">1</xsl:with-param>
696                     </xsl:call-template>
697                 </xsl:attribute>
698             </xsl:when>
699
700             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
701             <xsl:otherwise>
702                 <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>
703             </xsl:otherwise>
704             </xsl:choose>
705
706             <xsl:call-template name="chopPunctuation">
707                 <xsl:with-param name="chopString">
708                     <xsl:call-template name="subfieldSelect">
709                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
710                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
711                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
712                     </xsl:call-template>
713                 </xsl:with-param>
714             </xsl:call-template>
715             </a>
716
717             <xsl:if test="marc:subfield[@code=9]">
718                 <xsl:text> </xsl:text>
719                 <a class='authlink'>
720                     <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>
721                     <xsl:element name="img">
722                         <xsl:attribute name="src">/intranet-tmpl/prog/img/filefind.png</xsl:attribute>
723                         <xsl:attribute name="alt"></xsl:attribute>
724                         <xsl:attribute name="height">15</xsl:attribute>
725                         <xsl:attribute name="width">15</xsl:attribute>
726                     </xsl:element>
727                 </a>
728             </xsl:if>
729
730             <xsl:choose>
731             <xsl:when test="position()=last()"></xsl:when>
732             <xsl:otherwise> | </xsl:otherwise>
733             </xsl:choose>
734
735             </xsl:for-each>
736             </span>
737         </xsl:if>
738
739         <!-- Genre/Form -->
740         <xsl:if test="marc:datafield[@tag=655]">
741             <span class="results_summary genre"><span class="label">Genre/Form: </span>
742                 <xsl:for-each select="marc:datafield[@tag=655]">
743                     <a>
744                         <xsl:choose>
745                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
746                                 <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>
747                             </xsl:when>
748                             <xsl:when test="$TraceSubjectSubdivisions='1'">
749                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
750                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
751                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
752                                     <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
753                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
754                                     <xsl:with-param name="urlencode">1</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>
861                 <xsl:attribute name="href">
862                     <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
863                         <xsl:choose>
864                             <xsl:when test="@ind1=7">
865                                 <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
866                             </xsl:when>
867                             <xsl:when test="@ind1=1">
868                                 <xsl:text>ftp://</xsl:text>
869                             </xsl:when>
870                             <xsl:otherwise>
871                                 <xsl:text>http://</xsl:text>
872                             </xsl:otherwise>
873                         </xsl:choose>
874                     </xsl:if>
875                     <xsl:value-of select="marc:subfield[@code='u']"/>
876                 </xsl:attribute>
877                 <xsl:choose>
878                     <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')">
879                         <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>
880                     </xsl:when>
881                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
882                         <xsl:call-template name="subfieldSelect">
883                             <xsl:with-param name="codes">y3z</xsl:with-param>
884                         </xsl:call-template>
885                     </xsl:when>
886                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
887                         <xsl:choose>
888                             <xsl:when test="$URLLinkText!=''">
889                                 <xsl:value-of select="$URLLinkText"/>
890                             </xsl:when>
891                             <xsl:otherwise>
892                                 <xsl:text>Click here to access online</xsl:text>
893                             </xsl:otherwise>
894                         </xsl:choose>
895                     </xsl:when>
896                 </xsl:choose>
897             </a>
898             <xsl:choose>
899                 <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
900                 <xsl:otherwise> | </xsl:otherwise>
901             </xsl:choose>
902
903         </xsl:for-each>
904         </span>
905     </xsl:if>
906
907         <xsl:if test="marc:datafield[@tag=505]">
908             <div class="results_summary contents">
909             <xsl:choose>
910             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
911                 <span class="label">Contents:</span>
912             </xsl:when>
913             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
914                 <span class="label">Incomplete contents:</span>
915             </xsl:when>
916             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
917                 <span class="label">Partial contents:</span>
918             </xsl:when>
919             </xsl:choose>
920                 <xsl:for-each select="marc:datafield[@tag=505]">
921                     <div class='contentblock'>
922                         <xsl:choose>
923                         <xsl:when test="@ind2=0">
924                             <xsl:call-template name="subfieldSelectSpan">
925                                 <xsl:with-param name="codes">tru</xsl:with-param>
926                             </xsl:call-template>
927                         </xsl:when>
928                         <xsl:otherwise>
929                             <xsl:call-template name="subfieldSelectSpan">
930                                 <xsl:with-param name="codes">atru</xsl:with-param>
931                             </xsl:call-template>
932                         </xsl:otherwise>
933                         </xsl:choose>
934                     </div>
935                 </xsl:for-each>
936             </div>
937         </xsl:if>
938
939         <!-- 586 -->
940         <xsl:if test="marc:datafield[@tag=586]">
941             <span class="results_summary awardsnote">
942                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
943                     <span class="label">Awards: </span>
944                 </xsl:if>
945                 <xsl:for-each select="marc:datafield[@tag=586]">
946                     <xsl:value-of select="marc:subfield[@code='a']"/>
947                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
948                 </xsl:for-each>
949             </span>
950         </xsl:if>
951
952          <!-- 583 -->
953              <xsl:if test="marc:datafield[@tag=583]">
954                  <xsl:for-each select="marc:datafield[@tag=583]">
955                     <xsl:if test="@ind1=1 or @ind1=' '">
956                       <span class="results_summary actionnote">
957                           <span class="label">Action note: </span>
958                              <xsl:choose>
959                                  <xsl:when test="marc:subfield[@code='z']">
960                                      <xsl:value-of select="marc:subfield[@code='z']"/>
961                                  </xsl:when>
962                                  <xsl:otherwise>
963                                      <xsl:call-template name="subfieldSelect">
964                                          <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
965                                      </xsl:call-template>
966                                  </xsl:otherwise>
967                              </xsl:choose>
968                          </span>
969                      </xsl:if>
970                  </xsl:for-each>
971              </xsl:if>
972
973         <!-- 508 -->
974         <xsl:if test="marc:datafield[@tag=508]">
975             <div class="results_summary prod_credits">
976                 <span class="label">Production credits: </span>
977                 <xsl:for-each select="marc:datafield[@tag=508]">
978                     <xsl:call-template name="subfieldSelectSpan">
979                         <xsl:with-param name="codes">a</xsl:with-param>
980                     </xsl:call-template>
981                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
982                 </xsl:for-each>
983             </div>
984         </xsl:if>
985
986         <!-- 773 -->
987         <xsl:if test="marc:datafield[@tag=773]">
988             <xsl:for-each select="marc:datafield[@tag=773]">
989                 <xsl:if test="@ind1 !=1">
990                     <span class="results_summary in"><span class="label">
991                     <xsl:choose>
992                         <xsl:when test="@ind2=' '">
993                             In:
994                         </xsl:when>
995                         <xsl:when test="@ind2=8">
996                             <xsl:if test="marc:subfield[@code='i']">
997                                 <xsl:value-of select="marc:subfield[@code='i']"/>
998                             </xsl:if>
999                         </xsl:when>
1000                     </xsl:choose>
1001                     </span>
1002                     <xsl:variable name="f773">
1003                         <xsl:call-template name="chopPunctuation">
1004                             <xsl:with-param name="chopString">
1005                                 <xsl:call-template name="subfieldSelect">
1006                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1007                                 </xsl:call-template>
1008                             </xsl:with-param>
1009                         </xsl:call-template>
1010                     </xsl:variable>
1011                     <xsl:choose>
1012                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1013                             <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>
1014                             <xsl:value-of select="translate($f773, '()', '')"/>
1015                             </a>
1016                         </xsl:when>
1017                         <xsl:when test="marc:subfield[@code='0']">
1018                             <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>
1019                             <xsl:value-of select="$f773"/>
1020                             </a>
1021                         </xsl:when>
1022                         <xsl:otherwise>
1023                             <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>
1024                             <xsl:value-of select="$f773"/>
1025                             </a>
1026                         </xsl:otherwise>
1027                     </xsl:choose>
1028                     <xsl:if test="marc:subfield[@code='g']">
1029                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
1030                     </xsl:if>
1031                     </span>
1032
1033                     <xsl:if test="marc:subfield[@code='n']">
1034                         <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1035                     </xsl:if>
1036
1037                 </xsl:if>
1038             </xsl:for-each>
1039         </xsl:if>
1040
1041         <xsl:if test="marc:datafield[@tag=502]">
1042             <span class="results_summary diss_note">
1043                 <span class="label">Dissertation note: </span>
1044                 <xsl:for-each select="marc:datafield[@tag=502]">
1045                     <xsl:call-template name="subfieldSelect">
1046                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1047                     </xsl:call-template>
1048                 </xsl:for-each>
1049                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1050             </span>
1051         </xsl:if>
1052
1053         <!-- 866 textual holdings -->
1054         <xsl:if test="marc:datafield[@tag=866]">
1055             <span class="results_summary holdings_note"><span class="label">Holdings: </span><br />
1056                 <xsl:for-each select="marc:datafield[@tag=866]">
1057                     <xsl:call-template name="subfieldSelect">
1058                         <xsl:with-param name="codes">axz</xsl:with-param>
1059                     </xsl:call-template>
1060                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1061                 </xsl:for-each>
1062             </span>
1063         </xsl:if>
1064
1065         <!-- 867 textual holdings -->
1066         <xsl:if test="marc:datafield[@tag=867]">
1067             <span class="results_summary holdings_note"><span class="label">Supplements: </span><br />
1068                 <xsl:for-each select="marc:datafield[@tag=867]">
1069                     <xsl:call-template name="subfieldSelect">
1070                         <xsl:with-param name="codes">axz</xsl:with-param>
1071                     </xsl:call-template>
1072                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1073                 </xsl:for-each>
1074             </span>
1075         </xsl:if>
1076
1077         <!-- 868 textual holdings -->
1078         <xsl:if test="marc:datafield[@tag=868]">
1079             <span class="results_summary holdings_note"><span class="label">Indexes: </span><br />
1080                 <xsl:for-each select="marc:datafield[@tag=868]">
1081                     <xsl:call-template name="subfieldSelect">
1082                         <xsl:with-param name="codes">axz</xsl:with-param>
1083                     </xsl:call-template>
1084                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1085                 </xsl:for-each>
1086             </span>
1087         </xsl:if>
1088
1089
1090         <!--  775 Other Edition  -->
1091         <xsl:if test="marc:datafield[@tag=775]">
1092         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1093         <xsl:for-each select="marc:datafield[@tag=775]">
1094             <xsl:variable name="f775">
1095                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1096                 <xsl:with-param name="codes">a_t</xsl:with-param>
1097                 </xsl:call-template></xsl:with-param></xsl:call-template>
1098             </xsl:variable>
1099             <xsl:if test="marc:subfield[@code='i']">
1100                 <xsl:call-template name="subfieldSelect">
1101                     <xsl:with-param name="codes">i</xsl:with-param>
1102                 </xsl:call-template>
1103                 <xsl:text>: </xsl:text>
1104             </xsl:if>
1105             <a>
1106             <xsl:choose>
1107             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1108                 <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>
1109             </xsl:when>
1110             <xsl:otherwise>
1111                 <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>
1112             </xsl:otherwise>
1113             </xsl:choose>
1114             <xsl:call-template name="subfieldSelect">
1115                 <xsl:with-param name="codes">a_t</xsl:with-param>
1116             </xsl:call-template>
1117             </a>
1118             <xsl:choose>
1119                 <xsl:when test="position()=last()"></xsl:when>
1120                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1121             </xsl:choose>
1122         </xsl:for-each>
1123         </span>
1124         </xsl:if>
1125
1126         <!-- 780 -->
1127         <xsl:if test="marc:datafield[@tag=780]">
1128         <xsl:for-each select="marc:datafield[@tag=780]">
1129         <xsl:if test="@ind1=0">
1130         <span class="results_summary preceeding_entry">
1131         <xsl:choose>
1132         <xsl:when test="@ind2=0">
1133             <span class="label">Continues:</span>
1134         </xsl:when>
1135         <xsl:when test="@ind2=1">
1136             <span class="label">Continues in part:</span>
1137         </xsl:when>
1138         <xsl:when test="@ind2=2">
1139             <span class="label">Supersedes:</span>
1140         </xsl:when>
1141         <xsl:when test="@ind2=3">
1142             <span class="label">Supersedes in part:</span>
1143         </xsl:when>
1144         <xsl:when test="@ind2=4">
1145             <span class="label">Formed by the union: ... and: ...</span>
1146         </xsl:when>
1147         <xsl:when test="@ind2=5">
1148             <span class="label">Absorbed:</span>
1149         </xsl:when>
1150         <xsl:when test="@ind2=6">
1151             <span class="label">Absorbed in part:</span>
1152         </xsl:when>
1153         <xsl:when test="@ind2=7">
1154             <span class="label">Separated from:</span>
1155         </xsl:when>
1156         </xsl:choose>
1157         <xsl:text> </xsl:text>
1158                 <xsl:variable name="f780">
1159                     <xsl:call-template name="subfieldSelect">
1160                         <xsl:with-param name="codes">a_t</xsl:with-param>
1161                     </xsl:call-template>
1162                 </xsl:variable>
1163             <xsl:choose>
1164                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1165                     <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>
1166                         <xsl:value-of select="translate($f780, '()', '')"/>
1167                     </a>
1168                 </xsl:when>
1169                 <xsl:otherwise>
1170                     <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>
1171                         <xsl:value-of select="translate($f780, '()', '')"/>
1172                     </a>
1173                 </xsl:otherwise>
1174             </xsl:choose>
1175         </span>
1176  
1177         <xsl:if test="marc:subfield[@code='n']">
1178             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1179         </xsl:if>
1180
1181         </xsl:if>
1182         </xsl:for-each>
1183         </xsl:if>
1184
1185         <!-- 785 -->
1186         <xsl:if test="marc:datafield[@tag=785]">
1187         <xsl:for-each select="marc:datafield[@tag=785]">
1188         <span class="results_summary succeeding_entry">
1189         <xsl:choose>
1190         <xsl:when test="@ind2=0">
1191             <span class="label">Continued by:</span>
1192         </xsl:when>
1193         <xsl:when test="@ind2=1">
1194             <span class="label">Continued in part by:</span>
1195         </xsl:when>
1196         <xsl:when test="@ind2=2">
1197             <span class="label">Superseded by:</span>
1198         </xsl:when>
1199         <xsl:when test="@ind2=3">
1200             <span class="label">Superseded in part by:</span>
1201         </xsl:when>
1202         <xsl:when test="@ind2=4">
1203             <span class="label">Absorbed by:</span>
1204         </xsl:when>
1205         <xsl:when test="@ind2=5">
1206             <span class="label">Absorbed in part by:</span>
1207         </xsl:when>
1208         <xsl:when test="@ind2=6">
1209             <span class="label">Split into .. and ...:</span>
1210         </xsl:when>
1211         <xsl:when test="@ind2=7">
1212             <span class="label">Merged with ... to form ...</span>
1213         </xsl:when>
1214         <xsl:when test="@ind2=8">
1215             <span class="label">Changed back to:</span>
1216         </xsl:when>
1217         </xsl:choose>
1218         <xsl:text> </xsl:text>
1219                    <xsl:variable name="f785">
1220                     <xsl:call-template name="subfieldSelect">
1221                         <xsl:with-param name="codes">a_t</xsl:with-param>
1222                     </xsl:call-template>
1223                 </xsl:variable>
1224
1225             <xsl:choose>
1226                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1227                     <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>
1228                         <xsl:value-of select="translate($f785, '()', '')"/>
1229                     </a>
1230                 </xsl:when>
1231                 <xsl:otherwise>
1232                     <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>
1233                         <xsl:value-of select="translate($f785, '()', '')"/>
1234                     </a>
1235                 </xsl:otherwise>
1236             </xsl:choose>
1237
1238         </span>
1239         </xsl:for-each>
1240         </xsl:if>
1241
1242         <xsl:if test="$OPACBaseURL!=''">
1243         <span class="results_summary"><span class="label">OPAC view: </span>
1244             <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>.
1245         </span>
1246         </xsl:if>
1247
1248     </xsl:template>
1249
1250     <xsl:template name="nameABCQ">
1251             <xsl:call-template name="chopPunctuation">
1252                 <xsl:with-param name="chopString">
1253                     <xsl:call-template name="subfieldSelect">
1254                         <xsl:with-param name="codes">abcq</xsl:with-param>
1255                     </xsl:call-template>
1256                 </xsl:with-param>
1257                 <xsl:with-param name="punctuation">
1258                     <xsl:text>:,;/ </xsl:text>
1259                 </xsl:with-param>
1260             </xsl:call-template>
1261     </xsl:template>
1262
1263     <xsl:template name="nameABCDN">
1264             <xsl:call-template name="chopPunctuation">
1265                 <xsl:with-param name="chopString">
1266                     <xsl:call-template name="subfieldSelect">
1267                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1268                     </xsl:call-template>
1269                 </xsl:with-param>
1270                 <xsl:with-param name="punctuation">
1271                     <xsl:text>:,;/ </xsl:text>
1272                 </xsl:with-param>
1273             </xsl:call-template>
1274     </xsl:template>
1275
1276     <xsl:template name="nameACDEQ">
1277             <xsl:call-template name="subfieldSelect">
1278                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1279             </xsl:call-template>
1280     </xsl:template>
1281
1282     <xsl:template name="part">
1283         <xsl:variable name="partNumber">
1284             <xsl:call-template name="specialSubfieldSelect">
1285                 <xsl:with-param name="axis">n</xsl:with-param>
1286                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1287                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1288             </xsl:call-template>
1289         </xsl:variable>
1290         <xsl:variable name="partName">
1291             <xsl:call-template name="specialSubfieldSelect">
1292                 <xsl:with-param name="axis">p</xsl:with-param>
1293                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1294                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1295             </xsl:call-template>
1296         </xsl:variable>
1297         <xsl:if test="string-length(normalize-space($partNumber))">
1298                 <xsl:call-template name="chopPunctuation">
1299                     <xsl:with-param name="chopString" select="$partNumber"/>
1300                 </xsl:call-template>
1301         </xsl:if>
1302         <xsl:if test="string-length(normalize-space($partName))">
1303                 <xsl:call-template name="chopPunctuation">
1304                     <xsl:with-param name="chopString" select="$partName"/>
1305                 </xsl:call-template>
1306         </xsl:if>
1307     </xsl:template>
1308
1309     <xsl:template name="specialSubfieldSelect">
1310         <xsl:param name="anyCodes"/>
1311         <xsl:param name="axis"/>
1312         <xsl:param name="beforeCodes"/>
1313         <xsl:param name="afterCodes"/>
1314         <xsl:variable name="str">
1315             <xsl:for-each select="marc:subfield">
1316                 <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])">
1317                     <xsl:value-of select="text()"/>
1318                     <xsl:text> </xsl:text>
1319                 </xsl:if>
1320             </xsl:for-each>
1321         </xsl:variable>
1322         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1323     </xsl:template>
1324
1325     <xsl:template name="showAuthor">
1326         <xsl:param name="authorfield"/>
1327     <xsl:param name="UseAuthoritiesForTracings"/>
1328         <xsl:if test="count($authorfield)&gt;0">
1329         <h5 class="author">
1330         <xsl:for-each select="$authorfield">
1331         <xsl:choose>
1332           <xsl:when test="position()&gt;1"/>
1333           <!-- #13383 -->
1334           <xsl:when test="@tag&lt;700">By: </xsl:when>
1335           <!--#13382 Changed Additional author to contributor -->
1336           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1337         </xsl:choose>
1338         <a>
1339         <xsl:choose>
1340             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1341                 <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>
1342             </xsl:when>
1343             <xsl:otherwise>
1344             <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>
1345             </xsl:otherwise>
1346         </xsl:choose>
1347         <xsl:choose>
1348             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1349                 <!-- #13383 -->
1350                 <xsl:call-template name="chopPunctuation">
1351                     <xsl:with-param name="chopString">
1352                         <xsl:call-template name="subfieldSelect">
1353                             <xsl:with-param name="codes">
1354                                 <xsl:choose>
1355                                     <!-- #13383 include subfield e for field 111, Display only name portion in 1XX -->
1356                                     <xsl:when test="@tag=111">aeq</xsl:when>
1357                                     <xsl:when test="@tag=110">ab</xsl:when>
1358                                     <xsl:otherwise>abcjq</xsl:otherwise>
1359                                 </xsl:choose>
1360                             </xsl:with-param>
1361                         </xsl:call-template>
1362                     </xsl:with-param>
1363                     <xsl:with-param name="punctuation">
1364                         <xsl:text>:,;/ </xsl:text>
1365                     </xsl:with-param>
1366                 </xsl:call-template>
1367                     <!-- Display only name and title portion in 110 field -->
1368                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1369                     <span class="titleportion">
1370                     <xsl:choose>
1371                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1372                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1373                     </xsl:choose>
1374                     <xsl:call-template name="chopPunctuation">
1375                         <xsl:with-param name="chopString">
1376                         <xsl:call-template name="subfieldSelect">
1377                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1378                         </xsl:call-template>
1379                         </xsl:with-param>
1380                     </xsl:call-template>
1381                     </span>
1382                     </xsl:if>
1383                     <!-- Display only name and title portion in 111 field -->
1384             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1385                     <span class="titleportion">
1386                     <xsl:choose>
1387                         <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>
1388                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1389                     </xsl:choose>
1390
1391                     <xsl:call-template name="chopPunctuation">
1392                         <xsl:with-param name="chopString">
1393                         <xsl:call-template name="subfieldSelect">
1394                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1395                         </xsl:call-template>
1396                         </xsl:with-param>
1397                     </xsl:call-template>
1398                     </span>
1399             </xsl:if>
1400             <!-- Display only dates in 100 field -->
1401             <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1402                 <span class="authordates">
1403                 <xsl:text>, </xsl:text>
1404                 <xsl:call-template name="chopPunctuation">
1405                     <xsl:with-param name="chopString">
1406                         <xsl:call-template name="subfieldSelect">
1407                            <xsl:with-param name="codes">d</xsl:with-param>
1408                         </xsl:call-template>
1409                         </xsl:with-param>
1410                     </xsl:call-template>
1411                     </span>
1412             </xsl:if>
1413
1414             </xsl:when>
1415             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1416             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1417             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1418                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1419                     <xsl:if test="@tag=710 or @tag=711">
1420                     <xsl:call-template name="chopPunctuation">
1421                         <xsl:with-param name="chopString">
1422                             <xsl:call-template name="subfieldSelect">
1423                             <xsl:with-param name="codes">
1424                             <xsl:choose>
1425                                 <xsl:when test="@tag=711">aeq</xsl:when>
1426                                 <xsl:otherwise>ab</xsl:otherwise>
1427                             </xsl:choose>
1428                             </xsl:with-param>
1429                             </xsl:call-template>
1430                         </xsl:with-param>
1431                         <xsl:with-param name="punctuation">
1432                             <xsl:text>:,;/ </xsl:text>
1433                         </xsl:with-param>
1434                     </xsl:call-template>
1435                     <!-- Display only name and title portion in 711 field -->
1436                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1437                     <span class="titleportion">
1438                     <xsl:choose>
1439                         <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>
1440                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1441                     </xsl:choose>
1442
1443                     <xsl:call-template name="chopPunctuation">
1444                         <xsl:with-param name="chopString">
1445                         <xsl:call-template name="subfieldSelect">
1446                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1447                         </xsl:call-template>
1448                         </xsl:with-param>
1449                     </xsl:call-template>
1450                     </span>
1451                     </xsl:if>
1452                     <!-- Display only name and title portion in 710 field -->
1453                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1454                     <span class="titleportion">
1455                     <xsl:choose>
1456                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1457                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1458                     </xsl:choose>
1459                     <xsl:call-template name="chopPunctuation">
1460                         <xsl:with-param name="chopString">
1461                         <xsl:call-template name="subfieldSelect">
1462                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1463                         </xsl:call-template>
1464                         </xsl:with-param>
1465                     </xsl:call-template>
1466                     </span>
1467                     </xsl:if>
1468
1469                     </xsl:if>
1470                         <!-- Display only name portion in 700 field -->
1471                         <xsl:if test="@tag=700">
1472                            <xsl:call-template name="chopPunctuation">
1473                                <xsl:with-param name="chopString">
1474                                <xsl:call-template name="subfieldSelect">
1475                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1476                                </xsl:call-template>
1477                                </xsl:with-param>
1478                         </xsl:call-template>
1479                         </xsl:if>
1480                         <!-- Display class "authordates" in 700 field -->
1481                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1482                         <span class="authordates">
1483                         <xsl:text>, </xsl:text>
1484                         <xsl:call-template name="chopPunctuation">
1485                             <xsl:with-param name="chopString">
1486                             <xsl:call-template name="subfieldSelect">
1487                                <xsl:with-param name="codes">d</xsl:with-param>
1488                             </xsl:call-template>
1489                             </xsl:with-param>
1490                         </xsl:call-template>
1491                         </span>
1492                         </xsl:if>
1493                         <!-- Display class "titleportion" in 700 field -->
1494                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1495                         <xsl:if test="@tag=700 and $titleportionfields">
1496                         <span class="titleportion">
1497                         <xsl:text>. </xsl:text>
1498                         <xsl:call-template name="chopPunctuation">
1499                             <xsl:with-param name="chopString">
1500                             <xsl:call-template name="subfieldSelect">
1501                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1502                             </xsl:call-template>
1503                             </xsl:with-param>
1504                         </xsl:call-template>
1505                         </span>
1506                         </xsl:if>
1507
1508         </xsl:when>
1509         </xsl:choose>
1510
1511     <!-- add relator code too between brackets-->
1512     <!-- #13383 include relator code j for field 111 -->
1513             <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'])">
1514                 <span class="relatorcode">
1515                     <xsl:text> [</xsl:text>
1516                     <xsl:choose>
1517                         <xsl:when test="@tag=111 or @tag=711">
1518                             <xsl:choose>
1519                                 <!-- Prefer j over 4 for fields 111 and 711-->
1520                                 <xsl:when test="marc:subfield[@code='j']">
1521                                     <xsl:for-each select="marc:subfield[@code='j']">
1522                                         <xsl:value-of select="."/>
1523                                         <xsl:if test="position() != last()">, </xsl:if>
1524                                     </xsl:for-each>
1525                                 </xsl:when>
1526                                 <xsl:otherwise>
1527                                     <xsl:for-each select="marc:subfield[@code=4]">
1528                                         <xsl:value-of select="."/>
1529                                         <xsl:if test="position() != last()">, </xsl:if>
1530                                     </xsl:for-each>
1531                                 </xsl:otherwise>
1532                             </xsl:choose>
1533                         </xsl:when>
1534                         <!-- Prefer e over 4 for fields 111 and 711-->
1535                         <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1536                             <xsl:for-each select="marc:subfield[@code='e']">
1537                                 <xsl:value-of select="."/>
1538                                 <xsl:if test="position() != last()">, </xsl:if>
1539                             </xsl:for-each>
1540                         </xsl:when>
1541                         <xsl:otherwise>
1542                             <xsl:for-each select="marc:subfield[@code=4]">
1543                                 <xsl:value-of select="."/>
1544                                 <xsl:if test="position() != last()">, </xsl:if>
1545                             </xsl:for-each>
1546                         </xsl:otherwise>
1547                     </xsl:choose>
1548                     <xsl:text>]</xsl:text>
1549                 </span>
1550             </xsl:if>
1551         </a>
1552         <xsl:choose>
1553             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1554         </xsl:choose>
1555         </xsl:for-each>
1556         </h5>
1557
1558         </xsl:if>
1559     </xsl:template>
1560
1561     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1562     <xsl:template name="subfieldSelectSubject">
1563         <xsl:param name="codes"/>
1564         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1565         <xsl:param name="subdivCodes"/>
1566         <xsl:param name="subdivDelimiter"/>
1567         <xsl:param name="prefix"/>
1568         <xsl:param name="suffix"/>
1569         <xsl:param name="urlencode"/>
1570         <xsl:variable name="str">
1571             <xsl:for-each select="marc:subfield">
1572                 <xsl:if test="contains($codes, @code)">
1573                     <xsl:if test="contains($subdivCodes, @code)">
1574                         <xsl:value-of select="$subdivDelimiter"/>
1575                     </xsl:if>
1576                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1577                 </xsl:if>
1578             </xsl:for-each>
1579         </xsl:variable>
1580         <xsl:choose>
1581             <xsl:when test="$urlencode=1">
1582                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
1583             </xsl:when>
1584             <xsl:otherwise>
1585                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1586             </xsl:otherwise>
1587         </xsl:choose>
1588     </xsl:template>
1589
1590 </xsl:stylesheet>