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