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