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