Bug 10793: XSLT change 780/785 search queries to use ti,phr indexes like other linkin...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
6 <xsl:stylesheet version="1.0"
7   xmlns:marc="http://www.loc.gov/MARC21/slim"
8   xmlns:items="http://www.koha-community.org/items"
9   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10   exclude-result-prefixes="marc items">
11     <xsl:import href="MARC21slimUtils.xsl"/>
12     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
13     <xsl:template match="/">
14             <xsl:apply-templates/>
15     </xsl:template>
16
17     <xsl:template match="marc:record">
18
19         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
20         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
21         <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
22         <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
23         <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
24         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
25         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
26         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
27         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
28         <xsl:variable name="TracingQuotesLeft">
29            <xsl:choose>
30              <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
31              <xsl:otherwise>"</xsl:otherwise>
32            </xsl:choose>
33         </xsl:variable>
34         <xsl:variable name="TracingQuotesRight">
35           <xsl:choose>
36             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
37             <xsl:otherwise>"</xsl:otherwise>
38           </xsl:choose>
39         </xsl:variable>
40         <xsl:variable name="leader" select="marc:leader"/>
41         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
42         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
43         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
44         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
45         <xsl:variable name="materialTypeCode">
46             <xsl:choose>
47                 <xsl:when test="$leader19='a'">ST</xsl:when>
48                 <xsl:when test="$leader6='a'">
49                     <xsl:choose>
50                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
51                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
52                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
53                     </xsl:choose>
54                 </xsl:when>
55                 <xsl:when test="$leader6='t'">BK</xsl:when>
56                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
57                 <xsl:when test="$leader6='m'">CF</xsl:when>
58                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
59                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
60                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
61                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
62             </xsl:choose>
63         </xsl:variable>
64         <xsl:variable name="materialTypeLabel">
65             <xsl:choose>
66                 <xsl:when test="$leader19='a'">Set</xsl:when>
67                 <xsl:when test="$leader6='a'">
68                     <xsl:choose>
69                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
70                         <xsl:when test="$leader7='i' or $leader7='s'">
71                             <xsl:choose>
72                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
73                                 <xsl:otherwise>Series</xsl:otherwise>
74                             </xsl:choose>
75                         </xsl:when>
76                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
77                     </xsl:choose>
78                 </xsl:when>
79                 <xsl:when test="$leader6='t'">Book</xsl:when>
80                 <xsl:when test="$leader6='o'">Kit</xsl:when>                            
81                 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
82                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
83                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
84                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual Material</xsl:when>
85                 <xsl:when test="$leader6='j'">Music</xsl:when>
86                 <xsl:when test="$leader6='i'">Sound</xsl:when>
87                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
88             </xsl:choose>
89         </xsl:variable>
90
91         <!-- Title Statement -->
92         <!-- Alternate Graphic Representation (MARC 880) -->
93         <xsl:if test="$display880">
94             <h1 class="title">
95                 <xsl:call-template name="m880Select">
96                     <xsl:with-param name="basetags">245</xsl:with-param>
97                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
98                 </xsl:call-template>
99             </h1>
100         </xsl:if>
101
102         <xsl:if test="marc:datafield[@tag=245]">
103         <h1>
104             <xsl:for-each select="marc:datafield[@tag=245]">
105                     <xsl:call-template name="subfieldSelect">
106                         <xsl:with-param name="codes">a</xsl:with-param>
107                     </xsl:call-template>
108                     <xsl:if test="marc:subfield[@code='h']">
109                         <xsl:text> </xsl:text>
110                         <xsl:call-template name="subfieldSelect">
111                             <xsl:with-param name="codes">h</xsl:with-param>
112                         </xsl:call-template>
113                     </xsl:if>
114                     <xsl:if test="marc:subfield[@code='b']">
115                         <xsl:text> </xsl:text>
116                         <xsl:call-template name="subfieldSelect">
117                             <xsl:with-param name="codes">b</xsl:with-param>
118                         </xsl:call-template>
119                     </xsl:if>
120                     <xsl:text> </xsl:text>
121                     <xsl:call-template name="subfieldSelect">
122                         <xsl:with-param name="codes">fgknps</xsl:with-param>
123                     </xsl:call-template>
124             </xsl:for-each>
125         </h1>
126         </xsl:if>
127
128         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
129         <xsl:if test="$display880">
130             <h5 class="author">
131                 <xsl:call-template name="m880Select">
132                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
133                     <xsl:with-param name="codes">abc</xsl:with-param>
134                     <xsl:with-param name="index">au</xsl:with-param>
135                     <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
136                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
137                 </xsl:call-template>
138             </h5>
139         </xsl:if>
140
141         <!-- Author Statement -->
142         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
143         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
144
145    <xsl:if test="$materialTypeCode!=''">
146         <span class="results_summary type"><span class="label">Type: </span>
147         <xsl:element name="img"><xsl:attribute name="src">/intranet-tmpl/prog/img/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
148         <xsl:text> </xsl:text>
149         <xsl:value-of select="$materialTypeLabel"/>
150         </span>
151    </xsl:if>
152
153         <!--Series: Alternate Graphic Representation (MARC 880) -->
154         <xsl:if test="$display880">
155             <xsl:call-template name="m880Select">
156                 <xsl:with-param name="basetags">440,490</xsl:with-param>
157                 <xsl:with-param name="codes">av</xsl:with-param>
158                 <xsl:with-param name="class">results_summary series</xsl:with-param>
159                 <xsl:with-param name="label">Series: </xsl:with-param>
160                 <xsl:with-param name="index">se</xsl:with-param>
161             </xsl:call-template>
162         </xsl:if>
163         
164         <!-- Series -->
165         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
166         <span class="results_summary series"><span class="label">Series: </span>
167         <!-- 440 -->
168         <xsl:for-each select="marc:datafield[@tag=440]">
169             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
170             <xsl:call-template name="chopPunctuation">
171                             <xsl:with-param name="chopString">
172                                 <xsl:call-template name="subfieldSelect">
173                                     <xsl:with-param name="codes">av</xsl:with-param>
174                                 </xsl:call-template>
175                             </xsl:with-param>
176                         </xsl:call-template>
177             </a>
178             <xsl:call-template name="part"/>
179             <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
180         </xsl:for-each>
181
182         <!-- 490 Series not traced, Ind1 = 0 -->
183         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
184             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
185                         <xsl:call-template name="chopPunctuation">
186                             <xsl:with-param name="chopString">
187                                 <xsl:call-template name="subfieldSelect">
188                                     <xsl:with-param name="codes">av</xsl:with-param>
189                                 </xsl:call-template>
190                             </xsl:with-param>
191                         </xsl:call-template>
192             </a>
193                     <xsl:call-template name="part"/>
194         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
195         </xsl:for-each>
196         <!-- 490 Series traced, Ind1 = 1 -->
197         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
198             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
199                 <xsl:choose>
200                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
201                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
202                             <xsl:call-template name="chopPunctuation">
203                                 <xsl:with-param name="chopString">
204                                     <xsl:call-template name="subfieldSelect">
205                                         <xsl:with-param name="codes">a_t</xsl:with-param>
206                                     </xsl:call-template>
207                                 </xsl:with-param>
208                             </xsl:call-template>
209                         </a>
210                     </xsl:when>
211                     <xsl:otherwise>
212                         <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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">a_t</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:otherwise>
223                 </xsl:choose>
224                 <xsl:text>: </xsl:text>
225                 <xsl:value-of  select="marc:subfield[@code='v']" />
226             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
227             </xsl:for-each>
228         </xsl:if>
229
230         </span>
231         </xsl:if>
232
233         <!-- Analytics -->
234         <xsl:if test="$leader7='s'">
235         <span class="results_summary analytics"><span class="label">Analytics: </span>
236             <a>
237             <xsl:choose>
238             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
239                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
240             </xsl:when>
241             <xsl:otherwise>
242                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
243             </xsl:otherwise>
244             </xsl:choose>
245             <xsl:text>Show analytics</xsl:text>
246             </a>
247         </span>
248         </xsl:if>
249
250         <!-- Volumes of sets and traced series -->
251         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
252         <span class="results_summary volumes"><span class="label">Volumes: </span>
253             <a>
254             <xsl:choose>
255             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
256                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute>
257             </xsl:when>
258             <xsl:otherwise>
259                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
260             </xsl:otherwise>
261             </xsl:choose>
262             <xsl:text>Show volumes</xsl:text>
263             </a>
264         </span>
265         </xsl:if>
266
267         <!-- Set -->
268         <xsl:if test="$leader19='c'">
269         <span class="results_summary set"><span class="label">Set: </span>
270         <xsl:for-each select="marc:datafield[@tag=773]">
271             <a>
272             <xsl:choose>
273             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
274                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
275             </xsl:when>
276             <xsl:otherwise>
277                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
278             </xsl:otherwise>
279             </xsl:choose>
280             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
281             </a>
282             <xsl:choose>
283                 <xsl:when test="position()=last()"></xsl:when>
284                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
285             </xsl:choose>
286         </xsl:for-each>
287         </span>
288         </xsl:if>
289
290         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
291         <xsl:if test="$display880">
292             <xsl:call-template name="m880Select">
293                 <xsl:with-param name="basetags">260</xsl:with-param>
294                 <xsl:with-param name="codes">abcg</xsl:with-param>
295                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
296                 <xsl:with-param name="label">Publisher: </xsl:with-param>
297             </xsl:call-template>
298         </xsl:if>
299
300         <xsl:if test="marc:datafield[@tag=260]">
301         <span class="results_summary publisher"><span class="label">Publisher: </span>
302             <xsl:for-each select="marc:datafield[@tag=260]">
303                 <xsl:if test="marc:subfield[@code='a']">
304                     <xsl:call-template name="subfieldSelect">
305                         <xsl:with-param name="codes">a</xsl:with-param>
306                     </xsl:call-template>
307                 </xsl:if>
308                 <xsl:text> </xsl:text>
309                 <xsl:if test="marc:subfield[@code='b']">
310                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
311                     <xsl:call-template name="subfieldSelect">
312                         <xsl:with-param name="codes">b</xsl:with-param>
313                     </xsl:call-template>
314                </a>
315                </xsl:if>
316                <xsl:text> </xsl:text>
317                 <xsl:call-template name="chopPunctuation">
318                   <xsl:with-param name="chopString">
319                     <xsl:call-template name="subfieldSelect">
320                         <xsl:with-param name="codes">cg</xsl:with-param>
321                     </xsl:call-template>
322                    </xsl:with-param>
323                </xsl:call-template>
324                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
325             </xsl:for-each>
326         </span>
327         </xsl:if>
328
329         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
330         <xsl:if test="$display880">
331             <xsl:call-template name="m880Select">
332                 <xsl:with-param name="basetags">250</xsl:with-param>
333                 <xsl:with-param name="codes">ab</xsl:with-param>
334                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
335                 <xsl:with-param name="label">Edition: </xsl:with-param>
336             </xsl:call-template>
337         </xsl:if>
338         
339         <xsl:if test="marc:datafield[@tag=250]">
340         <span class="results_summary edition"><span class="label">Edition: </span>
341             <xsl:for-each select="marc:datafield[@tag=250]">
342                 <xsl:call-template name="chopPunctuation">
343                   <xsl:with-param name="chopString">
344                     <xsl:call-template name="subfieldSelect">
345                         <xsl:with-param name="codes">ab</xsl:with-param>
346                     </xsl:call-template>
347                    </xsl:with-param>
348                </xsl:call-template>
349                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
350             </xsl:for-each>
351         </span>
352         </xsl:if>
353
354         <!-- Description: Alternate Graphic Representation (MARC 880) -->
355         <xsl:if test="$display880">
356             <xsl:call-template name="m880Select">
357                 <xsl:with-param name="basetags">300</xsl:with-param>
358                 <xsl:with-param name="codes">abceg</xsl:with-param>
359                 <xsl:with-param name="class">results_summary description</xsl:with-param>
360                 <xsl:with-param name="label">Description: </xsl:with-param>
361             </xsl:call-template>
362         </xsl:if>
363         
364         <xsl:if test="marc:datafield[@tag=300]">
365         <span class="results_summary description"><span class="label">Description: </span>
366             <xsl:for-each select="marc:datafield[@tag=300]">
367                 <xsl:call-template name="chopPunctuation">
368                   <xsl:with-param name="chopString">
369                     <xsl:call-template name="subfieldSelect">
370                         <xsl:with-param name="codes">abceg</xsl:with-param>
371                     </xsl:call-template>
372                    </xsl:with-param>
373                </xsl:call-template>
374                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
375             </xsl:for-each>
376         </span>
377        </xsl:if>
378
379        <xsl:if test="marc:datafield[@tag=020]">
380         <span class="results_summary isbn"><span class="label">ISBN: </span>
381         <xsl:for-each select="marc:datafield[@tag=020]">
382         <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
383                 <xsl:value-of select="marc:subfield[@code='a']"/>
384                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
385         </xsl:for-each>
386         </span>
387         </xsl:if>
388
389         <xsl:if test="marc:datafield[@tag=022]">
390         <span class="results_summary issn"><span class="label">ISSN: </span>
391         <xsl:for-each select="marc:datafield[@tag=022]">
392                 <xsl:value-of select="marc:subfield[@code='a']"/>
393                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
394         </xsl:for-each>
395         </span>
396         </xsl:if>
397
398         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
399         <xsl:if test="$display880">
400             <xsl:call-template name="m880Select">
401                 <xsl:with-param name="basetags">246</xsl:with-param>
402                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
403                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
404                 <xsl:with-param name="label">Other Title: </xsl:with-param>
405             </xsl:call-template>
406         </xsl:if>
407
408         <xsl:if test="marc:datafield[@tag=246]">
409         <span class="results_summary other_title"><span class="label">Other Title: </span>
410             <xsl:for-each select="marc:datafield[@tag=246]">
411                 <xsl:call-template name="chopPunctuation">
412                   <xsl:with-param name="chopString">
413                     <xsl:call-template name="subfieldSelect">
414                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
415                     </xsl:call-template>
416                    </xsl:with-param>
417                </xsl:call-template>
418                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
419             </xsl:for-each>
420         </span>
421        </xsl:if>
422
423         <xsl:if test="marc:datafield[@tag=242]">
424         <span class="results_summary translated_title"><span class="label">Title translated: </span>
425             <xsl:for-each select="marc:datafield[@tag=242]">
426                 <xsl:call-template name="chopPunctuation">
427                   <xsl:with-param name="chopString">
428                     <xsl:call-template name="subfieldSelect">
429                         <xsl:with-param name="codes">abchnp</xsl:with-param>
430                     </xsl:call-template>
431                    </xsl:with-param>
432                </xsl:call-template>
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         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
439         <xsl:if test="$display880">
440             <xsl:call-template name="m880Select">
441                 <xsl:with-param name="basetags">130,240</xsl:with-param>
442                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
443                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
444                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
445             </xsl:call-template>
446         </xsl:if>
447
448         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
449         <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
450         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
451             <xsl:variable name="str">
452                 <xsl:for-each select="marc:subfield">
453                     <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'])))">
454                         <xsl:value-of select="text()"/>
455                         <xsl:text> </xsl:text>
456                      </xsl:if>
457                 </xsl:for-each>
458             </xsl:variable>
459             <xsl:call-template name="chopPunctuation">
460                 <xsl:with-param name="chopString">
461                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
462                         
463                 </xsl:with-param>
464             </xsl:call-template>
465             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
466         </xsl:for-each>
467         </span>
468         </xsl:if>
469
470         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
471             <span class="results_summary subjects"><span class="label">Subject(s): </span>
472             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
473             <a>
474             <xsl:choose>
475             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
476                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
477             </xsl:when>
478             <xsl:when test="$TraceSubjectSubdivisions='1'">
479                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
480                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
481                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
482                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
483                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
484                     </xsl:call-template>
485                 </xsl:attribute>
486             </xsl:when>
487             <xsl:otherwise>
488                <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
489             </xsl:otherwise>
490             </xsl:choose>
491             <xsl:call-template name="chopPunctuation">
492                 <xsl:with-param name="chopString">
493                     <xsl:call-template name="subfieldSelect">
494                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
495                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
496                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
497                     </xsl:call-template>
498                 </xsl:with-param>
499             </xsl:call-template>
500             </a>
501             <xsl:choose>
502             <xsl:when test="position()=last()"></xsl:when>
503             <xsl:otherwise> | </xsl:otherwise>
504             </xsl:choose>
505
506             </xsl:for-each>
507             </span>
508         </xsl:if>
509
510         <xsl:if test="marc:datafield[@tag=856]">
511         <span class="results_summary online_resources"><span class="label">Online Resources: </span>
512         <xsl:for-each select="marc:datafield[@tag=856]">
513                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
514                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
515                                     <xsl:choose>
516                                     <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')">
517                                         <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>
518                                     </xsl:when>
519                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
520                                         <xsl:call-template name="subfieldSelect">
521                                         <xsl:with-param name="codes">y3z</xsl:with-param>
522                                         </xsl:call-template>
523                                     </xsl:when>
524                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
525                                         <xsl:choose>
526                                         <xsl:when test="$URLLinkText!=''">
527                                                 <xsl:value-of select="$URLLinkText"/>
528                                         </xsl:when>
529                                         <xsl:otherwise>
530                                                 <xsl:text>Click here to access online</xsl:text>
531                                         </xsl:otherwise>
532                                         </xsl:choose>
533                                     </xsl:when>
534                                     </xsl:choose>
535                                     </a>
536                                     <xsl:choose>
537                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
538                                     <xsl:otherwise> | </xsl:otherwise>
539                                     </xsl:choose>
540
541         </xsl:for-each>
542         </span>
543         </xsl:if>
544         <xsl:if test="marc:datafield[@tag=505]">
545             <div class="results_summary contents">
546             <xsl:choose>
547             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
548                 <span class="label">Contents:</span>
549             </xsl:when>
550             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
551                 <span class="label">Incomplete contents:</span>
552             </xsl:when>
553             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
554                 <span class="label">Partial contents:</span>
555             </xsl:when>
556             </xsl:choose>
557                 <xsl:for-each select="marc:datafield[@tag=505]">
558                     <div class='contentblock'>
559                         <xsl:choose>
560                         <xsl:when test="@ind2=0">
561                             <xsl:call-template name="subfieldSelectSpan">
562                                 <xsl:with-param name="codes">tru</xsl:with-param>
563                             </xsl:call-template>
564                         </xsl:when>
565                         <xsl:otherwise>
566                             <xsl:call-template name="subfieldSelectSpan">
567                                 <xsl:with-param name="codes">atru</xsl:with-param>
568                             </xsl:call-template>
569                         </xsl:otherwise>
570                         </xsl:choose>
571                     </div>
572                 </xsl:for-each>
573             </div>
574         </xsl:if>
575
576         <!-- 773 -->
577         <xsl:if test="marc:datafield[@tag=773]">
578         <xsl:for-each select="marc:datafield[@tag=773]">
579         <xsl:if test="@ind1=0">
580         <span class="results_summary in"><span class="label">
581         <xsl:choose>
582         <xsl:when test="@ind2=' '">
583             In:
584         </xsl:when>
585         <xsl:when test="@ind2=8">
586             <xsl:if test="marc:subfield[@code='i']">
587                 <xsl:value-of select="marc:subfield[@code='i']"/>
588             </xsl:if>
589         </xsl:when>
590         </xsl:choose>
591         </span>
592                 <xsl:variable name="f773">
593                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
594                         <xsl:with-param name="codes">a_t</xsl:with-param>
595                     </xsl:call-template></xsl:with-param></xsl:call-template>
596                 </xsl:variable>
597             <xsl:choose>
598                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
599                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
600                         <xsl:value-of select="translate($f773, '()', '')"/>
601                     </a>
602                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
603                 </xsl:when>
604                 <xsl:when test="marc:subfield[@code='0']">
605                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
606                         <xsl:value-of select="$f773"/>
607                     </a>
608                 </xsl:when>
609                 <xsl:otherwise>
610                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
611                         <xsl:value-of select="$f773"/>
612                     </a>
613                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
614                 </xsl:otherwise>
615             </xsl:choose>
616         </span>
617
618         <xsl:if test="marc:subfield[@code='n']">
619             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
620         </xsl:if>
621
622         </xsl:if>
623         </xsl:for-each>
624         </xsl:if>
625
626         <!-- 866 textual holdings -->
627         <xsl:if test="marc:datafield[@tag=866]">
628             <span class="results_summary holdings_note"><span class="label">Holdings Note: </span>
629                 <xsl:for-each select="marc:datafield[@tag=866]">
630                     <xsl:call-template name="subfieldSelect">
631                         <xsl:with-param name="codes">axz</xsl:with-param>
632                     </xsl:call-template>
633                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
634                 </xsl:for-each>
635             </span>
636         </xsl:if>
637
638         <!--  775 Other Edition  -->
639         <xsl:if test="marc:datafield[@tag=775]">
640         <span class="results_summary other_editions"><span class="label">Other Editions: </span>
641         <xsl:for-each select="marc:datafield[@tag=775]">
642             <xsl:variable name="f775">
643                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
644                 <xsl:with-param name="codes">a_t</xsl:with-param>
645                 </xsl:call-template></xsl:with-param></xsl:call-template>
646             </xsl:variable>
647             <xsl:if test="marc:subfield[@code='i']">
648                 <xsl:call-template name="subfieldSelect">
649                     <xsl:with-param name="codes">i</xsl:with-param>
650                 </xsl:call-template>
651                 <xsl:text>: </xsl:text>
652             </xsl:if>
653             <a>
654             <xsl:choose>
655             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
656                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
657             </xsl:when>
658             <xsl:otherwise>
659                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
660             </xsl:otherwise>
661             </xsl:choose>
662             <xsl:call-template name="subfieldSelect">
663                 <xsl:with-param name="codes">a_t</xsl:with-param>
664             </xsl:call-template>
665             </a>
666             <xsl:choose>
667                 <xsl:when test="position()=last()"></xsl:when>
668                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
669             </xsl:choose>
670         </xsl:for-each>
671         </span>
672         </xsl:if>
673
674         <!-- 780 -->
675         <xsl:if test="marc:datafield[@tag=780]">
676         <xsl:for-each select="marc:datafield[@tag=780]">
677         <xsl:if test="@ind1=0">
678         <span class="results_summary preceeding_entry">
679         <xsl:choose>
680         <xsl:when test="@ind2=0">
681             <span class="label">Continues:</span>
682         </xsl:when>
683         <xsl:when test="@ind2=1">
684             <span class="label">Continues in part:</span>
685         </xsl:when>
686         <xsl:when test="@ind2=2">
687             <span class="label">Supersedes:</span>
688         </xsl:when>
689         <xsl:when test="@ind2=3">
690             <span class="label">Supersedes in part:</span>
691         </xsl:when>
692         <xsl:when test="@ind2=4">
693             <span class="label">Formed by the union: ... and: ...</span>
694         </xsl:when>
695         <xsl:when test="@ind2=5">
696             <span class="label">Absorbed:</span>
697         </xsl:when>
698         <xsl:when test="@ind2=6">
699             <span class="label">Absorbed in part:</span>
700         </xsl:when>
701         <xsl:when test="@ind2=7">
702             <span class="label">Separated from:</span>
703         </xsl:when>
704         </xsl:choose>
705         <xsl:text> </xsl:text>
706                 <xsl:variable name="f780">
707                     <xsl:call-template name="subfieldSelect">
708                         <xsl:with-param name="codes">a_t</xsl:with-param>
709                     </xsl:call-template>
710                 </xsl:variable>
711             <xsl:choose>
712                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
713                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
714                         <xsl:value-of select="translate($f780, '()', '')"/>
715                     </a>
716                 </xsl:when>
717                 <xsl:otherwise>
718                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
719                         <xsl:value-of select="translate($f780, '()', '')"/>
720                     </a>
721                 </xsl:otherwise>
722             </xsl:choose>
723         </span>
724  
725         <xsl:if test="marc:subfield[@code='n']">
726             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
727         </xsl:if>
728
729         </xsl:if>
730         </xsl:for-each>
731         </xsl:if>
732
733         <!-- 785 -->
734         <xsl:if test="marc:datafield[@tag=785]">
735         <xsl:for-each select="marc:datafield[@tag=785]">
736         <span class="results_summary succeeding_entry">
737         <xsl:choose>
738         <xsl:when test="@ind2=0">
739             <span class="label">Continued by:</span>
740         </xsl:when>
741         <xsl:when test="@ind2=1">
742             <span class="label">Continued in part by:</span>
743         </xsl:when>
744         <xsl:when test="@ind2=2">
745             <span class="label">Superseded by:</span>
746         </xsl:when>
747         <xsl:when test="@ind2=3">
748             <span class="label">Superseded in part by:</span>
749         </xsl:when>
750         <xsl:when test="@ind2=4">
751             <span class="label">Absorbed by:</span>
752         </xsl:when>
753         <xsl:when test="@ind2=5">
754             <span class="label">Absorbed in part by:</span>
755         </xsl:when>
756         <xsl:when test="@ind2=6">
757             <span class="label">Split into .. and ...:</span>
758         </xsl:when>
759         <xsl:when test="@ind2=7">
760             <span class="label">Merged with ... to form ...</span>
761         </xsl:when>
762         <xsl:when test="@ind2=8">
763             <span class="label">Changed back to:</span>
764         </xsl:when>
765         </xsl:choose>
766         <xsl:text> </xsl:text>
767                    <xsl:variable name="f785">
768                     <xsl:call-template name="subfieldSelect">
769                         <xsl:with-param name="codes">a_t</xsl:with-param>
770                     </xsl:call-template>
771                 </xsl:variable>
772
773             <xsl:choose>
774                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
775                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
776                         <xsl:value-of select="translate($f785, '()', '')"/>
777                     </a>
778                 </xsl:when>
779                 <xsl:otherwise>
780                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
781                         <xsl:value-of select="translate($f785, '()', '')"/>
782                     </a>
783                 </xsl:otherwise>
784             </xsl:choose>
785
786         </span>
787         </xsl:for-each>
788         </xsl:if>
789
790         <xsl:if test="$OPACBaseURL!=''">
791         <span class="results_summary"><span class="label">OPAC view: </span>
792             <a><xsl:attribute name="href">http://<xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
793         </span>
794         </xsl:if>
795
796     </xsl:template>
797
798     <xsl:template name="nameABCQ">
799             <xsl:call-template name="chopPunctuation">
800                 <xsl:with-param name="chopString">
801                     <xsl:call-template name="subfieldSelect">
802                         <xsl:with-param name="codes">abcq</xsl:with-param>
803                     </xsl:call-template>
804                 </xsl:with-param>
805                 <xsl:with-param name="punctuation">
806                     <xsl:text>:,;/ </xsl:text>
807                 </xsl:with-param>
808             </xsl:call-template>
809     </xsl:template>
810
811     <xsl:template name="nameABCDN">
812         <xsl:for-each select="marc:subfield[@code='a']">
813                 <xsl:call-template name="chopPunctuation">
814                     <xsl:with-param name="chopString" select="."/>
815                 </xsl:call-template>
816         </xsl:for-each>
817         <xsl:for-each select="marc:subfield[@code='b']">
818             <xsl:value-of select="."/>
819             <xsl:choose>
820                 <xsl:when test="position() != last()">
821                     <xsl:text> -- </xsl:text>
822                 </xsl:when>
823             </xsl:choose>
824         </xsl:for-each>
825         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
826                 <xsl:call-template name="subfieldSelect">
827                     <xsl:with-param name="codes">cdn</xsl:with-param>
828                 </xsl:call-template>
829         </xsl:if>
830     </xsl:template>
831
832     <xsl:template name="nameACDEQ">
833             <xsl:call-template name="subfieldSelect">
834                 <xsl:with-param name="codes">acdeq</xsl:with-param>
835             </xsl:call-template>
836     </xsl:template>
837
838     <xsl:template name="part">
839         <xsl:variable name="partNumber">
840             <xsl:call-template name="specialSubfieldSelect">
841                 <xsl:with-param name="axis">n</xsl:with-param>
842                 <xsl:with-param name="anyCodes">n</xsl:with-param>
843                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
844             </xsl:call-template>
845         </xsl:variable>
846         <xsl:variable name="partName">
847             <xsl:call-template name="specialSubfieldSelect">
848                 <xsl:with-param name="axis">p</xsl:with-param>
849                 <xsl:with-param name="anyCodes">p</xsl:with-param>
850                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
851             </xsl:call-template>
852         </xsl:variable>
853         <xsl:if test="string-length(normalize-space($partNumber))">
854                 <xsl:call-template name="chopPunctuation">
855                     <xsl:with-param name="chopString" select="$partNumber"/>
856                 </xsl:call-template>
857         </xsl:if>
858         <xsl:if test="string-length(normalize-space($partName))">
859                 <xsl:call-template name="chopPunctuation">
860                     <xsl:with-param name="chopString" select="$partName"/>
861                 </xsl:call-template>
862         </xsl:if>
863     </xsl:template>
864
865     <xsl:template name="specialSubfieldSelect">
866         <xsl:param name="anyCodes"/>
867         <xsl:param name="axis"/>
868         <xsl:param name="beforeCodes"/>
869         <xsl:param name="afterCodes"/>
870         <xsl:variable name="str">
871             <xsl:for-each select="marc:subfield">
872                 <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])">
873                     <xsl:value-of select="text()"/>
874                     <xsl:text> </xsl:text>
875                 </xsl:if>
876             </xsl:for-each>
877         </xsl:variable>
878         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
879     </xsl:template>
880
881     <xsl:template name="showAuthor">
882         <xsl:param name="authorfield"/>
883     <xsl:param name="UseAuthoritiesForTracings"/>
884         <xsl:if test="count($authorfield)&gt;0">
885         <h5 class="author">
886         <xsl:for-each select="$authorfield">
887         <xsl:choose>
888           <xsl:when test="position()&gt;1"/>
889           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
890           <xsl:otherwise>Additional author(s): </xsl:otherwise>
891         </xsl:choose>
892         <a>
893         <xsl:choose>
894             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
895                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
896             </xsl:when>
897             <xsl:otherwise>
898             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
899             </xsl:otherwise>
900         </xsl:choose>
901         <xsl:choose>
902           <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCQ"/></xsl:when>
903           <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
904           <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
905         </xsl:choose>
906         <!-- add relator code too between brackets-->
907         <xsl:if test="marc:subfield[@code='4' or @code='e']">
908       <span class="relatorcode">
909       <xsl:text> [</xsl:text>
910           <xsl:choose>
911             <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
912             <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
913           </xsl:choose>
914           <xsl:text>]</xsl:text>
915       </span>
916         </xsl:if>
917         </a>
918         <xsl:choose>
919           <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
920         </xsl:choose>
921         </xsl:for-each>
922         </h5>
923         </xsl:if>
924     </xsl:template>
925
926 </xsl:stylesheet>