Bug 12829: properly skip invalid ISBN when rendering for normal record display
[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">Material 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         <!-- Publisher info and RDA related info from tags 260, 264 -->
303         <xsl:choose>
304         <xsl:when test="marc:datafield[@tag=260]">
305         <span class="results_summary publisher"><span class="label">Publisher: </span>
306             <xsl:for-each select="marc:datafield[@tag=260]">
307                 <xsl:if test="marc:subfield[@code='a']">
308                     <xsl:call-template name="subfieldSelect">
309                         <xsl:with-param name="codes">a</xsl:with-param>
310                     </xsl:call-template>
311                 </xsl:if>
312                 <xsl:text> </xsl:text>
313                 <xsl:if test="marc:subfield[@code='b']">
314                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
315                     <xsl:call-template name="subfieldSelect">
316                         <xsl:with-param name="codes">b</xsl:with-param>
317                     </xsl:call-template>
318                </a>
319                </xsl:if>
320                <xsl:text> </xsl:text>
321                 <xsl:call-template name="chopPunctuation">
322                   <xsl:with-param name="chopString">
323                     <xsl:call-template name="subfieldSelect">
324                         <xsl:with-param name="codes">cg</xsl:with-param>
325                     </xsl:call-template>
326                    </xsl:with-param>
327                </xsl:call-template>
328                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
329             </xsl:for-each>
330             <xsl:if test="marc:datafield[@tag=264]">
331                 <xsl:text>; </xsl:text>
332                 <xsl:call-template name="showRDAtag264"/>
333             </xsl:if>
334         </span>
335         </xsl:when>
336         <xsl:when test="marc:datafield[@tag=264]">
337             <span class="results_summary">
338                 <xsl:call-template name="showRDAtag264"/>
339             </span>
340         </xsl:when>
341         </xsl:choose>
342
343         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
344         <xsl:if test="$display880">
345             <xsl:call-template name="m880Select">
346                 <xsl:with-param name="basetags">250</xsl:with-param>
347                 <xsl:with-param name="codes">ab</xsl:with-param>
348                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
349                 <xsl:with-param name="label">Edition: </xsl:with-param>
350             </xsl:call-template>
351         </xsl:if>
352         
353         <xsl:if test="marc:datafield[@tag=250]">
354         <span class="results_summary edition"><span class="label">Edition: </span>
355             <xsl:for-each select="marc:datafield[@tag=250]">
356                 <xsl:call-template name="chopPunctuation">
357                   <xsl:with-param name="chopString">
358                     <xsl:call-template name="subfieldSelect">
359                         <xsl:with-param name="codes">ab</xsl:with-param>
360                     </xsl:call-template>
361                    </xsl:with-param>
362                </xsl:call-template>
363                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
364             </xsl:for-each>
365         </span>
366         </xsl:if>
367
368         <!-- Description: Alternate Graphic Representation (MARC 880) -->
369         <xsl:if test="$display880">
370             <xsl:call-template name="m880Select">
371                 <xsl:with-param name="basetags">300</xsl:with-param>
372                 <xsl:with-param name="codes">abceg</xsl:with-param>
373                 <xsl:with-param name="class">results_summary description</xsl:with-param>
374                 <xsl:with-param name="label">Description: </xsl:with-param>
375             </xsl:call-template>
376         </xsl:if>
377         
378         <xsl:if test="marc:datafield[@tag=300]">
379         <span class="results_summary description"><span class="label">Description: </span>
380             <xsl:for-each select="marc:datafield[@tag=300]">
381                 <xsl:call-template name="chopPunctuation">
382                   <xsl:with-param name="chopString">
383                     <xsl:call-template name="subfieldSelect">
384                         <xsl:with-param name="codes">abceg</xsl:with-param>
385                     </xsl:call-template>
386                    </xsl:with-param>
387                </xsl:call-template>
388                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
389             </xsl:for-each>
390         </span>
391        </xsl:if>
392
393         <!-- Build ISBN -->
394         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
395           <span class="results_summary isbn"><span class="label">ISBN: </span>
396             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
397               <span property="isbn">
398                 <xsl:value-of select="."/>
399                 <xsl:choose>
400                   <xsl:when test="position()=last()">
401                     <xsl:text>.</xsl:text>
402                   </xsl:when>
403                   <xsl:otherwise>
404                     <xsl:text>; </xsl:text>
405                   </xsl:otherwise>
406                 </xsl:choose>
407               </span>
408             </xsl:for-each>
409           </span>
410         </xsl:if>
411
412         <!-- Build ISSN -->
413         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
414           <span class="results_summary issn"><span class="label">ISSN: </span>
415             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
416               <span property="issn">
417                 <xsl:value-of select="."/>
418                 <xsl:choose>
419                   <xsl:when test="position()=last()">
420                     <xsl:text>.</xsl:text>
421                   </xsl:when>
422                   <xsl:otherwise>
423                     <xsl:text>; </xsl:text>
424                   </xsl:otherwise>
425                 </xsl:choose>
426               </span>
427             </xsl:for-each>
428           </span>
429         </xsl:if>
430
431         <xsl:if test="marc:datafield[@tag=013]">
432             <span class="results_summary patent_info">
433                 <span class="label">Patent information: </span>
434                 <xsl:for-each select="marc:datafield[@tag=013]">
435                     <xsl:call-template name="subfieldSelect">
436                         <xsl:with-param name="codes">acdef</xsl:with-param>
437                         <xsl:with-param name="delimeter">, </xsl:with-param>
438                     </xsl:call-template>
439                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
440                 </xsl:for-each>
441             </span>
442         </xsl:if>
443
444         <xsl:if test="marc:datafield[@tag=088]">
445             <span class="results_summary report_number">
446                 <span class="label">Report number: </span>
447                 <xsl:for-each select="marc:datafield[@tag=088]">
448                     <xsl:call-template name="subfieldSelect">
449                         <xsl:with-param name="codes">a</xsl:with-param>
450                     </xsl:call-template>
451                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
452                 </xsl:for-each>
453             </span>
454         </xsl:if>
455
456         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
457         <xsl:if test="$display880">
458             <xsl:call-template name="m880Select">
459                 <xsl:with-param name="basetags">246</xsl:with-param>
460                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
461                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
462                 <xsl:with-param name="label">Other title: </xsl:with-param>
463             </xsl:call-template>
464         </xsl:if>
465
466         <xsl:if test="marc:datafield[@tag=246]">
467         <span class="results_summary other_title"><span class="label">Other title: </span>
468             <xsl:for-each select="marc:datafield[@tag=246]">
469                 <xsl:call-template name="chopPunctuation">
470                   <xsl:with-param name="chopString">
471                     <xsl:call-template name="subfieldSelect">
472                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
473                     </xsl:call-template>
474                    </xsl:with-param>
475                </xsl:call-template>
476                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
477             </xsl:for-each>
478         </span>
479        </xsl:if>
480
481         <xsl:if test="marc:datafield[@tag=242]">
482         <span class="results_summary translated_title"><span class="label">Title translated: </span>
483             <xsl:for-each select="marc:datafield[@tag=242]">
484                 <xsl:call-template name="chopPunctuation">
485                   <xsl:with-param name="chopString">
486                     <xsl:call-template name="subfieldSelect">
487                         <xsl:with-param name="codes">abchnp</xsl:with-param>
488                     </xsl:call-template>
489                    </xsl:with-param>
490                </xsl:call-template>
491                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
492             </xsl:for-each>
493         </span>
494        </xsl:if>
495
496         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
497         <xsl:if test="$display880">
498             <xsl:call-template name="m880Select">
499                 <xsl:with-param name="basetags">130,240</xsl:with-param>
500                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
501                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
502                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
503             </xsl:call-template>
504         </xsl:if>
505
506         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
507         <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
508         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
509             <xsl:variable name="str">
510                 <xsl:for-each select="marc:subfield">
511                     <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'])))">
512                         <xsl:value-of select="text()"/>
513                         <xsl:text> </xsl:text>
514                      </xsl:if>
515                 </xsl:for-each>
516             </xsl:variable>
517             <xsl:call-template name="chopPunctuation">
518                 <xsl:with-param name="chopString">
519                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
520                         
521                 </xsl:with-param>
522             </xsl:call-template>
523             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
524         </xsl:for-each>
525         </span>
526         </xsl:if>
527
528         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
529             <span class="results_summary subjects"><span class="label">Subject(s): </span>
530             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
531             <a>
532             <xsl:choose>
533             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
534                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
535             </xsl:when>
536             <xsl:when test="$TraceSubjectSubdivisions='1'">
537                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
538                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
539                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
540                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
541                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
542                     </xsl:call-template>
543                 </xsl:attribute>
544             </xsl:when>
545             <xsl:otherwise>
546                <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>
547             </xsl:otherwise>
548             </xsl:choose>
549             <xsl:call-template name="chopPunctuation">
550                 <xsl:with-param name="chopString">
551                     <xsl:call-template name="subfieldSelect">
552                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
553                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
554                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
555                     </xsl:call-template>
556                 </xsl:with-param>
557             </xsl:call-template>
558             </a>
559             <xsl:choose>
560             <xsl:when test="position()=last()"></xsl:when>
561             <xsl:otherwise> | </xsl:otherwise>
562             </xsl:choose>
563
564             </xsl:for-each>
565             </span>
566         </xsl:if>
567
568         <xsl:if test="marc:datafield[@tag=856]">
569         <span class="results_summary online_resources"><span class="label">Online resources: </span>
570         <xsl:for-each select="marc:datafield[@tag=856]">
571                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
572                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
573                                     <xsl:choose>
574                                     <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')">
575                                         <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>
576                                     </xsl:when>
577                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
578                                         <xsl:call-template name="subfieldSelect">
579                                         <xsl:with-param name="codes">y3z</xsl:with-param>
580                                         </xsl:call-template>
581                                     </xsl:when>
582                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
583                                         <xsl:choose>
584                                         <xsl:when test="$URLLinkText!=''">
585                                                 <xsl:value-of select="$URLLinkText"/>
586                                         </xsl:when>
587                                         <xsl:otherwise>
588                                                 <xsl:text>Click here to access online</xsl:text>
589                                         </xsl:otherwise>
590                                         </xsl:choose>
591                                     </xsl:when>
592                                     </xsl:choose>
593                                     </a>
594                                     <xsl:choose>
595                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
596                                     <xsl:otherwise> | </xsl:otherwise>
597                                     </xsl:choose>
598
599         </xsl:for-each>
600         </span>
601         </xsl:if>
602         <xsl:if test="marc:datafield[@tag=505]">
603             <div class="results_summary contents">
604             <xsl:choose>
605             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
606                 <span class="label">Contents:</span>
607             </xsl:when>
608             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
609                 <span class="label">Incomplete contents:</span>
610             </xsl:when>
611             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
612                 <span class="label">Partial contents:</span>
613             </xsl:when>
614             </xsl:choose>
615                 <xsl:for-each select="marc:datafield[@tag=505]">
616                     <div class='contentblock'>
617                         <xsl:choose>
618                         <xsl:when test="@ind2=0">
619                             <xsl:call-template name="subfieldSelectSpan">
620                                 <xsl:with-param name="codes">tru</xsl:with-param>
621                             </xsl:call-template>
622                         </xsl:when>
623                         <xsl:otherwise>
624                             <xsl:call-template name="subfieldSelectSpan">
625                                 <xsl:with-param name="codes">atru</xsl:with-param>
626                             </xsl:call-template>
627                         </xsl:otherwise>
628                         </xsl:choose>
629                     </div>
630                 </xsl:for-each>
631             </div>
632         </xsl:if>
633
634         <!-- 773 -->
635         <xsl:if test="marc:datafield[@tag=773]">
636         <xsl:for-each select="marc:datafield[@tag=773]">
637         <xsl:if test="@ind1=0">
638         <span class="results_summary in"><span class="label">
639         <xsl:choose>
640         <xsl:when test="@ind2=' '">
641             In:
642         </xsl:when>
643         <xsl:when test="@ind2=8">
644             <xsl:if test="marc:subfield[@code='i']">
645                 <xsl:value-of select="marc:subfield[@code='i']"/>
646             </xsl:if>
647         </xsl:when>
648         </xsl:choose>
649         </span>
650                 <xsl:variable name="f773">
651                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
652                         <xsl:with-param name="codes">a_t</xsl:with-param>
653                     </xsl:call-template></xsl:with-param></xsl:call-template>
654                 </xsl:variable>
655             <xsl:choose>
656                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
657                     <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>
658                         <xsl:value-of select="translate($f773, '()', '')"/>
659                     </a>
660                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
661                 </xsl:when>
662                 <xsl:when test="marc:subfield[@code='0']">
663                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
664                         <xsl:value-of select="$f773"/>
665                     </a>
666                 </xsl:when>
667                 <xsl:otherwise>
668                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
669                         <xsl:value-of select="$f773"/>
670                     </a>
671                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
672                 </xsl:otherwise>
673             </xsl:choose>
674         </span>
675
676         <xsl:if test="marc:subfield[@code='n']">
677             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
678         </xsl:if>
679
680         </xsl:if>
681         </xsl:for-each>
682         </xsl:if>
683
684         <xsl:if test="marc:datafield[@tag=502]">
685             <span class="results_summary diss_note">
686                 <span class="label">Dissertation note: </span>
687                 <xsl:for-each select="marc:datafield[@tag=502]">
688                     <xsl:call-template name="subfieldSelect">
689                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
690                     </xsl:call-template>
691                 </xsl:for-each>
692                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
693             </span>
694         </xsl:if>
695
696         <!-- 866 textual holdings -->
697         <xsl:if test="marc:datafield[@tag=866]">
698             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
699                 <xsl:for-each select="marc:datafield[@tag=866]">
700                     <xsl:call-template name="subfieldSelect">
701                         <xsl:with-param name="codes">axz</xsl:with-param>
702                     </xsl:call-template>
703                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
704                 </xsl:for-each>
705             </span>
706         </xsl:if>
707
708         <!--  775 Other Edition  -->
709         <xsl:if test="marc:datafield[@tag=775]">
710         <span class="results_summary other_editions"><span class="label">Other editions: </span>
711         <xsl:for-each select="marc:datafield[@tag=775]">
712             <xsl:variable name="f775">
713                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
714                 <xsl:with-param name="codes">a_t</xsl:with-param>
715                 </xsl:call-template></xsl:with-param></xsl:call-template>
716             </xsl:variable>
717             <xsl:if test="marc:subfield[@code='i']">
718                 <xsl:call-template name="subfieldSelect">
719                     <xsl:with-param name="codes">i</xsl:with-param>
720                 </xsl:call-template>
721                 <xsl:text>: </xsl:text>
722             </xsl:if>
723             <a>
724             <xsl:choose>
725             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
726                 <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>
727             </xsl:when>
728             <xsl:otherwise>
729                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
730             </xsl:otherwise>
731             </xsl:choose>
732             <xsl:call-template name="subfieldSelect">
733                 <xsl:with-param name="codes">a_t</xsl:with-param>
734             </xsl:call-template>
735             </a>
736             <xsl:choose>
737                 <xsl:when test="position()=last()"></xsl:when>
738                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
739             </xsl:choose>
740         </xsl:for-each>
741         </span>
742         </xsl:if>
743
744         <!-- 780 -->
745         <xsl:if test="marc:datafield[@tag=780]">
746         <xsl:for-each select="marc:datafield[@tag=780]">
747         <xsl:if test="@ind1=0">
748         <span class="results_summary preceeding_entry">
749         <xsl:choose>
750         <xsl:when test="@ind2=0">
751             <span class="label">Continues:</span>
752         </xsl:when>
753         <xsl:when test="@ind2=1">
754             <span class="label">Continues in part:</span>
755         </xsl:when>
756         <xsl:when test="@ind2=2">
757             <span class="label">Supersedes:</span>
758         </xsl:when>
759         <xsl:when test="@ind2=3">
760             <span class="label">Supersedes in part:</span>
761         </xsl:when>
762         <xsl:when test="@ind2=4">
763             <span class="label">Formed by the union: ... and: ...</span>
764         </xsl:when>
765         <xsl:when test="@ind2=5">
766             <span class="label">Absorbed:</span>
767         </xsl:when>
768         <xsl:when test="@ind2=6">
769             <span class="label">Absorbed in part:</span>
770         </xsl:when>
771         <xsl:when test="@ind2=7">
772             <span class="label">Separated from:</span>
773         </xsl:when>
774         </xsl:choose>
775         <xsl:text> </xsl:text>
776                 <xsl:variable name="f780">
777                     <xsl:call-template name="subfieldSelect">
778                         <xsl:with-param name="codes">a_t</xsl:with-param>
779                     </xsl:call-template>
780                 </xsl:variable>
781             <xsl:choose>
782                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
783                     <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>
784                         <xsl:value-of select="translate($f780, '()', '')"/>
785                     </a>
786                 </xsl:when>
787                 <xsl:otherwise>
788                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
789                         <xsl:value-of select="translate($f780, '()', '')"/>
790                     </a>
791                 </xsl:otherwise>
792             </xsl:choose>
793         </span>
794  
795         <xsl:if test="marc:subfield[@code='n']">
796             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
797         </xsl:if>
798
799         </xsl:if>
800         </xsl:for-each>
801         </xsl:if>
802
803         <!-- 785 -->
804         <xsl:if test="marc:datafield[@tag=785]">
805         <xsl:for-each select="marc:datafield[@tag=785]">
806         <span class="results_summary succeeding_entry">
807         <xsl:choose>
808         <xsl:when test="@ind2=0">
809             <span class="label">Continued by:</span>
810         </xsl:when>
811         <xsl:when test="@ind2=1">
812             <span class="label">Continued in part by:</span>
813         </xsl:when>
814         <xsl:when test="@ind2=2">
815             <span class="label">Superseded by:</span>
816         </xsl:when>
817         <xsl:when test="@ind2=3">
818             <span class="label">Superseded in part by:</span>
819         </xsl:when>
820         <xsl:when test="@ind2=4">
821             <span class="label">Absorbed by:</span>
822         </xsl:when>
823         <xsl:when test="@ind2=5">
824             <span class="label">Absorbed in part by:</span>
825         </xsl:when>
826         <xsl:when test="@ind2=6">
827             <span class="label">Split into .. and ...:</span>
828         </xsl:when>
829         <xsl:when test="@ind2=7">
830             <span class="label">Merged with ... to form ...</span>
831         </xsl:when>
832         <xsl:when test="@ind2=8">
833             <span class="label">Changed back to:</span>
834         </xsl:when>
835         </xsl:choose>
836         <xsl:text> </xsl:text>
837                    <xsl:variable name="f785">
838                     <xsl:call-template name="subfieldSelect">
839                         <xsl:with-param name="codes">a_t</xsl:with-param>
840                     </xsl:call-template>
841                 </xsl:variable>
842
843             <xsl:choose>
844                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
845                     <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>
846                         <xsl:value-of select="translate($f785, '()', '')"/>
847                     </a>
848                 </xsl:when>
849                 <xsl:otherwise>
850                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
851                         <xsl:value-of select="translate($f785, '()', '')"/>
852                     </a>
853                 </xsl:otherwise>
854             </xsl:choose>
855
856         </span>
857         </xsl:for-each>
858         </xsl:if>
859
860         <xsl:if test="$OPACBaseURL!=''">
861         <span class="results_summary"><span class="label">OPAC view: </span>
862             <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>.
863         </span>
864         </xsl:if>
865
866     </xsl:template>
867
868     <xsl:template name="nameABCQ">
869             <xsl:call-template name="chopPunctuation">
870                 <xsl:with-param name="chopString">
871                     <xsl:call-template name="subfieldSelect">
872                         <xsl:with-param name="codes">abcq</xsl:with-param>
873                     </xsl:call-template>
874                 </xsl:with-param>
875                 <xsl:with-param name="punctuation">
876                     <xsl:text>:,;/ </xsl:text>
877                 </xsl:with-param>
878             </xsl:call-template>
879     </xsl:template>
880
881     <xsl:template name="nameABCDN">
882             <xsl:call-template name="chopPunctuation">
883                 <xsl:with-param name="chopString">
884                     <xsl:call-template name="subfieldSelect">
885                         <xsl:with-param name="codes">abcdn</xsl:with-param>
886                     </xsl:call-template>
887                 </xsl:with-param>
888                 <xsl:with-param name="punctuation">
889                     <xsl:text>:,;/ </xsl:text>
890                 </xsl:with-param>
891             </xsl:call-template>
892     </xsl:template>
893
894     <xsl:template name="nameACDEQ">
895             <xsl:call-template name="subfieldSelect">
896                 <xsl:with-param name="codes">acdeq</xsl:with-param>
897             </xsl:call-template>
898     </xsl:template>
899
900     <xsl:template name="part">
901         <xsl:variable name="partNumber">
902             <xsl:call-template name="specialSubfieldSelect">
903                 <xsl:with-param name="axis">n</xsl:with-param>
904                 <xsl:with-param name="anyCodes">n</xsl:with-param>
905                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
906             </xsl:call-template>
907         </xsl:variable>
908         <xsl:variable name="partName">
909             <xsl:call-template name="specialSubfieldSelect">
910                 <xsl:with-param name="axis">p</xsl:with-param>
911                 <xsl:with-param name="anyCodes">p</xsl:with-param>
912                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
913             </xsl:call-template>
914         </xsl:variable>
915         <xsl:if test="string-length(normalize-space($partNumber))">
916                 <xsl:call-template name="chopPunctuation">
917                     <xsl:with-param name="chopString" select="$partNumber"/>
918                 </xsl:call-template>
919         </xsl:if>
920         <xsl:if test="string-length(normalize-space($partName))">
921                 <xsl:call-template name="chopPunctuation">
922                     <xsl:with-param name="chopString" select="$partName"/>
923                 </xsl:call-template>
924         </xsl:if>
925     </xsl:template>
926
927     <xsl:template name="specialSubfieldSelect">
928         <xsl:param name="anyCodes"/>
929         <xsl:param name="axis"/>
930         <xsl:param name="beforeCodes"/>
931         <xsl:param name="afterCodes"/>
932         <xsl:variable name="str">
933             <xsl:for-each select="marc:subfield">
934                 <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])">
935                     <xsl:value-of select="text()"/>
936                     <xsl:text> </xsl:text>
937                 </xsl:if>
938             </xsl:for-each>
939         </xsl:variable>
940         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
941     </xsl:template>
942
943     <xsl:template name="showAuthor">
944         <xsl:param name="authorfield"/>
945     <xsl:param name="UseAuthoritiesForTracings"/>
946         <xsl:if test="count($authorfield)&gt;0">
947         <h5 class="author">
948         <xsl:for-each select="$authorfield">
949         <xsl:choose>
950           <xsl:when test="position()&gt;1"/>
951           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
952           <xsl:otherwise>Additional author(s): </xsl:otherwise>
953         </xsl:choose>
954         <a>
955         <xsl:choose>
956             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
957                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
958             </xsl:when>
959             <xsl:otherwise>
960             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
961             </xsl:otherwise>
962         </xsl:choose>
963         <xsl:choose>
964           <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCQ"/></xsl:when>
965           <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
966           <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
967         </xsl:choose>
968         <!-- add relator code too between brackets-->
969         <xsl:if test="marc:subfield[@code='4' or @code='e']">
970       <span class="relatorcode">
971       <xsl:text> [</xsl:text>
972           <xsl:choose>
973             <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
974             <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
975           </xsl:choose>
976           <xsl:text>]</xsl:text>
977       </span>
978         </xsl:if>
979         </a>
980         <xsl:choose>
981           <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
982         </xsl:choose>
983         </xsl:for-each>
984         </h5>
985         </xsl:if>
986     </xsl:template>
987
988 </xsl:stylesheet>