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