6fee4fb4dfec338d7ebc0263d8f3dd8aa8cafe03
[koha.git] / koha-tmpl / opac-tmpl / prog / en / xslt / UNIMARCslim2OPACDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <xsl:stylesheet version="1.0"
6   xmlns:marc="http://www.loc.gov/MARC21/slim"
7   xmlns:items="http://www.koha-community.org/items"
8   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9   exclude-result-prefixes="marc items">
10
11 <xsl:import href="UNIMARCslimUtils.xsl"/>
12 <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" />
13 <xsl:template match="/">
14   <xsl:apply-templates/>
15 </xsl:template>
16
17 <xsl:template match="marc:record">
18   <xsl:variable name="leader" select="marc:leader"/>
19   <xsl:variable name="leader6" select="substring($leader,7,1)"/>
20   <xsl:variable name="leader7" select="substring($leader,8,1)"/>
21   <xsl:variable name="biblionumber" select="marc:datafield[@tag=090]/marc:subfield[@code='a']"/>
22   <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
23   <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
24   <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
25
26   <xsl:if test="marc:datafield[@tag=200]">
27     <xsl:for-each select="marc:datafield[@tag=200]">
28       <h1 class="title">
29         <xsl:call-template name="addClassRtl" />
30         <xsl:for-each select="marc:subfield">
31           <xsl:choose>
32             <xsl:when test="@code='a'">
33               <xsl:variable name="title" select="."/>
34               <xsl:variable name="ntitle"
35                select="translate($title, '&#x0088;&#x0089;&#x0098;&#x009C;','')"/>
36               <xsl:value-of select="$ntitle" />
37             </xsl:when>
38             <xsl:when test="@code='b'">
39               <xsl:text> [</xsl:text>
40               <xsl:value-of select="."/>
41               <xsl:text>]</xsl:text>
42             </xsl:when>
43             <xsl:when test="@code='d'">
44               <xsl:text> = </xsl:text>
45               <xsl:value-of select="."/>
46             </xsl:when>
47             <xsl:when test="@code='e'">
48               <xsl:text> : </xsl:text>
49               <xsl:value-of select="."/>
50             </xsl:when>
51             <xsl:when test="@code='f'">
52               <xsl:text> / </xsl:text>
53               <xsl:value-of select="."/>
54             </xsl:when>
55             <xsl:when test="@code='g'">
56               <xsl:text> ; </xsl:text>
57               <xsl:value-of select="."/>
58             </xsl:when>
59             <xsl:otherwise>
60               <xsl:text>, </xsl:text>
61               <xsl:value-of select="."/>
62             </xsl:otherwise>
63           </xsl:choose>
64         </xsl:for-each>
65       </h1>
66     </xsl:for-each>
67   </xsl:if>
68
69   <xsl:call-template name="tag_title">
70     <xsl:with-param name="tag">454</xsl:with-param>
71     <xsl:with-param name="label">Translation of</xsl:with-param>
72   </xsl:call-template>
73
74   <xsl:call-template name="tag_title">
75     <xsl:with-param name="tag">461</xsl:with-param>
76     <xsl:with-param name="label">Set Level</xsl:with-param>
77   </xsl:call-template>
78
79   <xsl:call-template name="tag_title">
80     <xsl:with-param name="tag">464</xsl:with-param>
81     <xsl:with-param name="label">Piece-Analytic Level</xsl:with-param>
82   </xsl:call-template>
83
84   <xsl:call-template name="tag_7xx">
85     <xsl:with-param name="tag">700</xsl:with-param>
86     <xsl:with-param name="label">Main Author</xsl:with-param>
87   </xsl:call-template>
88
89   <xsl:call-template name="tag_7xx">
90     <xsl:with-param name="tag">710</xsl:with-param>
91     <xsl:with-param name="label">Corporate Author (Main)</xsl:with-param>
92   </xsl:call-template>
93
94   <xsl:call-template name="tag_7xx">
95     <xsl:with-param name="tag">701</xsl:with-param>
96     <xsl:with-param name="label">Coauthor</xsl:with-param>
97   </xsl:call-template>
98
99   <xsl:call-template name="tag_7xx">
100     <xsl:with-param name="tag">702</xsl:with-param>
101     <xsl:with-param name="label">Secondary Author</xsl:with-param>
102   </xsl:call-template>
103
104   <xsl:call-template name="tag_7xx">
105     <xsl:with-param name="tag">711</xsl:with-param>
106     <xsl:with-param name="label">Corporate Author (Coauthor)</xsl:with-param>
107   </xsl:call-template>
108
109   <xsl:call-template name="tag_7xx">
110     <xsl:with-param name="tag">712</xsl:with-param>
111     <xsl:with-param name="label">Corporate Author (Secondary)</xsl:with-param>
112   </xsl:call-template>
113
114   <xsl:call-template name="tag_title">
115     <xsl:with-param name="tag">500</xsl:with-param>
116     <xsl:with-param name="label">Uniform Title</xsl:with-param>
117   </xsl:call-template>
118
119   <xsl:call-template name="tag_title">
120     <xsl:with-param name="tag">503</xsl:with-param>
121     <xsl:with-param name="label">Uniform Conventional Heading</xsl:with-param>
122   </xsl:call-template>
123
124   <xsl:if test="marc:datafield[@tag=101]">
125     <span class="results_summary">
126       <span class="label">Language:</span>
127       <xsl:for-each select="marc:datafield[@tag=101]">
128         <xsl:for-each select="marc:subfield">
129           <xsl:choose>
130             <xsl:when test="@code='b'">of intermediate text, </xsl:when>
131             <xsl:when test="@code='c'">of original work, </xsl:when>
132             <xsl:when test="@code='d'">of summary, </xsl:when>
133             <xsl:when test="@code='e'">of contents page, </xsl:when>
134             <xsl:when test="@code='f'">of title page, </xsl:when>
135             <xsl:when test="@code='g'">of title proper, </xsl:when>
136             <xsl:when test="@code='h'">of libretto, </xsl:when>
137             <xsl:when test="@code='i'">of accompanying material, </xsl:when>
138             <xsl:when test="@code='j'">of subtitles, </xsl:when>
139           </xsl:choose>
140           <xsl:value-of select="text()"/>
141           <xsl:choose>
142             <xsl:when test="position()=last()">
143               <xsl:text>.</xsl:text>
144             </xsl:when>
145             <xsl:otherwise>
146               <xsl:text> ; </xsl:text>
147             </xsl:otherwise>
148           </xsl:choose>
149         </xsl:for-each>
150       </xsl:for-each>
151     </span>
152   </xsl:if>
153
154   <xsl:if test="marc:datafield[@tag=102]">
155           <span class="results_summary">
156       <span class="label">Country: </span>
157       <xsl:for-each select="marc:datafield[@tag=102]">
158         <xsl:for-each select="marc:subfield">
159           <xsl:value-of select="text()"/>
160           <xsl:choose>
161             <xsl:when test="position()=last()">
162               <xsl:text>.</xsl:text>
163             </xsl:when>
164               <xsl:otherwise><xsl:text>, </xsl:text>
165             </xsl:otherwise>
166           </xsl:choose>
167         </xsl:for-each>
168       </xsl:for-each>
169     </span>
170   </xsl:if>
171
172   <xsl:call-template name="tag_comma">
173     <xsl:with-param name="tag">205</xsl:with-param>
174     <xsl:with-param name="label">Edition Statement</xsl:with-param>
175   </xsl:call-template>
176
177   <xsl:call-template name="tag_210" />
178
179   <xsl:call-template name="tag_215" />
180
181   <xsl:if test="marc:datafield[@tag=010]/marc:subfield[@code='a']">
182     <span class="results_summary"><span class="label">ISBN: </span>
183     <xsl:for-each select="marc:datafield[@tag=010]">
184       <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
185       <xsl:value-of select="marc:subfield[@code='a']"/>
186       <xsl:choose>
187         <xsl:when test="position()=last()">
188           <xsl:text>.</xsl:text>
189         </xsl:when>
190         <xsl:otherwise>
191           <xsl:text> ; </xsl:text>
192         </xsl:otherwise>
193       </xsl:choose>
194     </xsl:for-each>
195     </span>
196   </xsl:if>
197
198   <xsl:if test="marc:datafield[@tag=011]">
199     <span class="results_summary">
200       <span class="label">ISSN: </span>
201       <xsl:for-each select="marc:datafield[@tag=011]">
202         <xsl:value-of select="marc:subfield[@code='a']"/>
203         <xsl:choose>
204           <xsl:when test="position()=last()">
205             <xsl:text>.</xsl:text>
206           </xsl:when>
207           <xsl:otherwise>
208             <xsl:text>; </xsl:text>
209           </xsl:otherwise>
210         </xsl:choose>
211       </xsl:for-each>
212     </span>
213   </xsl:if>
214
215   <xsl:call-template name="tag_title">
216     <xsl:with-param name="tag">225</xsl:with-param>
217     <xsl:with-param name="label">Series</xsl:with-param>
218   </xsl:call-template>
219
220   <xsl:if test="marc:datafield[@tag=676]">
221     <span class="results_summary">
222     <span class="label">Dewey: </span>
223       <xsl:for-each select="marc:datafield[@tag=676]">
224         <xsl:value-of select="marc:subfield[@code='a']"/>
225         <xsl:if test="marc:subfield[@code='v']">
226           <xsl:text>, </xsl:text>
227           <xsl:value-of select="marc:subfield[@code='v']"/>
228         </xsl:if>
229         <xsl:if test="marc:subfield[@code='z']">
230           <xsl:text>, </xsl:text>
231           <xsl:value-of select="marc:subfield[@code='z']"/>
232         </xsl:if>
233         <xsl:if test="not (position()=last())">
234           <xsl:text> ; </xsl:text>
235         </xsl:if>
236       </xsl:for-each>
237     </span>
238   </xsl:if>
239
240   <xsl:if test="marc:datafield[@tag=686]">
241     <span class="results_summary">
242     <span class="label">Classification: </span>
243       <xsl:for-each select="marc:datafield[@tag=686]">
244         <xsl:value-of select="marc:subfield[@code='a']"/>
245         <xsl:if test="marc:subfield[@code='b']">
246           <xsl:text>, </xsl:text>
247           <xsl:value-of select="marc:subfield[@code='b']"/>
248         </xsl:if>
249         <xsl:if test="marc:subfield[@code='c']">
250           <xsl:text>, </xsl:text>
251           <xsl:value-of select="marc:subfield[@code='c']"/>
252         </xsl:if>
253         <xsl:if test="not (position()=last())"><xsl:text> ; </xsl:text></xsl:if>
254       </xsl:for-each>
255     </span>
256   </xsl:if>
257
258   <xsl:if test="marc:datafield[@tag=327]">
259     <span class="results_summary">
260       <span class="label">Contents note: </span>
261       <xsl:for-each select="marc:datafield[@tag=327]">
262         <xsl:call-template name="chopPunctuation">
263           <xsl:with-param name="chopString">
264             <xsl:call-template name="subfieldSelect">
265                 <xsl:with-param name="codes">abcdjpvxyz</xsl:with-param>
266                 <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param>
267                 <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
268             </xsl:call-template>
269           </xsl:with-param>
270         </xsl:call-template>
271       </xsl:for-each>
272     </span>
273   </xsl:if>
274
275   <xsl:if test="marc:datafield[@tag=330]">
276     <span class="results_summary">
277       <span class="label">Abstract: </span>
278       <xsl:for-each select="marc:datafield[@tag=330]">
279         <xsl:value-of select="marc:subfield[@code='a']"/>
280         <xsl:choose>
281           <xsl:when test="position()=last()">
282             <xsl:text>.</xsl:text>
283           </xsl:when>
284           <xsl:otherwise>
285             <xsl:text>; </xsl:text>
286           </xsl:otherwise>
287         </xsl:choose>
288       </xsl:for-each>
289     </span>
290   </xsl:if>
291
292   <xsl:if test="marc:datafield[@tag=317]">
293     <span class="results_summary">
294       <span class="label">Provenance note: </span>
295       <xsl:for-each select="marc:datafield[@tag=317]">
296           <xsl:value-of select="marc:subfield[@code='a']"/>
297       </xsl:for-each>
298     </span>
299   </xsl:if>
300
301   <xsl:if test="marc:datafield[@tag=320]">
302     <span class="results_summary">
303       <span class="label">Bibliography: </span>
304       <xsl:for-each select="marc:datafield[@tag=320]">
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=328]">
312     <span class="results_summary">
313       <span class="label">Thesis: </span>
314       <xsl:for-each select="marc:datafield[@tag=328]">
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=333]">
322     <span class="results_summary">
323       <span class="label">Audience: </span>
324       <xsl:for-each select="marc:datafield[@tag=333]">
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=955]">
332     <span class="results_summary">
333       <span class="label">SUDOC serial history: </span>
334       <xsl:for-each select="marc:datafield[@tag=955]">
335         <xsl:value-of select="marc:subfield[@code='9']"/>:
336         <xsl:value-of select="marc:subfield[@code='r']"/>
337         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
338       </xsl:for-each>
339     </span>
340   </xsl:if>
341
342   <xsl:call-template name="tag_subject">
343     <xsl:with-param name="tag">600</xsl:with-param>
344     <xsl:with-param name="label">Subject - Personal Name</xsl:with-param>
345   </xsl:call-template>
346
347   <xsl:call-template name="tag_subject">
348     <xsl:with-param name="tag">601</xsl:with-param>
349     <xsl:with-param name="label">Subject - Corporate Author</xsl:with-param>
350   </xsl:call-template>
351
352   <xsl:call-template name="tag_subject">
353     <xsl:with-param name="tag">602</xsl:with-param>
354     <xsl:with-param name="label">Subject - Family</xsl:with-param>
355   </xsl:call-template>
356
357   <xsl:call-template name="tag_subject">
358     <xsl:with-param name="tag">604</xsl:with-param>
359     <xsl:with-param name="label">Subject - Author/Title</xsl:with-param>
360   </xsl:call-template>
361
362   <xsl:call-template name="tag_subject">
363     <xsl:with-param name="tag">606</xsl:with-param>
364     <xsl:with-param name="label">Subject - Topical Name</xsl:with-param>
365   </xsl:call-template>
366
367   <xsl:call-template name="tag_subject">
368     <xsl:with-param name="tag">607</xsl:with-param>
369     <xsl:with-param name="label">Subject - Geographical Name</xsl:with-param>
370   </xsl:call-template>
371
372   <xsl:call-template name="tag_subject">
373     <xsl:with-param name="tag">608</xsl:with-param>
374     <xsl:with-param name="label">Subject - Form</xsl:with-param>
375   </xsl:call-template>
376
377   <xsl:call-template name="tag_subject">
378     <xsl:with-param name="tag">610</xsl:with-param>
379     <xsl:with-param name="label">Subject</xsl:with-param>
380   </xsl:call-template>
381
382   <xsl:call-template name="tag_subject">
383     <xsl:with-param name="tag">615</xsl:with-param>
384     <xsl:with-param name="label">Subject Category</xsl:with-param>
385   </xsl:call-template>
386
387   <xsl:call-template name="tag_subject">
388     <xsl:with-param name="tag">616</xsl:with-param>
389     <xsl:with-param name="label">Trademark</xsl:with-param>
390   </xsl:call-template>
391
392   <xsl:if test="marc:datafield[@tag=856]">
393     <span class="results_summary">
394       <span class="label">Online Resources:</span>
395       <xsl:for-each select="marc:datafield[@tag=856]">
396         <a>
397           <xsl:attribute name="href">
398             <xsl:value-of select="marc:subfield[@code='u']"/>
399           </xsl:attribute>
400           <xsl:if test="$OPACURLOpenInNewWindow='1'">
401             <xsl:attribute name="target">_blank</xsl:attribute>
402           </xsl:if>
403           <xsl:choose>
404             <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
405               <xsl:call-template name="subfieldSelect">
406                 <xsl:with-param name="codes">y3z</xsl:with-param>
407               </xsl:call-template>
408             </xsl:when>
409             <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
410               <xsl:choose>
411                 <xsl:when test="$URLLinkText!=''">
412                   <xsl:value-of select="$URLLinkText"/>
413                 </xsl:when>
414                 <xsl:otherwise>
415                   <xsl:text>Click here to access online</xsl:text>
416                 </xsl:otherwise>
417               </xsl:choose>
418             </xsl:when>
419           </xsl:choose>
420         </a>
421         <xsl:choose>
422           <xsl:when test="position()=last()"></xsl:when>
423           <xsl:otherwise> | </xsl:otherwise>
424         </xsl:choose>
425       </xsl:for-each>
426     </span>
427   </xsl:if>
428
429         <!-- 780 -->
430         <xsl:if test="marc:datafield[@tag=780]">
431         <xsl:for-each select="marc:datafield[@tag=780]">
432         <span class="results_summary">
433         <xsl:choose>
434         <xsl:when test="@ind2=0">
435             <span class="label">Continues:</span>
436         </xsl:when>
437         <xsl:when test="@ind2=1">
438             <span class="label">Continues in part:</span>
439         </xsl:when>
440         <xsl:when test="@ind2=2">
441             <span class="label">Supersedes:</span>
442         </xsl:when>
443         <xsl:when test="@ind2=3">
444             <span class="label">Supersedes in part:</span>
445         </xsl:when>
446         <xsl:when test="@ind2=4">
447             <span class="label">Formed by the union: ... and: ...</span>
448         </xsl:when>
449         <xsl:when test="@ind2=5">
450             <span class="label">Absorbed:</span>
451         </xsl:when>
452         <xsl:when test="@ind2=6">
453             <span class="label">Absorbed in part:</span>
454         </xsl:when>
455         <xsl:when test="@ind2=7">
456             <span class="label">Separated from:</span>
457         </xsl:when>
458         </xsl:choose>
459                 <xsl:variable name="f780">
460                     <xsl:call-template name="subfieldSelect">
461                         <xsl:with-param name="codes">a_t</xsl:with-param>
462                     </xsl:call-template>
463                 </xsl:variable>
464              <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
465                 <xsl:value-of select="translate($f780, '()', '')"/>
466             </a>
467         </span>
468
469         <xsl:choose>
470         <xsl:when test="@ind1=0">
471             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
472         </xsl:when>
473         </xsl:choose>
474
475         </xsl:for-each>
476         </xsl:if>
477
478         <!-- 785 -->
479         <xsl:if test="marc:datafield[@tag=785]">
480         <xsl:for-each select="marc:datafield[@tag=785]">
481         <span class="results_summary">
482         <xsl:choose>
483         <xsl:when test="@ind2=0">
484             <span class="label">Continued by:</span>
485         </xsl:when>
486         <xsl:when test="@ind2=1">
487             <span class="label">Continued in part by:</span>
488         </xsl:when>
489         <xsl:when test="@ind2=2">
490             <span class="label">Superseded by:</span>
491         </xsl:when>
492         <xsl:when test="@ind2=3">
493             <span class="label">Superseded in part by:</span>
494         </xsl:when>
495         <xsl:when test="@ind2=4">
496             <span class="label">Absorbed by:</span>
497         </xsl:when>
498         <xsl:when test="@ind2=5">
499             <span class="label">Absorbed in part by:</span>
500         </xsl:when>
501         <xsl:when test="@ind2=6">
502             <span class="label">Split into .. and ...:</span>
503         </xsl:when>
504         <xsl:when test="@ind2=7">
505             <span class="label">Merged with ... to form ...</span>
506         </xsl:when>
507         <xsl:when test="@ind2=8">
508             <span class="label">Changed back to:</span>
509         </xsl:when>
510
511         </xsl:choose>
512                    <xsl:variable name="f785">
513                     <xsl:call-template name="subfieldSelect">
514                         <xsl:with-param name="codes">a_t</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
618 </xsl:stylesheet>