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