e2ef08ccce22d84371ba729bb3ecf84fdaf2e47f
[koha_fer] / koha-tmpl / opac-tmpl / bootstrap / 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" encoding="UTF-8"/>
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 </xsl:template>
429
430     <xsl:template name="nameABCDQ">
431             <xsl:call-template name="chopPunctuation">
432                 <xsl:with-param name="chopString">
433                     <xsl:call-template name="subfieldSelect">
434                         <xsl:with-param name="codes">aq</xsl:with-param>
435                     </xsl:call-template>
436                 </xsl:with-param>
437                 <xsl:with-param name="punctuation">
438                     <xsl:text>:,;/ </xsl:text>
439                 </xsl:with-param>
440             </xsl:call-template>
441         <xsl:call-template name="termsOfAddress"/>
442     </xsl:template>
443
444     <xsl:template name="nameABCDN">
445         <xsl:for-each select="marc:subfield[@code='a']">
446                 <xsl:call-template name="chopPunctuation">
447                     <xsl:with-param name="chopString" select="."/>
448                 </xsl:call-template>
449         </xsl:for-each>
450         <xsl:for-each select="marc:subfield[@code='b']">
451                 <xsl:value-of select="."/>
452         </xsl:for-each>
453         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
454                 <xsl:call-template name="subfieldSelect">
455                     <xsl:with-param name="codes">cdn</xsl:with-param>
456                 </xsl:call-template>
457         </xsl:if>
458     </xsl:template>
459
460     <xsl:template name="nameACDEQ">
461             <xsl:call-template name="subfieldSelect">
462                 <xsl:with-param name="codes">acdeq</xsl:with-param>
463             </xsl:call-template>
464     </xsl:template>
465     <xsl:template name="termsOfAddress">
466         <xsl:if test="marc:subfield[@code='b' or @code='c']">
467             <xsl:call-template name="chopPunctuation">
468                 <xsl:with-param name="chopString">
469                     <xsl:call-template name="subfieldSelect">
470                         <xsl:with-param name="codes">bc</xsl:with-param>
471                     </xsl:call-template>
472                 </xsl:with-param>
473             </xsl:call-template>
474         </xsl:if>
475     </xsl:template>
476
477     <xsl:template name="part">
478         <xsl:variable name="partNumber">
479             <xsl:call-template name="specialSubfieldSelect">
480                 <xsl:with-param name="axis">n</xsl:with-param>
481                 <xsl:with-param name="anyCodes">n</xsl:with-param>
482                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
483             </xsl:call-template>
484         </xsl:variable>
485         <xsl:variable name="partName">
486             <xsl:call-template name="specialSubfieldSelect">
487                 <xsl:with-param name="axis">p</xsl:with-param>
488                 <xsl:with-param name="anyCodes">p</xsl:with-param>
489                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
490             </xsl:call-template>
491         </xsl:variable>
492         <xsl:if test="string-length(normalize-space($partNumber))">
493                 <xsl:call-template name="chopPunctuation">
494                     <xsl:with-param name="chopString" select="$partNumber"/>
495                 </xsl:call-template>
496         </xsl:if>
497         <xsl:if test="string-length(normalize-space($partName))">
498                 <xsl:call-template name="chopPunctuation">
499                     <xsl:with-param name="chopString" select="$partName"/>
500                 </xsl:call-template>
501         </xsl:if>
502     </xsl:template>
503
504     <xsl:template name="specialSubfieldSelect">
505         <xsl:param name="anyCodes"/>
506         <xsl:param name="axis"/>
507         <xsl:param name="beforeCodes"/>
508         <xsl:param name="afterCodes"/>
509         <xsl:variable name="str">
510             <xsl:for-each select="marc:subfield">
511                 <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])">
512                     <xsl:value-of select="text()"/>
513                     <xsl:text> </xsl:text>
514                 </xsl:if>
515             </xsl:for-each>
516         </xsl:variable>
517         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
518     </xsl:template>
519
520 </xsl:stylesheet>