Bug 9363: Show Patent control information and report number (MARC21, XSLT, detail...
[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         <xsl:if test="marc:datafield[@tag=013]">
399             <span class="results_summary patent_info">
400                 <span class="label">Patent information: </span>
401                 <xsl:for-each select="marc:datafield[@tag=013]">
402                     <xsl:call-template name="subfieldSelect">
403                         <xsl:with-param name="codes">acdef</xsl:with-param>
404                         <xsl:with-param name="delimeter">, </xsl:with-param>
405                     </xsl:call-template>
406                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
407                 </xsl:for-each>
408             </span>
409         </xsl:if>
410
411         <xsl:if test="marc:datafield[@tag=088]">
412             <span class="results_summary report_number">
413                 <span class="label">Report number: </span>
414                 <xsl:for-each select="marc:datafield[@tag=088]">
415                     <xsl:call-template name="subfieldSelect">
416                         <xsl:with-param name="codes">a</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         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
424         <xsl:if test="$display880">
425             <xsl:call-template name="m880Select">
426                 <xsl:with-param name="basetags">246</xsl:with-param>
427                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
428                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
429                 <xsl:with-param name="label">Other Title: </xsl:with-param>
430             </xsl:call-template>
431         </xsl:if>
432
433         <xsl:if test="marc:datafield[@tag=246]">
434         <span class="results_summary other_title"><span class="label">Other Title: </span>
435             <xsl:for-each select="marc:datafield[@tag=246]">
436                 <xsl:call-template name="chopPunctuation">
437                   <xsl:with-param name="chopString">
438                     <xsl:call-template name="subfieldSelect">
439                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
440                     </xsl:call-template>
441                    </xsl:with-param>
442                </xsl:call-template>
443                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
444             </xsl:for-each>
445         </span>
446        </xsl:if>
447
448         <xsl:if test="marc:datafield[@tag=242]">
449         <span class="results_summary translated_title"><span class="label">Title translated: </span>
450             <xsl:for-each select="marc:datafield[@tag=242]">
451                 <xsl:call-template name="chopPunctuation">
452                   <xsl:with-param name="chopString">
453                     <xsl:call-template name="subfieldSelect">
454                         <xsl:with-param name="codes">abchnp</xsl:with-param>
455                     </xsl:call-template>
456                    </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         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
464         <xsl:if test="$display880">
465             <xsl:call-template name="m880Select">
466                 <xsl:with-param name="basetags">130,240</xsl:with-param>
467                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
468                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
469                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
470             </xsl:call-template>
471         </xsl:if>
472
473         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
474         <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
475         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
476             <xsl:variable name="str">
477                 <xsl:for-each select="marc:subfield">
478                     <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'])))">
479                         <xsl:value-of select="text()"/>
480                         <xsl:text> </xsl:text>
481                      </xsl:if>
482                 </xsl:for-each>
483             </xsl:variable>
484             <xsl:call-template name="chopPunctuation">
485                 <xsl:with-param name="chopString">
486                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
487                         
488                 </xsl:with-param>
489             </xsl:call-template>
490             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
491         </xsl:for-each>
492         </span>
493         </xsl:if>
494
495         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
496             <span class="results_summary subjects"><span class="label">Subject(s): </span>
497             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
498             <a>
499             <xsl:choose>
500             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
501                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
502             </xsl:when>
503             <xsl:when test="$TraceSubjectSubdivisions='1'">
504                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
505                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
506                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
507                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
508                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
509                     </xsl:call-template>
510                 </xsl:attribute>
511             </xsl:when>
512             <xsl:otherwise>
513                <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>
514             </xsl:otherwise>
515             </xsl:choose>
516             <xsl:call-template name="chopPunctuation">
517                 <xsl:with-param name="chopString">
518                     <xsl:call-template name="subfieldSelect">
519                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
520                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
521                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
522                     </xsl:call-template>
523                 </xsl:with-param>
524             </xsl:call-template>
525             </a>
526             <xsl:choose>
527             <xsl:when test="position()=last()"></xsl:when>
528             <xsl:otherwise> | </xsl:otherwise>
529             </xsl:choose>
530
531             </xsl:for-each>
532             </span>
533         </xsl:if>
534
535         <xsl:if test="marc:datafield[@tag=856]">
536         <span class="results_summary online_resources"><span class="label">Online Resources: </span>
537         <xsl:for-each select="marc:datafield[@tag=856]">
538                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
539                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
540                                     <xsl:choose>
541                                     <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')">
542                                         <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>
543                                     </xsl:when>
544                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
545                                         <xsl:call-template name="subfieldSelect">
546                                         <xsl:with-param name="codes">y3z</xsl:with-param>
547                                         </xsl:call-template>
548                                     </xsl:when>
549                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
550                                         <xsl:choose>
551                                         <xsl:when test="$URLLinkText!=''">
552                                                 <xsl:value-of select="$URLLinkText"/>
553                                         </xsl:when>
554                                         <xsl:otherwise>
555                                                 <xsl:text>Click here to access online</xsl:text>
556                                         </xsl:otherwise>
557                                         </xsl:choose>
558                                     </xsl:when>
559                                     </xsl:choose>
560                                     </a>
561                                     <xsl:choose>
562                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
563                                     <xsl:otherwise> | </xsl:otherwise>
564                                     </xsl:choose>
565
566         </xsl:for-each>
567         </span>
568         </xsl:if>
569         <xsl:if test="marc:datafield[@tag=505]">
570             <div class="results_summary contents">
571             <xsl:choose>
572             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
573                 <span class="label">Contents:</span>
574             </xsl:when>
575             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
576                 <span class="label">Incomplete contents:</span>
577             </xsl:when>
578             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
579                 <span class="label">Partial contents:</span>
580             </xsl:when>
581             </xsl:choose>
582                 <xsl:for-each select="marc:datafield[@tag=505]">
583                     <div class='contentblock'>
584                         <xsl:choose>
585                         <xsl:when test="@ind2=0">
586                             <xsl:call-template name="subfieldSelectSpan">
587                                 <xsl:with-param name="codes">tru</xsl:with-param>
588                             </xsl:call-template>
589                         </xsl:when>
590                         <xsl:otherwise>
591                             <xsl:call-template name="subfieldSelectSpan">
592                                 <xsl:with-param name="codes">atru</xsl:with-param>
593                             </xsl:call-template>
594                         </xsl:otherwise>
595                         </xsl:choose>
596                     </div>
597                 </xsl:for-each>
598             </div>
599         </xsl:if>
600
601         <!-- 773 -->
602         <xsl:if test="marc:datafield[@tag=773]">
603         <xsl:for-each select="marc:datafield[@tag=773]">
604         <xsl:if test="@ind1=0">
605         <span class="results_summary in"><span class="label">
606         <xsl:choose>
607         <xsl:when test="@ind2=' '">
608             In:
609         </xsl:when>
610         <xsl:when test="@ind2=8">
611             <xsl:if test="marc:subfield[@code='i']">
612                 <xsl:value-of select="marc:subfield[@code='i']"/>
613             </xsl:if>
614         </xsl:when>
615         </xsl:choose>
616         </span>
617                 <xsl:variable name="f773">
618                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
619                         <xsl:with-param name="codes">at</xsl:with-param>
620                     </xsl:call-template></xsl:with-param></xsl:call-template>
621                 </xsl:variable>
622             <xsl:choose>
623                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
624                     <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>
625                         <xsl:value-of select="translate($f773, '()', '')"/>
626                     </a>
627                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
628                 </xsl:when>
629                 <xsl:when test="marc:subfield[@code='0']">
630                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
631                         <xsl:value-of select="$f773"/>
632                     </a>
633                 </xsl:when>
634                 <xsl:otherwise>
635                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
636                         <xsl:value-of select="$f773"/>
637                     </a>
638                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
639                 </xsl:otherwise>
640             </xsl:choose>
641         </span>
642
643         <xsl:if test="marc:subfield[@code='n']">
644             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
645         </xsl:if>
646
647         </xsl:if>
648         </xsl:for-each>
649         </xsl:if>
650
651         <!-- 866 textual holdings -->
652         <xsl:if test="marc:datafield[@tag=866]">
653             <span class="results_summary holdings_note"><span class="label">Holdings Note: </span>
654                 <xsl:for-each select="marc:datafield[@tag=866]">
655                     <xsl:call-template name="subfieldSelect">
656                         <xsl:with-param name="codes">axz</xsl:with-param>
657                     </xsl:call-template>
658                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
659                 </xsl:for-each>
660             </span>
661         </xsl:if>
662
663         <!--  775 Other Edition  -->
664         <xsl:if test="marc:datafield[@tag=775]">
665         <span class="results_summary other_editions"><span class="label">Other Editions: </span>
666         <xsl:for-each select="marc:datafield[@tag=775]">
667             <xsl:variable name="f775">
668                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
669                 <xsl:with-param name="codes">a_t</xsl:with-param>
670                 </xsl:call-template></xsl:with-param></xsl:call-template>
671             </xsl:variable>
672             <xsl:if test="marc:subfield[@code='i']">
673                 <xsl:call-template name="subfieldSelect">
674                     <xsl:with-param name="codes">i</xsl:with-param>
675                 </xsl:call-template>
676                 <xsl:text>: </xsl:text>
677             </xsl:if>
678             <a>
679             <xsl:choose>
680             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
681                 <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>
682             </xsl:when>
683             <xsl:otherwise>
684                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
685             </xsl:otherwise>
686             </xsl:choose>
687             <xsl:call-template name="subfieldSelect">
688                 <xsl:with-param name="codes">a_t</xsl:with-param>
689             </xsl:call-template>
690             </a>
691             <xsl:choose>
692                 <xsl:when test="position()=last()"></xsl:when>
693                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
694             </xsl:choose>
695         </xsl:for-each>
696         </span>
697         </xsl:if>
698
699         <!-- 780 -->
700         <xsl:if test="marc:datafield[@tag=780]">
701         <xsl:for-each select="marc:datafield[@tag=780]">
702         <xsl:if test="@ind1=0">
703         <span class="results_summary preceeding_entry">
704         <xsl:choose>
705         <xsl:when test="@ind2=0">
706             <span class="label">Continues:</span>
707         </xsl:when>
708         <xsl:when test="@ind2=1">
709             <span class="label">Continues in part:</span>
710         </xsl:when>
711         <xsl:when test="@ind2=2">
712             <span class="label">Supersedes:</span>
713         </xsl:when>
714         <xsl:when test="@ind2=3">
715             <span class="label">Supersedes in part:</span>
716         </xsl:when>
717         <xsl:when test="@ind2=4">
718             <span class="label">Formed by the union: ... and: ...</span>
719         </xsl:when>
720         <xsl:when test="@ind2=5">
721             <span class="label">Absorbed:</span>
722         </xsl:when>
723         <xsl:when test="@ind2=6">
724             <span class="label">Absorbed in part:</span>
725         </xsl:when>
726         <xsl:when test="@ind2=7">
727             <span class="label">Separated from:</span>
728         </xsl:when>
729         </xsl:choose>
730                 <xsl:variable name="f780">
731                     <xsl:call-template name="subfieldSelect">
732                         <xsl:with-param name="codes">at</xsl:with-param>
733                     </xsl:call-template>
734                 </xsl:variable>
735             <xsl:choose>
736                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
737                     <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>
738                         <xsl:value-of select="translate($f780, '()', '')"/>
739                     </a>
740                 </xsl:when>
741                 <xsl:otherwise>
742                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
743                         <xsl:value-of select="translate($f780, '()', '')"/>
744                     </a>
745                 </xsl:otherwise>
746             </xsl:choose>
747         </span>
748  
749         <xsl:if test="marc:subfield[@code='n']">
750             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
751         </xsl:if>
752
753         </xsl:if>
754         </xsl:for-each>
755         </xsl:if>
756
757         <!-- 785 -->
758         <xsl:if test="marc:datafield[@tag=785]">
759         <xsl:for-each select="marc:datafield[@tag=785]">
760         <span class="results_summary succeeding_entry">
761         <xsl:choose>
762         <xsl:when test="@ind2=0">
763             <span class="label">Continued by:</span>
764         </xsl:when>
765         <xsl:when test="@ind2=1">
766             <span class="label">Continued in part by:</span>
767         </xsl:when>
768         <xsl:when test="@ind2=2">
769             <span class="label">Superseded by:</span>
770         </xsl:when>
771         <xsl:when test="@ind2=3">
772             <span class="label">Superseded in part by:</span>
773         </xsl:when>
774         <xsl:when test="@ind2=4">
775             <span class="label">Absorbed by:</span>
776         </xsl:when>
777         <xsl:when test="@ind2=5">
778             <span class="label">Absorbed in part by:</span>
779         </xsl:when>
780         <xsl:when test="@ind2=6">
781             <span class="label">Split into .. and ...:</span>
782         </xsl:when>
783         <xsl:when test="@ind2=7">
784             <span class="label">Merged with ... to form ...</span>
785         </xsl:when>
786         <xsl:when test="@ind2=8">
787             <span class="label">Changed back to:</span>
788         </xsl:when>
789
790         </xsl:choose>
791                    <xsl:variable name="f785">
792                     <xsl:call-template name="subfieldSelect">
793                         <xsl:with-param name="codes">at</xsl:with-param>
794                     </xsl:call-template>
795                 </xsl:variable>
796
797             <xsl:choose>
798                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
799                     <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>
800                         <xsl:value-of select="translate($f785, '()', '')"/>
801                     </a>
802                 </xsl:when>
803                 <xsl:otherwise>
804                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
805                         <xsl:value-of select="translate($f785, '()', '')"/>
806                     </a>
807                 </xsl:otherwise>
808             </xsl:choose>
809
810         </span>
811         </xsl:for-each>
812         </xsl:if>
813
814         <xsl:if test="$OPACBaseURL!=''">
815         <span class="results_summary"><span class="label">OPAC view: </span>
816             <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>.
817         </span>
818         </xsl:if>
819
820     </xsl:template>
821
822     <xsl:template name="nameABCDQ">
823             <xsl:call-template name="chopPunctuation">
824                 <xsl:with-param name="chopString">
825                     <xsl:call-template name="subfieldSelect">
826                         <xsl:with-param name="codes">aq</xsl:with-param>
827                     </xsl:call-template>
828                 </xsl:with-param>
829                 <xsl:with-param name="punctuation">
830                     <xsl:text>:,;/ </xsl:text>
831                 </xsl:with-param>
832             </xsl:call-template>
833         <xsl:call-template name="termsOfAddress"/>
834     </xsl:template>
835
836     <xsl:template name="nameABCDN">
837         <xsl:for-each select="marc:subfield[@code='a']">
838                 <xsl:call-template name="chopPunctuation">
839                     <xsl:with-param name="chopString" select="."/>
840                 </xsl:call-template>
841         </xsl:for-each>
842         <xsl:for-each select="marc:subfield[@code='b']">
843             <xsl:value-of select="."/>
844             <xsl:choose>
845                 <xsl:when test="position() != last()">
846                     <xsl:text> -- </xsl:text>
847                 </xsl:when>
848             </xsl:choose>
849         </xsl:for-each>
850         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
851                 <xsl:call-template name="subfieldSelect">
852                     <xsl:with-param name="codes">cdn</xsl:with-param>
853                 </xsl:call-template>
854         </xsl:if>
855     </xsl:template>
856
857     <xsl:template name="nameACDEQ">
858             <xsl:call-template name="subfieldSelect">
859                 <xsl:with-param name="codes">acdeq</xsl:with-param>
860             </xsl:call-template>
861     </xsl:template>
862     <xsl:template name="termsOfAddress">
863         <xsl:if test="marc:subfield[@code='b' or @code='c']">
864             <xsl:call-template name="chopPunctuation">
865                 <xsl:with-param name="chopString">
866                     <xsl:call-template name="subfieldSelect">
867                         <xsl:with-param name="codes">bc</xsl:with-param>
868                     </xsl:call-template>
869                 </xsl:with-param>
870             </xsl:call-template>
871         </xsl:if>
872     </xsl:template>
873
874     <xsl:template name="part">
875         <xsl:variable name="partNumber">
876             <xsl:call-template name="specialSubfieldSelect">
877                 <xsl:with-param name="axis">n</xsl:with-param>
878                 <xsl:with-param name="anyCodes">n</xsl:with-param>
879                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
880             </xsl:call-template>
881         </xsl:variable>
882         <xsl:variable name="partName">
883             <xsl:call-template name="specialSubfieldSelect">
884                 <xsl:with-param name="axis">p</xsl:with-param>
885                 <xsl:with-param name="anyCodes">p</xsl:with-param>
886                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
887             </xsl:call-template>
888         </xsl:variable>
889         <xsl:if test="string-length(normalize-space($partNumber))">
890                 <xsl:call-template name="chopPunctuation">
891                     <xsl:with-param name="chopString" select="$partNumber"/>
892                 </xsl:call-template>
893         </xsl:if>
894         <xsl:if test="string-length(normalize-space($partName))">
895                 <xsl:call-template name="chopPunctuation">
896                     <xsl:with-param name="chopString" select="$partName"/>
897                 </xsl:call-template>
898         </xsl:if>
899     </xsl:template>
900
901     <xsl:template name="specialSubfieldSelect">
902         <xsl:param name="anyCodes"/>
903         <xsl:param name="axis"/>
904         <xsl:param name="beforeCodes"/>
905         <xsl:param name="afterCodes"/>
906         <xsl:variable name="str">
907             <xsl:for-each select="marc:subfield">
908                 <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])">
909                     <xsl:value-of select="text()"/>
910                     <xsl:text> </xsl:text>
911                 </xsl:if>
912             </xsl:for-each>
913         </xsl:variable>
914         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
915     </xsl:template>
916
917     <xsl:template name="showAuthor">
918         <xsl:param name="authorfield"/>
919     <xsl:param name="UseAuthoritiesForTracings"/>
920         <xsl:if test="count($authorfield)&gt;0">
921         <h5 class="author">
922         <xsl:for-each select="$authorfield">
923         <xsl:choose>
924           <xsl:when test="position()&gt;1"/>
925           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
926           <xsl:otherwise>Additional author(s): </xsl:otherwise>
927         </xsl:choose>
928         <a>
929         <xsl:choose>
930             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
931                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
932             </xsl:when>
933             <xsl:otherwise>
934             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
935             </xsl:otherwise>
936         </xsl:choose>
937         <xsl:choose>
938           <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCDQ"/></xsl:when>
939           <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
940           <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
941         </xsl:choose>
942         <!-- add relator code too between brackets-->
943         <xsl:if test="marc:subfield[@code='4' or @code='e']">
944       <span class="relatorcode">
945       <xsl:text> [</xsl:text>
946           <xsl:choose>
947             <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
948             <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
949           </xsl:choose>
950           <xsl:text>]</xsl:text>
951       </span>
952         </xsl:if>
953         </a>
954         <xsl:choose>
955           <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
956         </xsl:choose>
957         </xsl:for-each>
958         </h5>
959         </xsl:if>
960     </xsl:template>
961
962 </xsl:stylesheet>