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