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