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