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