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