Bug 13650: Remove parens from links to fix searches
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / xslt / MARC21slim2OPACDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
3 <!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com  -->
4 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
5 <xsl:stylesheet version="1.0"
6   xmlns:marc="http://www.loc.gov/MARC21/slim"
7   xmlns:items="http://www.koha-community.org/items"
8   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9   exclude-result-prefixes="marc items">
10     <xsl:import href="MARC21slimUtils.xsl"/>
11     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
12
13     <xsl:template match="/">
14             <xsl:apply-templates/>
15     </xsl:template>
16
17     <xsl:template match="marc:record">
18
19         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21
22     <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
23     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
24     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
25     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
26
27     <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
28     <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
29     <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
30     <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='OPACDisplay856uAsImage']"/>
31     <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>
32     <xsl:variable name="theme" select="marc:sysprefs/marc:syspref[@name='opacthemes']"/>
33     <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
34     <xsl:variable name="TracingQuotesLeft">
35       <xsl:choose>
36         <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
37         <xsl:otherwise>"</xsl:otherwise>
38       </xsl:choose>
39     </xsl:variable>
40     <xsl:variable name="TracingQuotesRight">
41       <xsl:choose>
42         <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
43         <xsl:otherwise>"</xsl:otherwise>
44       </xsl:choose>
45     </xsl:variable>
46         <xsl:variable name="leader" select="marc:leader"/>
47         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
48         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
49         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
50         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
51         <xsl:variable name="materialTypeCode">
52             <xsl:choose>
53                 <xsl:when test="$leader19='a'">ST</xsl:when>
54                 <xsl:when test="$leader6='a'">
55                     <xsl:choose>
56                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
57                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
58                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
59                     </xsl:choose>
60                 </xsl:when>
61                 <xsl:when test="$leader6='t'">BK</xsl:when>
62                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
63                 <xsl:when test="$leader6='m'">CF</xsl:when>
64                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
65                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
66                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
67                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
68             </xsl:choose>
69         </xsl:variable>
70         <xsl:variable name="materialTypeLabel">
71             <xsl:choose>
72                 <xsl:when test="$leader19='a'">Set</xsl:when>
73                 <xsl:when test="$leader6='a'">
74                     <xsl:choose>
75                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
76                         <xsl:when test="$leader7='i' or $leader7='s'">
77                             <xsl:choose>
78                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
79                                 <xsl:otherwise>Series</xsl:otherwise>
80                             </xsl:choose>
81                         </xsl:when>
82                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
83                     </xsl:choose>
84                 </xsl:when>
85                 <xsl:when test="$leader6='t'">Book</xsl:when>
86                                 <xsl:when test="$leader6='o'">Kit</xsl:when>
87                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
88                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
89                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
90                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual material</xsl:when>
91                 <xsl:when test="$leader6='j'">Music</xsl:when>
92                 <xsl:when test="$leader6='i'">Sound</xsl:when>
93                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
94             </xsl:choose>
95         </xsl:variable>
96
97         <!-- Schema.org type -->
98         <xsl:variable name="schemaOrgType">
99             <xsl:choose>
100                 <xsl:when test="$materialTypeLabel='Book'">Book</xsl:when>
101                 <xsl:when test="$materialTypeLabel='Map'">Map</xsl:when>
102                 <xsl:when test="$materialTypeLabel='Music'">MusicAlbum</xsl:when>
103                 <xsl:otherwise>CreativeWork</xsl:otherwise>
104             </xsl:choose>
105         </xsl:variable>
106
107         <!-- Wrapper div for our schema.org object -->
108         <xsl:element name="div">
109             <xsl:attribute name="class">record</xsl:attribute>
110             <xsl:attribute name="vocab">http://schema.org/</xsl:attribute>
111             <xsl:attribute name="typeof"><xsl:value-of select='$schemaOrgType' /> Product</xsl:attribute>
112             <xsl:attribute name="resource">#record</xsl:attribute>
113
114         <!-- Title Statement -->
115         <!-- Alternate Graphic Representation (MARC 880) -->
116         <xsl:if test="$display880">
117             <h1 class="title" property="alternateName">
118                 <xsl:call-template name="m880Select">
119                     <xsl:with-param name="basetags">245</xsl:with-param>
120                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
121                 </xsl:call-template>
122             </h1>
123         </xsl:if>
124
125             <!--Bug 13381 -->
126             <xsl:if test="marc:datafield[@tag=245]">
127                 <h1 class="title" property="name">
128                     <xsl:for-each select="marc:datafield[@tag=245]">
129                         <xsl:call-template name="subfieldSelect">
130                             <xsl:with-param name="codes">a</xsl:with-param>
131                         </xsl:call-template>
132                         <xsl:text> </xsl:text>
133                         <!-- 13381 add additional subfields-->
134                         <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
135                             <xsl:choose>
136                                 <xsl:when test="@code='h'">
137                                     <!--  13381 Span class around subfield h so it can be suppressed via css -->
138                                     <span class="title_medium"><xsl:apply-templates/> </span>
139                                 </xsl:when>
140                                 <xsl:when test="@code='c'">
141                                     <!--  13381 Span class around subfield c so it can be suppressed via css -->
142                                     <span class="title_resp_stmt"><xsl:apply-templates/> </span>
143                                 </xsl:when>
144                                 <xsl:otherwise>
145                                     <xsl:apply-templates/>
146                                     <xsl:text> </xsl:text>
147                                 </xsl:otherwise>
148                             </xsl:choose>
149                         </xsl:for-each>
150                     </xsl:for-each>
151                 </h1>
152             </xsl:if>
153
154
155         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
156         <xsl:if test="$display880">
157             <h5 class="author">
158                 <xsl:call-template name="m880Select">
159                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
160                     <xsl:with-param name="codes">abc</xsl:with-param>
161                     <xsl:with-param name="index">au</xsl:with-param>
162                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
163                 </xsl:call-template>
164             </h5>
165         </xsl:if>
166         <xsl:choose>
167             <xsl:when test="marc:datafield[@tag=100] or marc:datafield[@tag=110] or marc:datafield[@tag=111] or marc:datafield[@tag=700] or marc:datafield[@tag=710] or marc:datafield[@tag=711]">
168                 <h5 class="author">by
169                     <xsl:call-template name="showAuthor">
170                         <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111 or @tag=700 or @tag=710 or @tag=711]"/>
171                         <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
172                         <xsl:with-param name="materialTypeLabel" select="$materialTypeLabel"/>
173                         <xsl:with-param name="theme" select="$theme"/>
174                     </xsl:call-template>
175                 </h5>
176             </xsl:when>
177         </xsl:choose>
178
179    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
180         <xsl:if test="$materialTypeCode!=''">
181         <span class="results_summary type"><span class="label">Material type: </span>
182         <xsl:element name="img"><xsl:attribute name="src">/opac-tmpl/lib/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt">materialTypeLabel</xsl:attribute><xsl:attribute name="class">materialtype</xsl:attribute></xsl:element>
183         <xsl:value-of select="$materialTypeLabel"/>
184         </span>
185         </xsl:if>
186    </xsl:if>
187
188         <!--Series: Alternate Graphic Representation (MARC 880) -->
189         <xsl:if test="$display880">
190             <xsl:call-template name="m880Select">
191                 <xsl:with-param name="basetags">440,490</xsl:with-param>
192                 <xsl:with-param name="codes">av</xsl:with-param>
193                 <xsl:with-param name="class">results_summary series</xsl:with-param>
194                 <xsl:with-param name="label">Series: </xsl:with-param>
195                 <xsl:with-param name="index">se</xsl:with-param>
196             </xsl:call-template>
197         </xsl:if>
198
199         <!-- Series -->
200         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
201         <span class="results_summary series"><span class="label">Series: </span>
202         <!-- 440 -->
203         <xsl:for-each select="marc:datafield[@tag=440]">
204             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
205             <xsl:call-template name="chopPunctuation">
206                             <xsl:with-param name="chopString">
207                                 <xsl:call-template name="subfieldSelect">
208                                     <xsl:with-param name="codes">av</xsl:with-param>
209                                 </xsl:call-template>
210                             </xsl:with-param>
211                         </xsl:call-template>
212             </a>
213             <xsl:call-template name="part"/>
214             <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
215         </xsl:for-each>
216
217         <!-- 490 Series not traced, Ind1 = 0 -->
218         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
219             <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</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         <!-- 490 Series traced, Ind1 = 1 -->
232         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
233             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
234                 <xsl:choose>
235                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
236                         <a href="/cgi-bin/koha/opac-search.pl?q=rcn:{marc:subfield[@code='w']}">
237                             <xsl:call-template name="chopPunctuation">
238                                 <xsl:with-param name="chopString">
239                                     <xsl:call-template name="subfieldSelect">
240                                         <xsl:with-param name="codes">a_t</xsl:with-param>
241                                     </xsl:call-template>
242                                 </xsl:with-param>
243                             </xsl:call-template>
244                         </a>
245                     </xsl:when>
246                     <xsl:otherwise>
247                         <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
248                             <xsl:call-template name="chopPunctuation">
249                                 <xsl:with-param name="chopString">
250                                     <xsl:call-template name="subfieldSelect">
251                                         <xsl:with-param name="codes">a_t</xsl:with-param>
252                                     </xsl:call-template>
253                                 </xsl:with-param>
254                             </xsl:call-template>
255                         </a>
256                         <xsl:call-template name="part"/>
257                     </xsl:otherwise>
258                 </xsl:choose>
259                 <xsl:text>: </xsl:text>
260                 <xsl:value-of  select="marc:subfield[@code='v']" />
261             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
262             </xsl:for-each>
263         </xsl:if>
264         </span>
265         </xsl:if>
266
267         <!-- Analytics -->
268         <xsl:if test="$leader7='s'">
269         <span class="results_summary analytics"><span class="label">Analytics: </span>
270             <a>
271             <xsl:choose>
272             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
273                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
274             </xsl:when>
275             <xsl:otherwise>
276                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
277             </xsl:otherwise>
278             </xsl:choose>
279             <xsl:text>Show analytics</xsl:text>
280             </a>
281         </span>
282         </xsl:if>
283
284         <!-- Volumes of sets and traced series -->
285         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
286         <span class="results_summary volumes"><span class="label">Volumes: </span>
287             <a>
288             <xsl:choose>
289             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
290                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute>
291             </xsl:when>
292             <xsl:otherwise>
293                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
294             </xsl:otherwise>
295             </xsl:choose>
296             <xsl:text>Show volumes</xsl:text>
297             </a>
298         </span>
299         </xsl:if>
300
301         <!-- Set -->
302         <xsl:if test="$leader19='c'">
303         <span class="results_summary set"><span class="label">Set: </span>
304         <xsl:for-each select="marc:datafield[@tag=773]">
305             <a>
306             <xsl:choose>
307             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
308                 <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>
309             </xsl:when>
310             <xsl:otherwise>
311                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
312             </xsl:otherwise>
313             </xsl:choose>
314             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
315             </a>
316             <xsl:choose>
317                 <xsl:when test="position()=last()"></xsl:when>
318                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
319             </xsl:choose>
320         </xsl:for-each>
321         </span>
322         </xsl:if>
323
324         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
325         <xsl:if test="$display880">
326             <xsl:call-template name="m880Select">
327                 <xsl:with-param name="basetags">260</xsl:with-param>
328                 <xsl:with-param name="codes">abcg</xsl:with-param>
329                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
330                 <xsl:with-param name="label">Publisher: </xsl:with-param>
331             </xsl:call-template>
332         </xsl:if>
333
334         <!-- Publisher info and RDA related info from tags 260, 264 -->
335         <xsl:choose>
336         <xsl:when test="marc:datafield[@tag=260]">
337         <span class="results_summary publisher"><span class="label">Publisher: </span>
338             <xsl:for-each select="marc:datafield[@tag=260]">
339                 <span property="publisher" typeof="Organization">
340                 <xsl:if test="marc:subfield[@code='a']">
341                     <span property="location">
342                     <xsl:call-template name="subfieldSelect">
343                         <xsl:with-param name="codes">a</xsl:with-param>
344                     </xsl:call-template>
345                     </span>
346                 </xsl:if>
347                 <xsl:text> </xsl:text>
348                 <xsl:if test="marc:subfield[@code='b']">
349                 <span property="name"><a href="/cgi-bin/koha/opac-search.pl?q=pb:{marc:subfield[@code='b']}">
350                     <xsl:call-template name="subfieldSelect">
351                         <xsl:with-param name="codes">b</xsl:with-param>
352                     </xsl:call-template>
353                 </a></span>
354                 </xsl:if>
355                 </span>
356                 <xsl:text> </xsl:text>
357                 <xsl:if test="marc:subfield[@code='c' or @code='g']">
358                 <span property="datePublished">
359                     <xsl:call-template name="chopPunctuation">
360                       <xsl:with-param name="chopString">
361                         <xsl:call-template name="subfieldSelect">
362                             <xsl:with-param name="codes">cg</xsl:with-param>
363                         </xsl:call-template>
364                        </xsl:with-param>
365                    </xsl:call-template>
366                 </span>
367                 </xsl:if>
368                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
369             </xsl:for-each>
370             <xsl:if test="marc:datafield[@tag=264]">
371                 <xsl:text>; </xsl:text>
372                 <xsl:call-template name="showRDAtag264"/>
373             </xsl:if>
374         </span>
375         </xsl:when>
376         <xsl:when test="marc:datafield[@tag=264]">
377             <span class="results_summary">
378                 <xsl:call-template name="showRDAtag264"/>
379             </span>
380         </xsl:when>
381         </xsl:choose>
382
383         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
384         <xsl:if test="$display880">
385             <xsl:call-template name="m880Select">
386                 <xsl:with-param name="basetags">250</xsl:with-param>
387                 <xsl:with-param name="codes">ab</xsl:with-param>
388                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
389                 <xsl:with-param name="label">Edition: </xsl:with-param>
390             </xsl:call-template>
391         </xsl:if>
392
393         <xsl:if test="marc:datafield[@tag=250]">
394         <span class="results_summary edition"><span class="label">Edition: </span>
395             <xsl:for-each select="marc:datafield[@tag=250]">
396                 <span property="bookEdition">
397                 <xsl:call-template name="chopPunctuation">
398                   <xsl:with-param name="chopString">
399                     <xsl:call-template name="subfieldSelect">
400                         <xsl:with-param name="codes">ab</xsl:with-param>
401                     </xsl:call-template>
402                    </xsl:with-param>
403                </xsl:call-template>
404                 </span>
405                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
406             </xsl:for-each>
407         </span>
408         </xsl:if>
409
410         <!-- Description: Alternate Graphic Representation (MARC 880) -->
411         <xsl:if test="$display880">
412             <xsl:call-template name="m880Select">
413                 <xsl:with-param name="basetags">300</xsl:with-param>
414                 <xsl:with-param name="codes">abceg</xsl:with-param>
415                 <xsl:with-param name="class">results_summary description</xsl:with-param>
416                 <xsl:with-param name="label">Description: </xsl:with-param>
417             </xsl:call-template>
418         </xsl:if>
419
420         <xsl:if test="marc:datafield[@tag=300]">
421         <span class="results_summary description"><span class="label">Description: </span>
422             <xsl:for-each select="marc:datafield[@tag=300]">
423                 <span property="description">
424                 <xsl:call-template name="chopPunctuation">
425                   <xsl:with-param name="chopString">
426                     <xsl:call-template name="subfieldSelect">
427                         <xsl:with-param name="codes">abceg</xsl:with-param>
428                     </xsl:call-template>
429                    </xsl:with-param>
430                </xsl:call-template>
431                 </span>
432                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
433             </xsl:for-each>
434         </span>
435        </xsl:if>
436
437         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
438           <span class="results_summary isbn"><span class="label">ISBN: </span>
439             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
440               <span property="isbn">
441                 <xsl:value-of select="."/>
442                 <xsl:choose>
443                   <xsl:when test="position()=last()">
444                     <xsl:text>.</xsl:text>
445                   </xsl:when>
446                   <xsl:otherwise>
447                     <xsl:text>; </xsl:text>
448                   </xsl:otherwise>
449                 </xsl:choose>
450               </span>
451             </xsl:for-each>
452           </span>
453         </xsl:if>
454
455         <!-- Build ISSN -->
456         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
457           <span class="results_summary issn"><span class="label">ISSN: </span>
458             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
459               <span property="issn">
460                 <xsl:value-of select="."/>
461                 <xsl:choose>
462                   <xsl:when test="position()=last()">
463                     <xsl:text>.</xsl:text>
464                   </xsl:when>
465                   <xsl:otherwise>
466                     <xsl:text>; </xsl:text>
467                   </xsl:otherwise>
468                 </xsl:choose>
469               </span>
470             </xsl:for-each>
471           </span>
472         </xsl:if>
473
474         <xsl:if test="marc:datafield[@tag=013]">
475             <span class="results_summary patent_info">
476                 <span class="label">Patent information: </span>
477                 <xsl:for-each select="marc:datafield[@tag=013]">
478                     <xsl:call-template name="subfieldSelect">
479                         <xsl:with-param name="codes">acdef</xsl:with-param>
480                         <xsl:with-param name="delimeter">, </xsl:with-param>
481                     </xsl:call-template>
482                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
483                 </xsl:for-each>
484             </span>
485         </xsl:if>
486
487         <xsl:if test="marc:datafield[@tag=088]">
488             <span class="results_summary report_number">
489                 <span class="label">Report number: </span>
490                 <xsl:for-each select="marc:datafield[@tag=088]">
491                     <xsl:call-template name="subfieldSelect">
492                         <xsl:with-param name="codes">a</xsl:with-param>
493                     </xsl:call-template>
494                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
495                 </xsl:for-each>
496             </span>
497         </xsl:if>
498
499         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
500         <xsl:if test="$display880">
501             <xsl:call-template name="m880Select">
502                 <xsl:with-param name="basetags">246</xsl:with-param>
503                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
504                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
505                 <xsl:with-param name="label">Other title: </xsl:with-param>
506             </xsl:call-template>
507         </xsl:if>
508
509         <xsl:if test="marc:datafield[@tag=246]">
510         <span class="results_summary other_title"><span class="label">Other title: </span>
511             <xsl:for-each select="marc:datafield[@tag=246]">
512                 <span property="alternateName">
513                 <xsl:call-template name="chopPunctuation">
514                   <xsl:with-param name="chopString">
515                     <xsl:call-template name="subfieldSelect">
516                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
517                     </xsl:call-template>
518                    </xsl:with-param>
519                </xsl:call-template>
520                 </span>
521                 <!-- #13386 added separator | -->
522                 <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>
523             </xsl:for-each>
524         </span>
525        </xsl:if>
526
527
528         <xsl:if test="marc:datafield[@tag=242]">
529         <span class="results_summary translated_title"><span class="label">Title translated: </span>
530             <xsl:for-each select="marc:datafield[@tag=242]">
531                 <span property="alternateName">
532                 <xsl:call-template name="chopPunctuation">
533                   <xsl:with-param name="chopString">
534                     <xsl:call-template name="subfieldSelect">
535                         <xsl:with-param name="codes">abchnp</xsl:with-param>
536                     </xsl:call-template>
537                    </xsl:with-param>
538                </xsl:call-template>
539                 </span>
540                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
541             </xsl:for-each>
542         </span>
543        </xsl:if>
544
545         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
546         <xsl:if test="$display880">
547             <span property="alternateName">
548             <xsl:call-template name="m880Select">
549                 <xsl:with-param name="basetags">130,240</xsl:with-param>
550                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
551                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
552                 <xsl:with-param name="label">Uniform titles: </xsl:with-param>
553             </xsl:call-template>
554             </span>
555         </xsl:if>
556
557         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
558         <span class="results_summary uniform_titles"><span class="label">Uniform titles: </span>
559         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
560             <span property="alternateName">
561             <xsl:variable name="str">
562                 <xsl:for-each select="marc:subfield">
563                     <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
564                         <xsl:value-of select="text()"/>
565                         <xsl:text> </xsl:text>
566                      </xsl:if>
567                 </xsl:for-each>
568             </xsl:variable>
569             <xsl:call-template name="chopPunctuation">
570                 <xsl:with-param name="chopString">
571                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
572
573                 </xsl:with-param>
574             </xsl:call-template>
575             </span>
576             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
577         </xsl:for-each>
578         </span>
579         </xsl:if>
580
581             <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
582             <span class="results_summary subjects"><span class="label">Subject(s): </span>
583                 <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
584             <span property="keywords">
585             <a>
586             <xsl:choose>
587             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
588                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
589             </xsl:when>
590             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
591             <xsl:when test="$TraceSubjectSubdivisions='1'">
592                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
593                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
594                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
595                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
596                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
597                     </xsl:call-template>
598                 </xsl:attribute>
599             </xsl:when>
600                 <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
601             <xsl:otherwise>
602                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
603             </xsl:otherwise>
604             </xsl:choose>
605             <xsl:call-template name="chopPunctuation">
606                 <xsl:with-param name="chopString">
607                     <xsl:call-template name="subfieldSelect">
608                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
609                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
610                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
611                     </xsl:call-template>
612                 </xsl:with-param>
613             </xsl:call-template>
614             </a>
615             </span>
616             <xsl:if test="marc:subfield[@code=9]">
617                 <a class='authlink'>
618                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
619                     <xsl:element name="img">
620                         <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
621                         <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
622                         <xsl:attribute name="height">15</xsl:attribute>
623                         <xsl:attribute name="width">15</xsl:attribute>
624                     </xsl:element>
625                 </a>
626             </xsl:if>
627             <xsl:choose>
628             <xsl:when test="position()=last()"></xsl:when>
629             <xsl:otherwise> | </xsl:otherwise>
630             </xsl:choose>
631
632             </xsl:for-each>
633             </span>
634         </xsl:if>
635
636             <!-- Genre/Form -->
637             <xsl:if test="marc:datafield[@tag=655]">
638                 <span class="results_summary genre"><span class="label">Genre/Form: </span>
639                     <xsl:for-each select="marc:datafield[@tag=655]">
640                         <a>
641                             <xsl:choose>
642                                 <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
643                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
644                                 </xsl:when>
645                                 <xsl:when test="$TraceSubjectSubdivisions='1'">
646                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelect">
647                                         <xsl:with-param name="codes">avxyz</xsl:with-param>
648                                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
649                                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
650                                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
651                                     </xsl:call-template>
652                                     </xsl:attribute>
653                                 </xsl:when>
654                                 <xsl:otherwise>
655                                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
656                                 </xsl:otherwise>
657                             </xsl:choose>
658                         </a>
659                         <xsl:call-template name="subfieldSelect">
660                             <xsl:with-param name="codes">avxyz</xsl:with-param>
661                             <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
662                             <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
663                         </xsl:call-template>
664                         <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
665                     </xsl:for-each>
666                 </span>
667             </xsl:if>
668
669 <!-- DDC classification -->
670     <xsl:if test="marc:datafield[@tag=082]">
671         <span class="results_summary ddc">
672             <span class="label">DDC classification: </span>
673             <xsl:for-each select="marc:datafield[@tag=082]">
674                 <xsl:call-template name="subfieldSelect">
675                     <xsl:with-param name="codes">a</xsl:with-param>
676                 </xsl:call-template>
677                 <xsl:choose>
678                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
679                     <xsl:otherwise> | </xsl:otherwise>
680                 </xsl:choose>
681             </xsl:for-each>
682         </span>
683     </xsl:if>
684
685
686 <!-- Image processing code added here, takes precedence over text links including y3z text   -->
687         <xsl:if test="marc:datafield[@tag=856]">
688         <span class="results_summary online_resources"><span class="label">Online resources: </span>
689         <xsl:for-each select="marc:datafield[@tag=856]">
690             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
691             <a property="url">
692             <xsl:choose>
693               <xsl:when test="$OPACTrackClicks='track'">
694                 <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="marc:subfield[@code='u']"/>;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
695               </xsl:when>
696               <xsl:when test="$OPACTrackClicks='anonymous'">
697                 <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="marc:subfield[@code='u']"/>;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
698               </xsl:when>
699               <xsl:otherwise>
700                 <xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
701               </xsl:otherwise>
702             </xsl:choose>
703             <xsl:if test="$OPACURLOpenInNewWindow='1'">
704                 <xsl:attribute name="target">_blank</xsl:attribute>
705             </xsl:if>
706             <xsl:choose>
707             <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')">
708                 <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>
709             </xsl:when>
710             <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
711                 <xsl:call-template name="subfieldSelect">
712                     <xsl:with-param name="codes">y3z</xsl:with-param>
713                 </xsl:call-template>
714             </xsl:when>
715             <xsl:when test="$URLLinkText!=''">
716                 <xsl:value-of select="$URLLinkText"/>
717             </xsl:when>
718             <xsl:otherwise>
719                 <xsl:text>Click here to access online</xsl:text>
720             </xsl:otherwise>
721             </xsl:choose>
722             </a>
723             <xsl:choose>
724             <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
725             <xsl:otherwise> | </xsl:otherwise>
726             </xsl:choose>
727         </xsl:for-each>
728         </span>
729         </xsl:if>
730
731         <!-- 530 -->
732         <xsl:if test="marc:datafield[@tag=530]">
733         <xsl:for-each select="marc:datafield[@tag=530]">
734         <span class="results_summary additionalforms">
735             <xsl:call-template name="subfieldSelect">
736                 <xsl:with-param name="codes">abcd</xsl:with-param>
737             </xsl:call-template>
738             <xsl:for-each select="marc:subfield[@code='u']">
739                 <a><xsl:attribute name="href"><xsl:value-of select="text()"/></xsl:attribute>
740                 <xsl:if test="$OPACURLOpenInNewWindow='1'">
741                     <xsl:attribute name="target">_blank</xsl:attribute>
742                 </xsl:if>
743                 <xsl:value-of select="text()"/>
744                 </a>
745             </xsl:for-each>
746         </span>
747         </xsl:for-each>
748         </xsl:if>
749
750         <!-- 505 -->
751         <xsl:if test="marc:datafield[@tag=505]">
752         <div class="results_summary contents">
753         <xsl:for-each select="marc:datafield[@tag=505]">
754         <xsl:if test="position()=1">
755             <xsl:choose>
756             <xsl:when test="@ind1=1">
757                 <span class="label">Incomplete contents:</span>
758             </xsl:when>
759             <xsl:when test="@ind1=2">
760                 <span class="label">Partial contents:</span>
761             </xsl:when>
762             <xsl:otherwise>
763                 <span class="label">Contents:</span>
764             </xsl:otherwise>
765             </xsl:choose>
766         </xsl:if>
767         <div class='contentblock' property='description'>
768         <xsl:choose>
769         <xsl:when test="@ind2=0">
770             <xsl:call-template name="subfieldSelectSpan">
771                 <xsl:with-param name="codes">tru</xsl:with-param>
772             </xsl:call-template>
773         </xsl:when>
774         <xsl:otherwise>
775             <xsl:call-template name="subfieldSelectSpan">
776                 <xsl:with-param name="codes">atru</xsl:with-param>
777             </xsl:call-template>
778         </xsl:otherwise>
779         </xsl:choose>
780         </div>
781         </xsl:for-each>
782         </div>
783         </xsl:if>
784
785         <!-- 583 -->
786         <xsl:if test="marc:datafield[@tag=583]">
787         <xsl:for-each select="marc:datafield[@tag=583]">
788             <xsl:if test="@ind1=1 or @ind1=' '">
789             <span class="results_summary actionnote">
790                 <xsl:choose>
791                 <xsl:when test="marc:subfield[@code='z']">
792                     <xsl:value-of select="marc:subfield[@code='z']"/>
793                 </xsl:when>
794                 <xsl:otherwise>
795                     <xsl:call-template name="subfieldSelect">
796                         <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
797                     </xsl:call-template>
798                 </xsl:otherwise>
799                 </xsl:choose>
800             </span>
801             </xsl:if>
802         </xsl:for-each>
803         </xsl:if>
804
805         <!-- 508 -->
806             <xsl:if test="marc:datafield[@tag=508]">
807                 <div class="results_summary prod_credits">
808                     <span class="label">Production Credits: </span>
809                     <xsl:for-each select="marc:datafield[@tag=508]">
810                         <xsl:call-template name="subfieldSelectSpan">
811                             <xsl:with-param name="codes">a</xsl:with-param>
812                         </xsl:call-template>
813                     </xsl:for-each>
814                 </div>
815             </xsl:if>
816
817         <!-- 586 -->
818         <xsl:if test="marc:datafield[@tag=586]">
819             <span class="results_summary awardsnote">
820                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
821                     <span class="label">Awards: </span>
822                 </xsl:if>
823                 <xsl:for-each select="marc:datafield[@tag=586]">
824                     <xsl:value-of select="marc:subfield[@code='a']"/>
825                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
826                 </xsl:for-each>
827             </span>
828         </xsl:if>
829
830         <!-- 773 -->
831         <xsl:if test="marc:datafield[@tag=773]">
832         <xsl:for-each select="marc:datafield[@tag=773]">
833         <xsl:if test="@ind1=0">
834         <span class="results_summary in"><span class="label">
835         <xsl:choose>
836         <xsl:when test="@ind2=' '">
837             In:
838         </xsl:when>
839         <xsl:when test="@ind2=8">
840             <xsl:if test="marc:subfield[@code='i']">
841                 <xsl:value-of select="marc:subfield[@code='i']"/>
842             </xsl:if>
843         </xsl:when>
844         </xsl:choose>
845         </span>
846                 <xsl:variable name="f773">
847                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
848                         <xsl:with-param name="codes">a_t</xsl:with-param>
849                     </xsl:call-template></xsl:with-param></xsl:call-template>
850                 </xsl:variable>
851             <xsl:choose>
852                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
853                     <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>
854                         <xsl:value-of select="translate($f773, '()', '')"/>
855                     </a>
856                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
857                 </xsl:when>
858                 <xsl:when test="marc:subfield[@code='0']">
859                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
860                         <xsl:value-of select="$f773"/>
861                     </a>
862                 </xsl:when>
863                 <xsl:otherwise>
864                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
865                         <xsl:value-of select="$f773"/>
866                     </a>
867                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
868                 </xsl:otherwise>
869             </xsl:choose>
870         </span>
871
872         <xsl:if test="marc:subfield[@code='n']">
873             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
874         </xsl:if>
875
876         </xsl:if>
877         </xsl:for-each>
878         </xsl:if>
879
880         <xsl:for-each select="marc:datafield[@tag=511]">
881             <span class="results_summary perf_note">
882                 <span class="label">
883                     <xsl:if test="@ind1=1"><xsl:text>Cast: </xsl:text></xsl:if>
884                 </span>
885                 <xsl:call-template name="subfieldSelect">
886                     <xsl:with-param name="codes">a</xsl:with-param>
887                 </xsl:call-template>
888             </span>
889         </xsl:for-each>
890
891         <xsl:if test="marc:datafield[@tag=502]">
892             <span class="results_summary diss_note">
893                 <span class="label">Dissertation note: </span>
894                 <xsl:for-each select="marc:datafield[@tag=502]">
895                     <xsl:call-template name="subfieldSelect">
896                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
897                     </xsl:call-template>
898                 </xsl:for-each>
899                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
900             </span>
901         </xsl:if>
902
903         <xsl:for-each select="marc:datafield[@tag=520]">
904         <span class="results_summary summary"><span class="label">
905         <xsl:choose>
906           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
907           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
908           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
909           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
910           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
911           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
912         </xsl:choose>
913         </span>
914         <xsl:call-template name="subfieldSelect">
915           <xsl:with-param name="codes">abcu</xsl:with-param>
916         </xsl:call-template>
917         </span>
918         </xsl:for-each>
919
920         <!-- 866 textual holdings -->
921         <xsl:if test="marc:datafield[@tag=866]">
922             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
923                 <xsl:for-each select="marc:datafield[@tag=866]">
924                     <xsl:call-template name="subfieldSelect">
925                         <xsl:with-param name="codes">az</xsl:with-param>
926                     </xsl:call-template>
927                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
928                 </xsl:for-each>
929             </span>
930         </xsl:if>
931
932         <!--  775 Other Edition  -->
933         <xsl:if test="marc:datafield[@tag=775]">
934         <span class="results_summary other_editions"><span class="label">Other editions: </span>
935         <xsl:for-each select="marc:datafield[@tag=775]">
936             <xsl:variable name="f775">
937                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
938                 <xsl:with-param name="codes">a_t</xsl:with-param>
939                 </xsl:call-template></xsl:with-param></xsl:call-template>
940             </xsl:variable>
941             <xsl:if test="marc:subfield[@code='i']">
942                 <xsl:call-template name="subfieldSelect">
943                     <xsl:with-param name="codes">i</xsl:with-param>
944                 </xsl:call-template>
945                 <xsl:text>: </xsl:text>
946             </xsl:if>
947             <a>
948             <xsl:choose>
949             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
950                 <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>
951             </xsl:when>
952             <xsl:otherwise>
953                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
954             </xsl:otherwise>
955             </xsl:choose>
956             <xsl:call-template name="subfieldSelect">
957                 <xsl:with-param name="codes">a_t</xsl:with-param>
958             </xsl:call-template>
959             </a>
960             <xsl:choose>
961                 <xsl:when test="position()=last()"></xsl:when>
962                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
963             </xsl:choose>
964         </xsl:for-each>
965         </span>
966         </xsl:if>
967
968         <!-- 780 -->
969         <xsl:if test="marc:datafield[@tag=780]">
970         <xsl:for-each select="marc:datafield[@tag=780]">
971         <xsl:if test="@ind1=0">
972         <span class="results_summary preceeding_entry">
973         <xsl:choose>
974         <xsl:when test="@ind2=0">
975             <span class="label">Continues:</span>
976         </xsl:when>
977         <xsl:when test="@ind2=1">
978             <span class="label">Continues in part:</span>
979         </xsl:when>
980         <xsl:when test="@ind2=2">
981             <span class="label">Supersedes:</span>
982         </xsl:when>
983         <xsl:when test="@ind2=3">
984             <span class="label">Supersedes in part:</span>
985         </xsl:when>
986         <xsl:when test="@ind2=4">
987             <span class="label">Formed by the union: ... and: ...</span>
988         </xsl:when>
989         <xsl:when test="@ind2=5">
990             <span class="label">Absorbed:</span>
991         </xsl:when>
992         <xsl:when test="@ind2=6">
993             <span class="label">Absorbed in part:</span>
994         </xsl:when>
995         <xsl:when test="@ind2=7">
996             <span class="label">Separated from:</span>
997         </xsl:when>
998         </xsl:choose>
999         <xsl:text> </xsl:text>
1000                 <xsl:variable name="f780">
1001                     <xsl:call-template name="subfieldSelect">
1002                         <xsl:with-param name="codes">a_t</xsl:with-param>
1003                     </xsl:call-template>
1004                 </xsl:variable>
1005             <xsl:choose>
1006                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1007                     <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>
1008                         <xsl:value-of select="translate($f780, '()', '')"/>
1009                     </a>
1010                 </xsl:when>
1011                 <xsl:otherwise>
1012                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
1013                         <xsl:value-of select="translate($f780, '()', '')"/>
1014                     </a>
1015                 </xsl:otherwise>
1016             </xsl:choose>
1017         </span>
1018
1019         <xsl:if test="marc:subfield[@code='n']">
1020             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1021         </xsl:if>
1022
1023         </xsl:if>
1024         </xsl:for-each>
1025         </xsl:if>
1026
1027         <!-- 785 -->
1028         <xsl:if test="marc:datafield[@tag=785]">
1029         <xsl:for-each select="marc:datafield[@tag=785]">
1030         <xsl:if test="@ind1=0">
1031         <span class="results_summary succeeding_entry">
1032         <xsl:choose>
1033         <xsl:when test="@ind2=0">
1034             <span class="label">Continued by:</span>
1035         </xsl:when>
1036         <xsl:when test="@ind2=1">
1037             <span class="label">Continued in part by:</span>
1038         </xsl:when>
1039         <xsl:when test="@ind2=2">
1040             <span class="label">Superseded by:</span>
1041         </xsl:when>
1042         <xsl:when test="@ind2=3">
1043             <span class="label">Superseded in part by:</span>
1044         </xsl:when>
1045         <xsl:when test="@ind2=4">
1046             <span class="label">Absorbed by:</span>
1047         </xsl:when>
1048         <xsl:when test="@ind2=5">
1049             <span class="label">Absorbed in part by:</span>
1050         </xsl:when>
1051         <xsl:when test="@ind2=6">
1052             <span class="label">Split into .. and ...:</span>
1053         </xsl:when>
1054         <xsl:when test="@ind2=7">
1055             <span class="label">Merged with ... to form ...</span>
1056         </xsl:when>
1057         <xsl:when test="@ind2=8">
1058             <span class="label">Changed back to:</span>
1059         </xsl:when>
1060         </xsl:choose>
1061         <xsl:text> </xsl:text>
1062                    <xsl:variable name="f785">
1063                     <xsl:call-template name="subfieldSelect">
1064                         <xsl:with-param name="codes">a_t</xsl:with-param>
1065                     </xsl:call-template>
1066                 </xsl:variable>
1067
1068             <xsl:choose>
1069                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1070                     <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>
1071                         <xsl:value-of select="translate($f785, '()', '')"/>
1072                     </a>
1073                 </xsl:when>
1074                 <xsl:otherwise>
1075                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
1076                         <xsl:value-of select="translate($f785, '()', '')"/>
1077                     </a>
1078                 </xsl:otherwise>
1079             </xsl:choose>
1080
1081         </span>
1082
1083         <xsl:if test="marc:subfield[@code='n']">
1084             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1085         </xsl:if>
1086
1087         </xsl:if>
1088         </xsl:for-each>
1089         </xsl:if>
1090
1091     </xsl:element>
1092     </xsl:template>
1093
1094     <xsl:template name="showAuthor">
1095         <xsl:param name="authorfield" />
1096         <xsl:param name="UseAuthoritiesForTracings" />
1097         <xsl:param name="materialTypeLabel" />
1098         <xsl:param name="theme" />
1099         <xsl:for-each select="$authorfield">
1100             <xsl:choose><xsl:when test="position()!=1"><xsl:text>; </xsl:text></xsl:when></xsl:choose>
1101             <xsl:choose>
1102                 <xsl:when test="not(@tag=111 or @tag=711)" />
1103                 <xsl:when test="marc:subfield[@code='n']">
1104                     <xsl:text> </xsl:text>
1105                     <xsl:call-template name="subfieldSelect">
1106                         <xsl:with-param name="codes">n</xsl:with-param>
1107                     </xsl:call-template>
1108                     <xsl:text> </xsl:text>
1109                 </xsl:when>
1110             </xsl:choose>
1111             <a>
1112                 <xsl:choose>
1113                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1114                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:"<xsl:value-of select="marc:subfield[@code=9]"/>"</xsl:attribute>
1115                     </xsl:when>
1116                     <xsl:otherwise>
1117                         <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
1118                     </xsl:otherwise>
1119                 </xsl:choose>
1120                 <span resource="#record"><span>
1121                     <xsl:choose>
1122                         <xsl:when test="substring(@tag, 1, 1)='1'">
1123                             <xsl:choose>
1124                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="property">byArtist</xsl:attribute></xsl:when>
1125                                 <xsl:otherwise><xsl:attribute name="property">author</xsl:attribute></xsl:otherwise>
1126                             </xsl:choose>
1127                         </xsl:when>
1128                         <xsl:otherwise><xsl:attribute name="property">contributor</xsl:attribute></xsl:otherwise>
1129                     </xsl:choose>
1130                     <xsl:choose>
1131                         <xsl:when test="substring(@tag, 2, 1)='0'">
1132                             <xsl:choose>
1133                                 <xsl:when test="$materialTypeLabel='Music'"><xsl:attribute name="typeof">MusicGroup</xsl:attribute></xsl:when>
1134                                 <xsl:otherwise><xsl:attribute name="typeof">Person</xsl:attribute></xsl:otherwise>
1135                             </xsl:choose>
1136                         </xsl:when>
1137                         <xsl:otherwise><xsl:attribute name="typeof">Organization</xsl:attribute></xsl:otherwise>
1138                     </xsl:choose>
1139                 <span property="name">
1140                 <xsl:choose>
1141                     <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCQ"/></xsl:when>
1142                     <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
1143                     <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
1144                 </xsl:choose>
1145                 </span></span></span>
1146                 <!-- add relator code too between brackets-->
1147                 <xsl:if test="marc:subfield[@code='4' or @code='e']">
1148                     <span class="relatorcode">
1149                     <xsl:text> [</xsl:text>
1150                     <xsl:choose>
1151                         <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
1152                         <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
1153                     </xsl:choose>
1154                     <xsl:text>]</xsl:text>
1155                     </span>
1156                 </xsl:if>
1157             </a>
1158             <xsl:if test="marc:subfield[@code=9]">
1159                 <a class='authlink'>
1160                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
1161                     <xsl:element name="img">
1162                         <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
1163                         <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
1164                         <xsl:attribute name="height">15</xsl:attribute>
1165                         <xsl:attribute name="width">15</xsl:attribute>
1166                     </xsl:element>
1167                 </a>
1168             </xsl:if>
1169         </xsl:for-each>
1170         <xsl:text>.</xsl:text>
1171     </xsl:template>
1172
1173     <xsl:template name="nameABCQ">
1174             <xsl:call-template name="chopPunctuation">
1175                 <xsl:with-param name="chopString">
1176                     <xsl:call-template name="subfieldSelect">
1177                         <xsl:with-param name="codes">abcq</xsl:with-param>
1178                     </xsl:call-template>
1179                 </xsl:with-param>
1180                 <xsl:with-param name="punctuation">
1181                     <xsl:text>:,;/ </xsl:text>
1182                 </xsl:with-param>
1183             </xsl:call-template>
1184     </xsl:template>
1185
1186     <xsl:template name="nameABCDN">
1187             <xsl:call-template name="chopPunctuation">
1188                 <xsl:with-param name="chopString">
1189                     <xsl:call-template name="subfieldSelect">
1190                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1191                     </xsl:call-template>
1192                 </xsl:with-param>
1193                 <xsl:with-param name="punctuation">
1194                     <xsl:text>:,;/ </xsl:text>
1195                 </xsl:with-param>
1196             </xsl:call-template>
1197     </xsl:template>
1198
1199     <xsl:template name="nameACDEQ">
1200             <xsl:call-template name="subfieldSelect">
1201                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1202             </xsl:call-template>
1203     </xsl:template>
1204
1205     <xsl:template name="part">
1206         <xsl:variable name="partNumber">
1207             <xsl:call-template name="specialSubfieldSelect">
1208                 <xsl:with-param name="axis">n</xsl:with-param>
1209                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1210                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1211             </xsl:call-template>
1212         </xsl:variable>
1213         <xsl:variable name="partName">
1214             <xsl:call-template name="specialSubfieldSelect">
1215                 <xsl:with-param name="axis">p</xsl:with-param>
1216                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1217                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1218             </xsl:call-template>
1219         </xsl:variable>
1220         <xsl:if test="string-length(normalize-space($partNumber))">
1221                 <xsl:call-template name="chopPunctuation">
1222                     <xsl:with-param name="chopString" select="$partNumber"/>
1223                 </xsl:call-template>
1224         </xsl:if>
1225         <xsl:if test="string-length(normalize-space($partName))">
1226                 <xsl:call-template name="chopPunctuation">
1227                     <xsl:with-param name="chopString" select="$partName"/>
1228                 </xsl:call-template>
1229         </xsl:if>
1230     </xsl:template>
1231
1232     <xsl:template name="specialSubfieldSelect">
1233         <xsl:param name="anyCodes"/>
1234         <xsl:param name="axis"/>
1235         <xsl:param name="beforeCodes"/>
1236         <xsl:param name="afterCodes"/>
1237         <xsl:variable name="str">
1238             <xsl:for-each select="marc:subfield">
1239                 <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])">
1240                     <xsl:value-of select="text()"/>
1241                     <xsl:text> </xsl:text>
1242                 </xsl:if>
1243             </xsl:for-each>
1244         </xsl:variable>
1245         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1246     </xsl:template>
1247
1248     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1249     <xsl:template name="subfieldSelectSubject">
1250         <xsl:param name="codes"/>
1251         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1252         <xsl:param name="subdivCodes"/>
1253         <xsl:param name="subdivDelimiter"/>
1254         <xsl:param name="prefix"/>
1255         <xsl:param name="suffix"/>
1256         <xsl:variable name="str">
1257             <xsl:for-each select="marc:subfield">
1258                 <xsl:if test="contains($codes, @code)">
1259                     <xsl:if test="contains($subdivCodes, @code)">
1260                         <xsl:value-of select="$subdivDelimiter"/>
1261                     </xsl:if>
1262                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1263                 </xsl:if>
1264             </xsl:for-each>
1265         </xsl:variable>
1266         <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1267     </xsl:template>
1268 </xsl:stylesheet>