bug 2001, 2432: improve unAPI implementation
[koha.git] / koha-tmpl / opac-tmpl / prog / en / xslt / UNIMARCslim2OPACDetail.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 <xsl:stylesheet version="1.0"
4   xmlns:marc="http://www.loc.gov/MARC21/slim"
5   xmlns:items="http://www.koha.org/items"
6   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7   exclude-result-prefixes="marc items">
8
9 <xsl:import href="UNIMARCslimUtils.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   <xsl:variable name="leader" select="marc:leader"/>
17   <xsl:variable name="leader6" select="substring($leader,7,1)"/>
18   <xsl:variable name="leader7" select="substring($leader,8,1)"/>
19   <xsl:variable name="biblionumber" select="marc:datafield[@tag=090]/marc:subfield[@code='a']"/>
20   
21
22   <xsl:if test="marc:datafield[@tag=200]">
23     <xsl:for-each select="marc:datafield[@tag=200]">
24       <h1>
25         <xsl:value-of select="marc:subfield[@code='a']"/>
26         <xsl:if test="marc:subfield[@code='e']">
27           <xsl:text> : </xsl:text>
28           <xsl:value-of select="marc:subfield[@code='e']"/>
29         </xsl:if>
30         <xsl:if test="marc:subfield[@code='b']">
31           <xsl:text> [</xsl:text>
32           <xsl:value-of select="marc:subfield[@code='b']"/>
33           <xsl:text>]</xsl:text>
34         </xsl:if>
35         <xsl:if test="marc:subfield[@code='f']">
36           <xsl:text> / </xsl:text>
37           <xsl:value-of select="marc:subfield[@code='f']"/>
38         </xsl:if>
39         <xsl:if test="marc:subfield[@code='g']">
40           <xsl:text> ; </xsl:text>
41           <xsl:value-of select="marc:subfield[@code='g']"/>
42         </xsl:if>
43       </h1>
44     </xsl:for-each>
45   </xsl:if>
46
47   <div id="views">
48     <span class="view">
49       <span id="Normalview">Normal View</span>
50     </span>
51     <span class="view">
52       <a id="MARCviewPop" href="/cgi-bin/koha/opac-showmarc.pl?id={marc:datafield[@tag=090]/marc:subfield[@code='a']}" title="MARC" rel="gb_page_center[600,500]">MARC View</a>
53     </span>
54     <span class="view">
55       <a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber={marc:datafield[@tag=090]/marc:subfield[@code='a']}" title="MARC">Expanded MARC View</a>
56     </span>
57     <span class="view">
58       <a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber={marc:datafield[@tag=090]/marc:subfield[@code='a']}">Card View (ISBD)</a>
59     </span>
60   </div>
61   
62   <xsl:call-template name="tag_4xx" />
63
64   <xsl:if test="marc:datafield[@tag=700]">
65     <xsl:for-each select="marc:datafield[@tag=700]">
66           <span class="results_summary">
67         <span class="label">Auteur principal: </span>
68         <a>
69           <xsl:choose>
70             <xsl:when test="marc:subfield[@code=9]">
71               <xsl:attribute name="href">
72                 /cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/>
73               </xsl:attribute>
74             </xsl:when>
75             <xsl:otherwise>
76               <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
77             </xsl:otherwise>
78           </xsl:choose>
79           <xsl:if test="marc:subfield[@code='a']">
80             <xsl:value-of select="marc:subfield[@code='a']"/>
81           </xsl:if>
82           <xsl:if test="marc:subfield[@code='b']">,
83             <xsl:value-of select="marc:subfield[@code='b']"/>
84           </xsl:if>
85           <xsl:if test="marc:subfield[@code='f']">
86             (<xsl:value-of select="marc:subfield[@code='f']"/>)
87           </xsl:if>
88         </a>
89       </span>
90     </xsl:for-each>
91   </xsl:if>
92
93   <xsl:if test="marc:datafield[@tag=710]">
94     <xsl:for-each select="marc:datafield[@tag=710]">
95           <span class="results_summary">
96         <span class="label">Collectivité principale: </span>
97         <a>
98           <xsl:choose>
99             <xsl:when test="marc:subfield[@code=9]">
100               <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
101             </xsl:when>
102             <xsl:otherwise>
103               <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
104             </xsl:otherwise>
105           </xsl:choose>
106           <xsl:if test="marc:subfield[@code='a']">
107             <xsl:value-of select="marc:subfield[@code='a']"/>
108           </xsl:if>
109           <xsl:if test="marc:subfield[@code='b']">,
110             <xsl:value-of select="marc:subfield[@code='b']"/>
111           </xsl:if>
112           <xsl:if test="marc:subfield[@code='d']">,
113             <xsl:value-of select="marc:subfield[@code='d']"/>
114           </xsl:if>
115           <xsl:if test="marc:subfield[@code='e']">,
116             <xsl:value-of select="marc:subfield[@code='e']"/>
117           </xsl:if>
118           <xsl:if test="marc:subfield[@code='f']">
119             (<xsl:value-of select="marc:subfield[@code='f']"/>)
120           </xsl:if>
121         </a>
122       </span>
123     </xsl:for-each>
124   </xsl:if>
125
126   <xsl:if test="marc:datafield[@tag=701]">
127           <span class="results_summary">
128       <span class="label">Co-auteur: </span>
129       <xsl:for-each select="marc:datafield[@tag=701]">
130           <a>
131             <xsl:choose>
132               <xsl:when test="marc:subfield[@code=9]">
133                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
134               </xsl:when>
135               <xsl:otherwise>
136                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
137               </xsl:otherwise>
138             </xsl:choose>
139             <xsl:if test="marc:subfield[@code='a']">
140               <xsl:value-of select="marc:subfield[@code='a']"/>
141             </xsl:if>
142             <xsl:if test="marc:subfield[@code='b']">,
143               <xsl:value-of select="marc:subfield[@code='b']"/>
144             </xsl:if>
145             <xsl:if test="marc:subfield[@code='f']">
146               (<xsl:value-of select="marc:subfield[@code='f']"/>)
147             </xsl:if>
148           </a>
149           <xsl:value-of select="marc:subfield[@code='4']"/>
150           <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
151       </xsl:for-each>
152     </span>
153   </xsl:if>
154
155   <xsl:if test="marc:datafield[@tag=702]">
156           <span class="results_summary">
157       <span class="label">Auteur: </span>
158       <xsl:for-each select="marc:datafield[@tag=702]">
159         <a>
160           <xsl:choose>
161             <xsl:when test="marc:subfield[@code=9]">
162               <xsl:attribute name="href">
163                 /cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/>
164               </xsl:attribute>
165             </xsl:when>
166             <xsl:otherwise>
167               <xsl:attribute name="href">
168                 /cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text>
169               </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
170             </xsl:otherwise>
171           </xsl:choose>
172           <xsl:if test="marc:subfield[@code='a']">
173             <xsl:value-of select="marc:subfield[@code='a']"/>
174           </xsl:if>
175           <xsl:if test="marc:subfield[@code='b']">,
176             <xsl:value-of select="marc:subfield[@code='b']"/>
177           </xsl:if>
178           <xsl:if test="marc:subfield[@code='f']">
179             (<xsl:value-of select="marc:subfield[@code='f']"/>)
180           </xsl:if>
181         </a>.
182         <xsl:value-of select="marc:subfield[@code='4']"/>
183         <xsl:choose>
184           <xsl:when test="position()=last()">
185             <xsl:text>.</xsl:text>
186           </xsl:when>
187           <xsl:otherwise>
188             <xsl:text> ; </xsl:text>
189           </xsl:otherwise>
190         </xsl:choose>
191       </xsl:for-each>
192     </span>
193   </xsl:if>
194
195   <xsl:if test="marc:datafield[@tag=711]">
196           <span class="results_summary">
197       <span class="label">Collectivité co-auteur: </span>
198       <xsl:for-each select="marc:datafield[@tag=711]">
199           <a>
200             <xsl:choose>
201               <xsl:when test="marc:subfield[@code=9]">
202                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
203               </xsl:when>
204               <xsl:otherwise>
205                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute>
206               </xsl:otherwise>
207             </xsl:choose>
208             <xsl:if test="marc:subfield[@code='a']">
209               <xsl:value-of select="marc:subfield[@code='a']"/>
210             </xsl:if>
211             <xsl:if test="marc:subfield[@code='b']">,
212               <xsl:value-of select="marc:subfield[@code='b']"/>
213             </xsl:if>
214             <xsl:if test="marc:subfield[@code='d']">,
215               <xsl:value-of select="marc:subfield[@code='d']"/>
216             </xsl:if>
217             <xsl:if test="marc:subfield[@code='e']">,
218               <xsl:value-of select="marc:subfield[@code='e']"/>
219             </xsl:if>
220             <xsl:if test="marc:subfield[@code='f']">
221               (<xsl:value-of select="marc:subfield[@code='f']"/>)
222             </xsl:if>
223           </a>
224           <xsl:value-of select="marc:subfield[@code='4']"/>
225           <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
226       </xsl:for-each>
227     </span>
228   </xsl:if>
229
230   <xsl:if test="marc:datafield[@tag=101]">
231           <span class="results_summary">
232       <span class="label">Langue: </span>
233       <xsl:for-each select="marc:datafield[@tag=101]">
234         <xsl:for-each select="marc:subfield">
235           <xsl:choose>
236             <xsl:when test="@code='b'">de la trad. intermédiaire, </xsl:when>
237             <xsl:when test="@code='c'">de l'œuvre originale, </xsl:when>
238             <xsl:when test="@code='d'">du résumé, </xsl:when>
239             <xsl:when test="@code='e'">de la table des matières, </xsl:when>
240             <xsl:when test="@code='f'">de la page de titre, </xsl:when>
241             <xsl:when test="@code='g'">du titre propre, </xsl:when>
242             <xsl:when test="@code='h'">d'un livret, </xsl:when>
243             <xsl:when test="@code='i'">des textes d'accompagnement, </xsl:when>
244             <xsl:when test="@code='j'">des sous-titres, </xsl:when>
245           </xsl:choose>
246           <xsl:value-of select="text()"/>
247           <xsl:choose>
248             <xsl:when test="position()=last()">
249               <xsl:text>.</xsl:text>
250             </xsl:when>
251             <xsl:otherwise>
252               <xsl:text> ; </xsl:text>
253             </xsl:otherwise>
254           </xsl:choose>
255         </xsl:for-each>
256       </xsl:for-each>
257     </span>
258   </xsl:if>
259
260   <xsl:if test="marc:datafield[@tag=102]">
261           <span class="results_summary">
262       <span class="label">Pays: </span>
263       <xsl:for-each select="marc:datafield[@tag=102]">
264         <xsl:for-each select="marc:subfield">
265           <xsl:value-of select="text()"/>
266           <xsl:choose>
267             <xsl:when test="position()=last()">
268               <xsl:text>.</xsl:text>
269             </xsl:when>
270               <xsl:otherwise><xsl:text>, </xsl:text>
271             </xsl:otherwise>
272           </xsl:choose>
273         </xsl:for-each>
274       </xsl:for-each>
275     </span>
276   </xsl:if>
277
278   <xsl:call-template name="tag_210" />
279
280   <xsl:call-template name="tag_215" />
281
282   <abbr class="unapi-id" title="koha:biblionumber:{marc:datafield[@tag=090]/marc:subfield[@code='a']}"><!-- unAPI --></abbr>
283
284   <xsl:if test="marc:datafield[@tag=010]/marc:subfield[@code='a']">
285     <span class="results_summary"><span class="label">ISBN: </span>
286     <xsl:for-each select="marc:datafield[@tag=010]">
287       <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
288       <xsl:value-of select="marc:subfield[@code='a']"/>
289       <xsl:choose>
290         <xsl:when test="position()=last()">
291           <xsl:text>.</xsl:text>
292         </xsl:when>
293         <xsl:otherwise>
294           <xsl:text> ; </xsl:text>
295         </xsl:otherwise>
296       </xsl:choose>
297     </xsl:for-each>
298     </span>
299   </xsl:if>
300
301   <xsl:if test="marc:datafield[@tag=011]">
302     <span class="results_summary">
303       <span class="label">ISSN: </span>
304       <xsl:for-each select="marc:datafield[@tag=011]">
305         <xsl:value-of select="marc:subfield[@code='a']"/>
306         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
307       </xsl:for-each>
308     </span>
309   </xsl:if>
310
311   <xsl:if test="marc:datafield[@tag=676]">
312     <span class="results_summary">
313     <span class="label">Dewey: </span>
314       <xsl:for-each select="marc:datafield[@tag=676]">
315         <xsl:value-of select="marc:subfield[@code='a']"/>
316         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
317       </xsl:for-each>
318     </span>
319   </xsl:if>
320
321   <xsl:if test="marc:datafield[@tag=330]">
322     <span class="results_summary">
323       <span class="label">Résumé: </span>
324       <xsl:for-each select="marc:datafield[@tag=330]">
325         <xsl:value-of select="marc:subfield[@code='a']"/>
326         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
327       </xsl:for-each>
328     </span>
329   </xsl:if>
330
331   <xsl:if test="marc:datafield[@tag=317]">
332     <span class="results_summary">
333       <span class="label">Note sur la provenance: </span>
334       <xsl:for-each select="marc:datafield[@tag=317]">
335           <xsl:value-of select="marc:subfield[@code='a']"/>      
336       </xsl:for-each>
337     </span>
338   </xsl:if>
339
340   <xsl:if test="marc:datafield[@tag=320]">
341     <span class="results_summary">
342       <span class="label">Bibliographie: </span>
343       <xsl:for-each select="marc:datafield[@tag=320]">
344         <xsl:value-of select="marc:subfield[@code='a']"/>
345         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
346       </xsl:for-each>
347     </span>
348   </xsl:if>
349
350   <xsl:if test="marc:datafield[@tag=328]">
351     <span class="results_summary">
352       <span class="label">Thèse: </span>
353       <xsl:for-each select="marc:datafield[@tag=328]">
354         <xsl:value-of select="marc:subfield[@code='a']"/>
355         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
356       </xsl:for-each>
357     </span>
358   </xsl:if>
359
360   <xsl:if test="marc:datafield[@tag=333]">
361     <span class="results_summary">
362       <span class="label">Public: </span>
363       <xsl:for-each select="marc:datafield[@tag=333]">
364         <xsl:value-of select="marc:subfield[@code='a']"/>
365         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
366       </xsl:for-each>
367     </span>
368   </xsl:if>
369
370   <xsl:if test="marc:datafield[@tag=600 or @tag=606]">
371     <span class="results_summary"><span class="label">Sujets: </span>
372       <xsl:for-each select="marc:datafield[@tag=606]">
373         <a>
374           <xsl:choose>
375             <xsl:when test="marc:subfield[@code=9]">
376               <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
377             </xsl:when>
378             <xsl:otherwise>
379               <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
380             </xsl:otherwise>
381           </xsl:choose>
382           <xsl:call-template name="chopPunctuation">
383             <xsl:with-param name="chopString">
384               <xsl:call-template name="subfieldSelect">
385                   <xsl:with-param name="codes">abcdjpvxyz</xsl:with-param>
386                   <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param>
387                   <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
388               </xsl:call-template>
389             </xsl:with-param>
390           </xsl:call-template>
391         </a>
392         <xsl:choose>
393           <xsl:when test="position()=last()"></xsl:when>
394           <xsl:otherwise> | </xsl:otherwise>
395         </xsl:choose>
396       </xsl:for-each>
397     </span>
398   </xsl:if>
399
400   <xsl:if test="marc:datafield[@tag=856]">
401     <span class="results_summary">
402       <span class="label">Online Resources: </span>
403       <xsl:for-each select="marc:datafield[@tag=856]">
404         <a>
405           <xsl:attribute name="href">
406             <xsl:value-of select="marc:subfield[@code='u']"/>
407           </xsl:attribute>
408           <xsl:choose>
409             <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
410               <xsl:call-template name="subfieldSelect">
411                 <xsl:with-param name="codes">y3z</xsl:with-param>
412               </xsl:call-template>
413             </xsl:when>
414             <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
415               Click here to access online
416             </xsl:when>
417           </xsl:choose>
418         </a>
419         <xsl:choose>
420           <xsl:when test="position()=last()"></xsl:when>
421           <xsl:otherwise> | </xsl:otherwise>
422         </xsl:choose>      
423       </xsl:for-each>
424     </span>
425   </xsl:if>
426
427         <!-- 780 -->
428         <xsl:if test="marc:datafield[@tag=780]">
429         <xsl:for-each select="marc:datafield[@tag=780]">
430         <span class="results_summary"><span class="label">
431         <xsl:choose>
432         <xsl:when test="@ind2=0">
433             Continues:
434         </xsl:when>
435         <xsl:when test="@ind2=1">
436             Continues in part:
437         </xsl:when>
438         <xsl:when test="@ind2=2">
439             Supersedes:
440         </xsl:when>
441         <xsl:when test="@ind2=3">
442             Supersedes in part:
443         </xsl:when>
444         <xsl:when test="@ind2=4">
445             Formed by the union: ... and: ...
446         </xsl:when>
447         <xsl:when test="@ind2=5">
448             Absorbed:
449         </xsl:when>
450         <xsl:when test="@ind2=6">
451             Absorbed in part:
452         </xsl:when>
453         <xsl:when test="@ind2=7">
454             Separated from:
455         </xsl:when>
456         </xsl:choose>
457         </span>
458                 <xsl:variable name="f780">
459                     <xsl:call-template name="subfieldSelect">
460                         <xsl:with-param name="codes">at</xsl:with-param>
461                     </xsl:call-template>
462                 </xsl:variable>
463              <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
464                 <xsl:value-of select="translate($f780, '()', '')"/>
465             </a>
466         </span>
467  
468         <xsl:choose>
469         <xsl:when test="@ind1=0">
470             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
471         </xsl:when>
472         </xsl:choose>
473
474         </xsl:for-each>
475         </xsl:if>
476
477         <!-- 785 -->
478         <xsl:if test="marc:datafield[@tag=785]">
479         <xsl:for-each select="marc:datafield[@tag=785]">
480         <span class="results_summary"><span class="label">
481         <xsl:choose>
482         <xsl:when test="@ind2=0">
483             Continued by:
484         </xsl:when>
485         <xsl:when test="@ind2=1">
486             Continued in part by:
487         </xsl:when>
488         <xsl:when test="@ind2=2">
489             Superseded by:
490         </xsl:when>
491         <xsl:when test="@ind2=3">
492             Superseded in part by:
493         </xsl:when>
494         <xsl:when test="@ind2=4">
495             Absorbed by:
496         </xsl:when>
497         <xsl:when test="@ind2=5">
498             Absorbed in part by:
499         </xsl:when>
500         <xsl:when test="@ind2=6">
501             Split into .. and ...:
502         </xsl:when>
503         <xsl:when test="@ind2=7">
504             Merged with ... to form ...
505         </xsl:when>
506         <xsl:when test="@ind2=8">
507             Changed back to:
508         </xsl:when>
509
510         </xsl:choose>
511         </span>
512                    <xsl:variable name="f785">
513                     <xsl:call-template name="subfieldSelect">
514                         <xsl:with-param name="codes">at</xsl:with-param>
515                     </xsl:call-template>
516                 </xsl:variable>
517
518                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
519                 <xsl:value-of select="translate($f785, '()', '')"/>
520             </a>
521
522         </span>
523         </xsl:for-each>
524         </xsl:if>
525
526     </xsl:template>
527
528     <xsl:template name="nameABCDQ">
529             <xsl:call-template name="chopPunctuation">
530                 <xsl:with-param name="chopString">
531                     <xsl:call-template name="subfieldSelect">
532                         <xsl:with-param name="codes">aq</xsl:with-param>
533                     </xsl:call-template>
534                 </xsl:with-param>
535                 <xsl:with-param name="punctuation">
536                     <xsl:text>:,;/ </xsl:text>
537                 </xsl:with-param>
538             </xsl:call-template>
539         <xsl:call-template name="termsOfAddress"/>
540     </xsl:template>
541
542     <xsl:template name="nameABCDN">
543         <xsl:for-each select="marc:subfield[@code='a']">
544                 <xsl:call-template name="chopPunctuation">
545                     <xsl:with-param name="chopString" select="."/>
546                 </xsl:call-template>
547         </xsl:for-each>
548         <xsl:for-each select="marc:subfield[@code='b']">
549                 <xsl:value-of select="."/>
550         </xsl:for-each>
551         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
552                 <xsl:call-template name="subfieldSelect">
553                     <xsl:with-param name="codes">cdn</xsl:with-param>
554                 </xsl:call-template>
555         </xsl:if>
556     </xsl:template>
557
558     <xsl:template name="nameACDEQ">
559             <xsl:call-template name="subfieldSelect">
560                 <xsl:with-param name="codes">acdeq</xsl:with-param>
561             </xsl:call-template>
562     </xsl:template>
563     <xsl:template name="termsOfAddress">
564         <xsl:if test="marc:subfield[@code='b' or @code='c']">
565             <xsl:call-template name="chopPunctuation">
566                 <xsl:with-param name="chopString">
567                     <xsl:call-template name="subfieldSelect">
568                         <xsl:with-param name="codes">bc</xsl:with-param>
569                     </xsl:call-template>
570                 </xsl:with-param>
571             </xsl:call-template>
572         </xsl:if>
573     </xsl:template>
574
575     <xsl:template name="part">
576         <xsl:variable name="partNumber">
577             <xsl:call-template name="specialSubfieldSelect">
578                 <xsl:with-param name="axis">n</xsl:with-param>
579                 <xsl:with-param name="anyCodes">n</xsl:with-param>
580                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
581             </xsl:call-template>
582         </xsl:variable>
583         <xsl:variable name="partName">
584             <xsl:call-template name="specialSubfieldSelect">
585                 <xsl:with-param name="axis">p</xsl:with-param>
586                 <xsl:with-param name="anyCodes">p</xsl:with-param>
587                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
588             </xsl:call-template>
589         </xsl:variable>
590         <xsl:if test="string-length(normalize-space($partNumber))">
591                 <xsl:call-template name="chopPunctuation">
592                     <xsl:with-param name="chopString" select="$partNumber"/>
593                 </xsl:call-template>
594         </xsl:if>
595         <xsl:if test="string-length(normalize-space($partName))">
596                 <xsl:call-template name="chopPunctuation">
597                     <xsl:with-param name="chopString" select="$partName"/>
598                 </xsl:call-template>
599         </xsl:if>
600     </xsl:template>
601
602     <xsl:template name="specialSubfieldSelect">
603         <xsl:param name="anyCodes"/>
604         <xsl:param name="axis"/>
605         <xsl:param name="beforeCodes"/>
606         <xsl:param name="afterCodes"/>
607         <xsl:variable name="str">
608             <xsl:for-each select="marc:subfield">
609                 <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])">
610                     <xsl:value-of select="text()"/>
611                     <xsl:text> </xsl:text>
612                 </xsl:if>
613             </xsl:for-each>
614         </xsl:variable>
615         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
616     </xsl:template>
617 </xsl:stylesheet>