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