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