Bug 22581: Show and play musical inscripts
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / xslt / NORMARCslim2OPACDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
6 <xsl:stylesheet version="1.0"
7   xmlns:marc="http://www.loc.gov/MARC21/slim"
8   xmlns:items="http://www.koha-community.org/items"
9   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10   xmlns:str="http://exslt.org/strings"
11   exclude-result-prefixes="marc items str">
12     <xsl:import href="NORMARCslimUtils.xsl"/>
13     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
14     <xsl:template match="/">
15             <xsl:apply-templates/>
16     </xsl:template>
17
18     <xsl:template match="marc:record">
19
20         <!-- Sysprefs -->
21         <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
22         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
23         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
24         <xsl:variable name="TracingQuotesLeft">
25           <xsl:choose>
26             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
27             <xsl:otherwise>"</xsl:otherwise>
28           </xsl:choose>
29         </xsl:variable>
30         <xsl:variable name="TracingQuotesRight">
31           <xsl:choose>
32             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
33             <xsl:otherwise>"</xsl:otherwise>
34           </xsl:choose>
35         </xsl:variable>
36         <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
37         <xsl:variable name="theme" select="marc:sysprefs/marc:syspref[@name='opacthemes']"/>
38         <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
39         <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
40         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='OPACDisplay856uAsImage']"/>
41         <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>
42         <xsl:variable name="leader" select="marc:leader"/>
43         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
44         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
45         <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
46         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
47         <xsl:variable name="field019b" select="marc:datafield[@tag=019]/marc:subfield[@code='b']"/>
48         <xsl:variable name="typeOf008">
49             <!-- The logic here should be exactly the same for NORMARCslim2intranetDetail.xsl, NORMARCslim2intranetResults.xsl, NORMARCslim2OPACDetail.xsl and NORMARCslim2OPACResults.xsl -->
50             <xsl:choose>
51                 <xsl:when test="$field019b='b' or $field019b='k' or $field019b='l' or $leader6='b'">Mon</xsl:when>
52                 <xsl:when test="$field019b='e' or contains($field019b,'ec') or contains($field019b,'ed') or contains($field019b,'ee') or contains($field019b,'ef') or $leader6='g'">FV</xsl:when>
53                 <xsl:when test="$field019b='c' or $field019b='d' or contains($field019b,'da') or contains($field019b,'db') or contains($field019b,'dc') or contains($field019b,'dd') or contains($field019b,'dg') or contains($field019b,'dh') or contains($field019b,'di') or contains($field019b,'dj') or contains($field019b,'dk') or $leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">Mus</xsl:when>
54                 <xsl:when test="$field019b='a' or contains($field019b,'ab') or contains($field019b,'aj') or $leader6='e' or $leader6='f'">Kar</xsl:when>
55                 <xsl:when test="$field019b='f' or $field019b='i' or contains($field019b,'ib') or contains($field019b,'ic') or contains($field019b,'fd') or contains($field019b,'ff') or contains($field019b,'fi') or $leader6='k'">gra</xsl:when>
56                 <xsl:when test="$field019b='g' or contains($field019b,'gb') or contains($field019b,'gd') or contains($field019b,'ge') or $leader6='m'">Fil</xsl:when>
57                 <xsl:when test="$leader6='o'">kom</xsl:when>
58                 <xsl:when test="$field019b='h' or $leader6='r'">trd</xsl:when>
59                 <xsl:when test="$field019b='j' or $leader6='a'">
60                     <xsl:choose>
61                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='m' or $leader7='p'">Mon</xsl:when>
62                         <xsl:when test="$field019b='j' or $leader7='b' or $leader7='s'">Per</xsl:when>
63                     </xsl:choose>
64                 </xsl:when>
65             </xsl:choose>
66         </xsl:variable>
67
68         <!-- Tittel og ansvarsopplysninger -->
69         <xsl:if test="marc:datafield[@tag=245]">
70         <h1 class="title">
71             <xsl:for-each select="marc:datafield[@tag=245]">
72                     <xsl:call-template name="subfieldSelect">
73                         <xsl:with-param name="codes">a</xsl:with-param>
74                     </xsl:call-template>
75                     <xsl:if test="marc:subfield[@code='h']">
76                         <xsl:text> </xsl:text>
77                         (<xsl:call-template name="subfieldSelect">
78                             <xsl:with-param name="codes">h</xsl:with-param>
79                         </xsl:call-template>)
80                     </xsl:if>
81                     <xsl:if test="marc:subfield[@code='b']">
82                         <xsl:text> : </xsl:text>
83                         <xsl:call-template name="subfieldSelect">
84                             <xsl:with-param name="codes">b</xsl:with-param>
85                         </xsl:call-template>
86                     </xsl:if>
87                     <xsl:text> </xsl:text>
88                     <xsl:call-template name="subfieldSelect">
89                         <xsl:with-param name="codes">np</xsl:with-param>
90                     </xsl:call-template>
91             </xsl:for-each>
92         </h1>
93         </xsl:if>
94
95         <!-- Author Statement -->
96                 <!-- 245$9 is Koha authority number -->
97         <xsl:choose>
98         <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]">
99         <h5 class="author">av
100         <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
101         <a>
102         <xsl:choose>
103             <xsl:when test="marc:subfield[@code=9]">
104                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
105             </xsl:when>
106             <xsl:otherwise>
107             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
108             </xsl:otherwise>
109         </xsl:choose>
110         <xsl:call-template name="nameABCDQ"/></a>
111         <xsl:if test="marc:subfield[@code=9]">
112             <a class='authlink'>
113                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
114                 <xsl:element name="img">
115                     <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
116                     <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
117                     <xsl:attribute name="height">15</xsl:attribute>
118                     <xsl:attribute name="width">15</xsl:attribute>
119                 </xsl:element>
120             </a>
121         </xsl:if>
122         <xsl:choose>
123         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
124         </xsl:for-each>
125
126         <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
127         <a>
128         <xsl:choose>
129             <xsl:when test="marc:subfield[@code=9]">
130                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
131             </xsl:when>
132             <xsl:otherwise>
133             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
134             </xsl:otherwise>
135         </xsl:choose>
136         <xsl:call-template name="nameABCDN"/></a>
137         <xsl:if test="marc:subfield[@code=9]">
138             <a class='authlink'>
139                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
140                 <xsl:element name="img">
141                     <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
142                     <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
143                     <xsl:attribute name="height">15</xsl:attribute>
144                     <xsl:attribute name="width">15</xsl:attribute>
145                 </xsl:element>
146             </a>
147         </xsl:if>
148         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
149         </xsl:for-each>
150
151         <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
152         <a>
153         <xsl:choose>
154             <xsl:when test="marc:subfield[@code=9]">
155                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
156             </xsl:when>
157             <xsl:otherwise>
158             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
159             </xsl:otherwise>
160         </xsl:choose>
161         <xsl:call-template name="nameACDEQ"/></a>
162         <xsl:if test="marc:subfield[@code=9]">
163             <a class='authlink'>
164                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
165                 <xsl:element name="img">
166                     <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
167                     <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
168                     <xsl:attribute name="height">15</xsl:attribute>
169                     <xsl:attribute name="width">15</xsl:attribute>
170                 </xsl:element>
171             </a>
172         </xsl:if>
173         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
174
175         </xsl:for-each>
176         </h5>
177         </xsl:when>
178         </xsl:choose>
179
180     <xsl:if test="$DisplayOPACiconsXSLT!='0'">
181         <xsl:if test="$typeOf008!=''">
182         <span class="results_summary">
183             <span class="label">Materialtype: </span>
184             <xsl:choose>
185                 <xsl:when test="$typeOf008='Mon'"><img src="/opac-tmpl/lib/famfamfam/BK.png" alt="Bok" title="Bok"/> Bok</xsl:when>
186                 <xsl:when test="$typeOf008='Per'"><img src="/opac-tmpl/lib/famfamfam/AR.png" alt="Periodika" title="Periodika"/> Periodika</xsl:when>
187                 <xsl:when test="$typeOf008='Fil'"><img src="/opac-tmpl/lib/famfamfam/CF.png" alt="Fil" title="Fil"/> Fil</xsl:when>
188                 <xsl:when test="$typeOf008='Kar'"><img src="/opac-tmpl/lib/famfamfam/MP.png" alt="Kart" title="Kart"/> Kart</xsl:when>
189                 <xsl:when test="$typeOf008='FV'"><img  src="/opac-tmpl/lib/famfamfam/VM.png" alt="Film og video" title="Film og video"/> Film og video</xsl:when>
190                 <xsl:when test="$typeOf008='Mus'"><img src="/opac-tmpl/lib/famfamfam/PR.png" alt="Musikktrykk og lydopptak" title="Musikktrykk og lydopptak"/> Musikk</xsl:when>
191                 <xsl:when test="$typeOf008='gra'"><img src="/opac-tmpl/lib/famfamfam/GR.png" alt="Grafisk materiale" title="Grafisk materiale"/> Grafisk materiale</xsl:when>
192                 <xsl:when test="$typeOf008='kom'"><img src="/opac-tmpl/lib/famfamfam/MX.png" alt="Kombidokumenter" title="Kombidokumenter"/> Kombidokumenter</xsl:when>
193                 <xsl:when test="$typeOf008='trd'"><img src="/opac-tmpl/lib/famfamfam/TD.png" alt="Tre-dimensjonale gjenstander" title="Tre-dimensjonale gjenstander"/> Tre-dimensjonale gjenstander</xsl:when>
194             </xsl:choose>
195         </span>
196         </xsl:if>
197     </xsl:if>
198
199         <!--Series -->
200         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
201                 <span class="results_summary"><span class="label">Series: </span>
202                 <xsl:for-each select="marc:datafield[@tag=440]">
203                     <a>
204                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
205                         <xsl:call-template name="chopPunctuation">
206                                     <xsl:with-param name="chopString">
207                                         <xsl:call-template name="subfieldSelect">
208                                             <xsl:with-param name="codes">av</xsl:with-param>
209                                         </xsl:call-template>
210                                     </xsl:with-param>
211                                 </xsl:call-template>
212                                 </a>
213                             <xsl:text> </xsl:text><xsl:call-template name="part"/>
214                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
215                 </xsl:for-each>
216
217                 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
218                     <a>
219                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
220                                 <xsl:call-template name="chopPunctuation">
221                                     <xsl:with-param name="chopString">
222                                         <xsl:call-template name="subfieldSelect">
223                                             <xsl:with-param name="codes">av</xsl:with-param>
224                                         </xsl:call-template>
225                                     </xsl:with-param>
226                                 </xsl:call-template>
227                     </a>
228                             <xsl:call-template name="part"/>
229                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
230                 </xsl:for-each>
231                 </span>
232         </xsl:if>
233
234         <!-- Analytics -->
235         <xsl:if test="$leader7='s' or $leader7='c'">
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="str:encode-uri(marc:controlfield[@tag=001], true())"/>+and+(bib-level:a+or+bib-level:b)</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="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
244             </xsl:otherwise>
245             </xsl:choose>
246             <xsl:text>Show analytics</xsl:text>
247             </a>
248         </span>
249         </xsl:if>
250
251         <!-- 773 - Links from child to parent -->
252         <xsl:if test="marc:datafield[@tag=773]">
253         <xsl:for-each select="marc:datafield[@tag=773]">
254         <xsl:if test="@ind1=0">
255         <span class="results_summary in"><span class="label">
256         <xsl:choose>
257         <xsl:when test="@ind2=' '">
258             In:
259         </xsl:when>
260         <xsl:when test="@ind2=8">
261             <xsl:if test="marc:subfield[@code='i']">
262                 <xsl:value-of select="marc:subfield[@code='i']"/>
263             </xsl:if>
264         </xsl:when>
265         </xsl:choose>
266         </span>
267                 <xsl:variable name="f773">
268                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
269                         <xsl:with-param name="codes">a_t</xsl:with-param>
270                     </xsl:call-template></xsl:with-param></xsl:call-template>
271                 </xsl:variable>
272             <xsl:choose>
273                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
274                     <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>
275                         <xsl:value-of select="translate($f773, '()', '')"/>
276                     </a>
277                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
278                 </xsl:when>
279                 <xsl:when test="marc:subfield[@code='0']">
280                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
281                         <xsl:value-of select="$f773"/>
282                     </a>
283                 </xsl:when>
284                 <xsl:otherwise>
285                     <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f773, '()', ''), true())"/></xsl:attribute>
286                         <xsl:value-of select="$f773"/>
287                     </a>
288                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
289                 </xsl:otherwise>
290             </xsl:choose>
291         </span>
292         <xsl:if test="marc:subfield[@code='n']">
293             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
294         </xsl:if>
295         </xsl:if>
296         </xsl:for-each>
297         </xsl:if>
298
299         <!-- Publisher Statement -->
300
301         <xsl:if test="marc:datafield[@tag=260]">
302         <span class="results_summary"><span class="label">Utgiver: </span>
303             <xsl:for-each select="marc:datafield[@tag=260]">
304                 <xsl:call-template name="chopPunctuation">
305                   <xsl:with-param name="chopString">
306                     <xsl:call-template name="subfieldSelect">
307                         <xsl:with-param name="codes">bcg</xsl:with-param>
308                     </xsl:call-template>
309                    </xsl:with-param>
310                </xsl:call-template>
311                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
312             </xsl:for-each>
313         </span>
314         </xsl:if>
315
316         <!-- Edition Statement -->
317
318         <xsl:if test="marc:datafield[@tag=250]">
319         <span class="results_summary"><span class="label">Utgave: </span>
320             <xsl:for-each select="marc:datafield[@tag=250]">
321                 <xsl:call-template name="chopPunctuation">
322                   <xsl:with-param name="chopString">
323                     <xsl:call-template name="subfieldSelect">
324                         <xsl:with-param name="codes">ab</xsl:with-param>
325                     </xsl:call-template>
326                    </xsl:with-param>
327                </xsl:call-template>
328                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
329             </xsl:for-each>
330         </span>
331         </xsl:if>
332
333         <!-- Description -->
334
335         <xsl:if test="marc:datafield[@tag=300]">
336         <span class="results_summary"><span class="label">Beskrivelse: </span>
337             <xsl:for-each select="marc:datafield[@tag=300]">
338                 <xsl:call-template name="chopPunctuation">
339                   <xsl:with-param name="chopString">
340                     <xsl:call-template name="subfieldSelect">
341                         <xsl:with-param name="codes">abceg</xsl:with-param>
342                     </xsl:call-template>
343                    </xsl:with-param>
344                </xsl:call-template>
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        <abbr class="unapi-id" title="koha:biblionumber:{marc:datafield[@tag=999]/marc:subfield[@code='c']}" ><!-- unAPI --></abbr>
351
352         <!-- Build ISBN -->
353         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
354           <span class="results_summary isbn"><span class="label">ISBN: </span>
355             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
356               <span property="isbn">
357                 <xsl:value-of select="."/>
358                 <xsl:choose>
359                   <xsl:when test="position()=last()">
360                     <xsl:text>.</xsl:text>
361                   </xsl:when>
362                   <xsl:otherwise>
363                     <xsl:text>; </xsl:text>
364                   </xsl:otherwise>
365                 </xsl:choose>
366               </span>
367             </xsl:for-each>
368           </span>
369         </xsl:if>
370
371         <!-- Build ISSN -->
372         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
373           <span class="results_summary issn"><span class="label">ISSN: </span>
374             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
375               <span property="issn">
376                 <xsl:value-of select="."/>
377                 <xsl:choose>
378                   <xsl:when test="position()=last()">
379                     <xsl:text>.</xsl:text>
380                   </xsl:when>
381                   <xsl:otherwise>
382                     <xsl:text>; </xsl:text>
383                   </xsl:otherwise>
384                 </xsl:choose>
385               </span>
386             </xsl:for-each>
387           </span>
388         </xsl:if>
389
390         <!-- Other Title  Statement -->
391
392         <xsl:if test="marc:datafield[@tag=246]">
393         <span class="results_summary"><span class="label">Parallelltittel: </span>
394             <xsl:for-each select="marc:datafield[@tag=246]">
395                 <xsl:call-template name="chopPunctuation">
396                   <xsl:with-param name="chopString">
397                     <xsl:call-template name="subfieldSelect">
398                         <xsl:with-param name="codes">abhfgnp</xsl:with-param>
399                     </xsl:call-template>
400                    </xsl:with-param>
401                </xsl:call-template>
402                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
403             </xsl:for-each>
404         </span>
405        </xsl:if>
406
407         <!-- Uniform Title  Statement -->
408
409         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
410         <span class="results_summary"><span class="label">Standardtittel: </span>
411         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
412             <xsl:variable name="str">
413                 <xsl:for-each select="marc:subfield">
414                     <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'])))">
415                         <xsl:value-of select="text()"/>
416                         <xsl:text> </xsl:text>
417                      </xsl:if>
418                 </xsl:for-each>
419             </xsl:variable>
420             <xsl:call-template name="chopPunctuation">
421                 <xsl:with-param name="chopString">
422                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
423
424                 </xsl:with-param>
425             </xsl:call-template>
426             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
427         </xsl:for-each>
428         </span>
429         </xsl:if>
430
431         <!-- Subjects -->
432
433         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
434             <span class="results_summary subjects"><span class="label">Emne(r): </span>
435             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
436             <a>
437             <xsl:choose>
438             <!-- Will implement this later
439                 <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
440                     <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
441                 </xsl:when>
442             -->
443             <xsl:when test="$TraceSubjectSubdivisions='1'">
444                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelect">
445                         <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
446                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
447                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
448                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
449                     </xsl:call-template>
450                 </xsl:attribute>
451             </xsl:when>
452             <xsl:otherwise>
453                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
454             </xsl:otherwise>
455             </xsl:choose>
456             <xsl:call-template name="chopPunctuation">
457                 <xsl:with-param name="chopString">
458                     <xsl:call-template name="subfieldSelect">
459                         <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
460                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
461                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
462                     </xsl:call-template>
463                 </xsl:with-param>
464             </xsl:call-template>
465             </a>
466             <xsl:if test="marc:subfield[@code=9]">
467                 <a class='authlink'>
468                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
469                     <xsl:element name="img">
470                         <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
471                         <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
472                         <xsl:attribute name="height">15</xsl:attribute>
473                         <xsl:attribute name="width">15</xsl:attribute>
474                     </xsl:element>
475                 </a>
476             </xsl:if>
477             <xsl:choose>
478             <xsl:when test="position()=last()"></xsl:when>
479             <xsl:otherwise> | </xsl:otherwise>
480             </xsl:choose>
481
482             </xsl:for-each>
483             </span>
484         </xsl:if>
485
486 <!-- Image processing code added here, takes precedence over text links including y3z text   -->
487         <xsl:if test="marc:datafield[@tag=856]">
488         <span class="results_summary online_resources"><span class="label">Online resources: </span>
489         <xsl:for-each select="marc:datafield[@tag=856]">
490             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
491             <a property="url">
492             <xsl:choose>
493               <xsl:when test="$OPACTrackClicks='track'">
494             <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
495               </xsl:when>
496               <xsl:when test="$OPACTrackClicks='anonymous'">
497             <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
498               </xsl:when>
499               <xsl:otherwise>
500                 <xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
501               </xsl:otherwise>
502             </xsl:choose>
503             <xsl:if test="$OPACURLOpenInNewWindow='1'">
504                 <xsl:attribute name="target">_blank</xsl:attribute>
505             </xsl:if>
506             <xsl:choose>
507             <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')">
508                 <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="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
509             </xsl:when>
510             <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
511                 <xsl:call-template name="subfieldSelect">
512                     <xsl:with-param name="codes">y3z</xsl:with-param>
513                 </xsl:call-template>
514             </xsl:when>
515             <xsl:when test="$URLLinkText!=''">
516                 <xsl:value-of select="$URLLinkText"/>
517             </xsl:when>
518             <xsl:otherwise>
519                 <xsl:text>Click here to access online</xsl:text>
520             </xsl:otherwise>
521             </xsl:choose>
522             </a>
523             <xsl:choose>
524             <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
525             <xsl:otherwise> | </xsl:otherwise>
526             </xsl:choose>
527         </xsl:for-each>
528         </span>
529         </xsl:if>
530
531         <!-- NORMARC does not define indicators for 505
532         <xsl:if test="marc:datafield[@tag=505]">
533         <xsl:for-each select="marc:datafield[@tag=505]">
534         <span class="results_summary"><span class="label">
535         <xsl:choose>
536         <xsl:when test="@ind1=0">
537             Contents:
538         </xsl:when>
539         <xsl:when test="@ind1=1">
540             Incomplete contents:
541         </xsl:when>
542         <xsl:when test="@ind1=1">
543             Partial contents:
544         </xsl:when>
545         </xsl:choose>
546         </span>
547         <xsl:choose>
548         <xsl:when test="@ind2=0">
549             <xsl:for-each select="marc:subfield[@code='t']">
550                 <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
551             </xsl:for-each>
552         </xsl:when>
553         <xsl:otherwise>
554             <xsl:call-template name="subfieldSelect">
555                 <xsl:with-param name="codes">au</xsl:with-param>
556             </xsl:call-template>
557         </xsl:otherwise>
558         </xsl:choose>
559         </span>
560         </xsl:for-each>
561         </xsl:if>
562         -->
563         <xsl:if test="marc:datafield[@tag=505]">
564                 <xsl:call-template name="subfieldSelect">
565                 <xsl:with-param name="codes">a</xsl:with-param>
566             </xsl:call-template>
567                 </xsl:if>
568
569         <!-- 780 -->
570         <xsl:if test="marc:datafield[@tag=780]">
571         <xsl:for-each select="marc:datafield[@tag=780]">
572         <span class="results_summary"><span class="label">
573         <xsl:choose>
574                 <xsl:when test="@ind2=0">
575                     Fortsettelse av:
576                 </xsl:when>
577                 <xsl:when test="@ind2=1">
578                     Delvis fortsettelse av:
579                 </xsl:when>
580                 <xsl:when test="@ind2=2">
581                     Avløser:
582                 </xsl:when>
583                 <xsl:when test="@ind2=3">
584                     Avløser delvis:
585                 </xsl:when>
586                 <xsl:when test="@ind2=4">
587                     Sammenslåing av: ... ; og ...
588                 </xsl:when>
589                 <xsl:when test="@ind2=5">
590                     Har tatt opp:
591                 </xsl:when>
592                 <xsl:when test="@ind2=6">
593                     Har delvis tatt opp:
594                 </xsl:when>
595                 <xsl:when test="@ind2=7">
596                     Utskilt fra:
597                 </xsl:when>
598         </xsl:choose>
599         </span>
600                 <xsl:variable name="f780">
601                     <xsl:call-template name="subfieldSelect">
602                         <xsl:with-param name="codes">a_t</xsl:with-param>
603                     </xsl:call-template>
604                 </xsl:variable>
605              <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute>
606                 <xsl:value-of select="translate($f780, '()', '')"/>
607             </a>
608         </span>
609
610         <xsl:choose>
611         <xsl:when test="@ind1=0">
612             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
613         </xsl:when>
614         </xsl:choose>
615
616         </xsl:for-each>
617         </xsl:if>
618
619         <!-- 785 -->
620         <xsl:if test="marc:datafield[@tag=785]">
621         <xsl:for-each select="marc:datafield[@tag=785]">
622         <span class="results_summary"><span class="label">
623         <xsl:choose>
624                 <xsl:when test="@ind2=0">
625                     Fortsettelse i:
626                 </xsl:when>
627                 <xsl:when test="@ind2=1">
628                     Fortsettes delvis i:
629                 </xsl:when>
630                 <xsl:when test="@ind2=2">
631                     Avløst av:
632                 </xsl:when>
633                 <xsl:when test="@ind2=3">
634                     Delvsi avløst av:
635                 </xsl:when>
636                 <xsl:when test="@ind2=4">
637                     Gått inn i:
638                 </xsl:when>
639                 <xsl:when test="@ind2=5">
640                     Delvis gått inn i:
641                 </xsl:when>
642                 <xsl:when test="@ind2=6">
643                     Fortsettes av: ...; og ...
644                 </xsl:when>
645                 <xsl:when test="@ind2=7">
646                         Slått sammen med: .., til: ...
647                 </xsl:when>
648         </xsl:choose>
649         </span>
650                    <xsl:variable name="f785">
651                     <xsl:call-template name="subfieldSelect">
652                         <xsl:with-param name="codes">a_t</xsl:with-param>
653                     </xsl:call-template>
654                 </xsl:variable>
655
656                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute>
657                 <xsl:value-of select="translate($f785, '()', '')"/>
658             </a>
659
660         </span>
661         </xsl:for-each>
662         </xsl:if>
663
664         <xsl:variable name="OPACShowMusicalInscripts" select="marc:sysprefs/marc:syspref[@name='OPACShowMusicalInscripts']" />
665         <xsl:variable name="OPACPlayMusicalInscripts" select="marc:sysprefs/marc:syspref[@name='OPACPlayMusicalInscripts']" />
666
667         <xsl:if test="$OPACShowMusicalInscripts and marc:datafield[@tag=031]">
668             <xsl:for-each select="marc:datafield[@tag=031]">
669
670                 <span class="results_summary musical_inscripts">
671                     <xsl:if test="marc:subfield[@code='u']">
672                         <span class="uri">
673                             <a>
674                                 <xsl:attribute name="href">
675                                     <xsl:value-of select="marc:subfield[@code='u']"/>
676                                 </xsl:attribute>
677                                 <xsl:text>Audio file</xsl:text>
678                             </a>
679                         </span>
680                     </xsl:if>
681                     <xsl:if test="marc:subfield[@code='2'] and marc:subfield[@code='2']/text() = 'pe' and marc:subfield[@code='g'] and marc:subfield[@code='n'] and marc:subfield[@code='o'] and marc:subfield[@code='p']">
682                         <div class="inscript" data-system="pae">
683                             <xsl:attribute name="data-clef">
684                                 <xsl:value-of select="marc:subfield[@code='g']"/>
685                             </xsl:attribute>
686                             <xsl:attribute name="data-keysig">
687                                 <xsl:value-of select="marc:subfield[@code='n']"/>
688                             </xsl:attribute>
689                             <xsl:attribute name="data-timesig">
690                                 <xsl:value-of select="marc:subfield[@code='o']"/>
691                             </xsl:attribute>
692                             <xsl:attribute name="data-notation">
693                                 <xsl:value-of select="marc:subfield[@code='p']"/>
694                             </xsl:attribute>
695                         </div>
696                         <xsl:if test="$OPACPlayMusicalInscripts = 1">
697                             <div class="audio_controls">
698                                 <button class="btn play_btn">
699                                     <i id="carticon" class="fa fa-play"></i>
700                                     <xsl:text> Play this sample</xsl:text>
701                                 </button>
702                             </div>
703                         </xsl:if>
704                     </xsl:if>
705                 </span>
706             </xsl:for-each>
707             <xsl:if test="$OPACPlayMusicalInscripts = 1">
708                 <div class="results_summary">
709                     <span class="inscript_audio hide"></span>
710                 </div>
711             </xsl:if>
712         </xsl:if>
713
714     </xsl:template>
715
716     <xsl:template name="part">
717         <xsl:variable name="partNumber">
718             <xsl:call-template name="specialSubfieldSelect">
719                 <xsl:with-param name="axis">n</xsl:with-param>
720                 <xsl:with-param name="anyCodes">n</xsl:with-param>
721                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
722             </xsl:call-template>
723         </xsl:variable>
724         <xsl:variable name="partName">
725             <xsl:call-template name="specialSubfieldSelect">
726                 <xsl:with-param name="axis">p</xsl:with-param>
727                 <xsl:with-param name="anyCodes">p</xsl:with-param>
728                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
729             </xsl:call-template>
730         </xsl:variable>
731         <xsl:if test="string-length(normalize-space($partNumber))">
732                 <xsl:call-template name="chopPunctuation">
733                     <xsl:with-param name="chopString" select="$partNumber"/>
734                 </xsl:call-template>
735         </xsl:if>
736         <xsl:if test="string-length(normalize-space($partName))">
737                 <xsl:call-template name="chopPunctuation">
738                     <xsl:with-param name="chopString" select="$partName"/>
739                 </xsl:call-template>
740         </xsl:if>
741     </xsl:template>
742
743     <xsl:template name="specialSubfieldSelect">
744         <xsl:param name="anyCodes"/>
745         <xsl:param name="axis"/>
746         <xsl:param name="beforeCodes"/>
747         <xsl:param name="afterCodes"/>
748         <xsl:variable name="str">
749             <xsl:for-each select="marc:subfield">
750                 <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])">
751                     <xsl:value-of select="text()"/>
752                     <xsl:text> </xsl:text>
753                 </xsl:if>
754             </xsl:for-each>
755         </xsl:variable>
756         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
757     </xsl:template>
758 </xsl:stylesheet>