Merge commit 'pianohacker-koha/prefs-submit' into master
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
3 <xsl:stylesheet version="1.0"
4   xmlns:marc="http://www.loc.gov/MARC21/slim"
5   xmlns:items="http://www.koha.org/items"
6   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7   exclude-result-prefixes="marc items">
8     <xsl:import href="MARC21slimUtils.xsl"/>
9     <xsl:output method = "xml" indent="yes" omit-xml-declaration = "yes" />
10     <xsl:template match="/">
11             <xsl:apply-templates/>
12     </xsl:template>
13
14     <xsl:template match="marc:record">
15
16         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
17         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
18
19     <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
20     <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
21     <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
22         <xsl:variable name="leader" select="marc:leader"/>
23         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
24         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
25         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
26         <xsl:variable name="materialTypeCode">
27             <xsl:choose>
28                 <xsl:when test="$leader6='a'">
29                     <xsl:choose>
30                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
31                         <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
32                     </xsl:choose>
33                 </xsl:when>
34                 <xsl:when test="$leader6='t'">BK</xsl:when>
35                 <xsl:when test="$leader6='p'">MX</xsl:when>
36                 <xsl:when test="$leader6='m'">CF</xsl:when>
37                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
38                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
39                 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
40             </xsl:choose>
41         </xsl:variable>
42         <xsl:variable name="materialTypeLabel">
43             <xsl:choose>
44                 <xsl:when test="$leader6='a'">
45                     <xsl:choose>
46                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
47                         <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">Continuing Resource</xsl:when>
48                     </xsl:choose>
49                 </xsl:when>
50                 <xsl:when test="$leader6='t'">Book</xsl:when>
51                 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
52                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
53                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
54                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">Visual Material</xsl:when>
55                 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">Sound</xsl:when>
56             </xsl:choose>
57         </xsl:variable>
58
59         <!-- Title Statement -->
60         <!-- Alternate Graphic Representation (MARC 880) -->
61         <xsl:if test="$display880">
62             <h1 class="title">
63                 <xsl:call-template name="m880Select">
64                     <xsl:with-param name="basetags">245</xsl:with-param>
65                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
66                 </xsl:call-template>
67             </h1>
68         </xsl:if>
69
70         <xsl:if test="marc:datafield[@tag=245]">
71         <h1>
72             <xsl:for-each select="marc:datafield[@tag=245]">
73                     <xsl:call-template name="subfieldSelect">
74                         <xsl:with-param name="codes">a</xsl:with-param>
75                     </xsl:call-template>
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:if test="marc:subfield[@code='h']">
83                         <xsl:text> </xsl:text>
84                         <xsl:call-template name="subfieldSelect">
85                             <xsl:with-param name="codes">h</xsl:with-param>
86                         </xsl:call-template>
87                     </xsl:if>
88                     <xsl:call-template name="subfieldSelect">
89                         <xsl:with-param name="codes">fgknps</xsl:with-param>
90                     </xsl:call-template>
91             </xsl:for-each>
92         </h1>
93         </xsl:if>
94
95         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
96         <xsl:if test="$display880">
97             <h5 class="author">
98                 <xsl:call-template name="m880Select">
99                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
100                     <xsl:with-param name="codes">abc</xsl:with-param>
101                     <xsl:with-param name="index">au</xsl:with-param>
102                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
103                 </xsl:call-template>
104             </h5>
105         </xsl:if>
106
107         <xsl:choose>
108         <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]">
109         <h5 class="author">by
110         <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
111         <a>
112         <xsl:choose>
113             <xsl:when test="marc:subfield[@code=9]">
114                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
115             </xsl:when>
116             <xsl:otherwise>
117             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
118             </xsl:otherwise>
119         </xsl:choose>
120         <xsl:call-template name="nameABCDQ"/></a>
121         <xsl:choose>
122         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
123         </xsl:for-each>
124
125         <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
126         <a>
127         <xsl:choose>
128             <xsl:when test="marc:subfield[@code=9]">
129                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
130             </xsl:when>
131             <xsl:otherwise>
132             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>      
133             </xsl:otherwise>
134         </xsl:choose>
135         <xsl:call-template name="nameABCDN"/></a>
136         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
137         </xsl:for-each>
138
139         <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
140         <a>
141         <xsl:choose>
142             <xsl:when test="marc:subfield[@code=9]">
143                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
144             </xsl:when>
145             <xsl:otherwise>
146             <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
147             </xsl:otherwise>
148         </xsl:choose>
149         <xsl:call-template name="nameACDEQ"/></a>
150         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
151
152         </xsl:for-each>
153         </h5>
154         </xsl:when>
155         </xsl:choose>
156
157    <xsl:if test="$DisplayOPACiconsXSLT!='0'">
158         <xsl:if test="$materialTypeCode!=''">
159         <span class="results_summary"><span class="label">Type: </span>
160         <xsl:element name="img"><xsl:attribute name="src">/opac-tmpl/prog/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
161         <xsl:value-of select="$materialTypeLabel"/>
162         </span>
163         </xsl:if>
164    </xsl:if>
165
166         <!--Series: Alternate Graphic Representation (MARC 880) -->
167         <xsl:if test="$display880">
168             <xsl:call-template name="m880Select">
169                 <xsl:with-param name="basetags">440,490</xsl:with-param>
170                 <xsl:with-param name="codes">av</xsl:with-param>
171                 <xsl:with-param name="class">results_summary</xsl:with-param>
172                 <xsl:with-param name="label">Series: </xsl:with-param>
173                 <xsl:with-param name="index">se</xsl:with-param>
174             </xsl:call-template>
175         </xsl:if>
176         
177         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
178         <span class="results_summary"><span class="label">Series: </span>
179         <xsl:for-each select="marc:datafield[@tag=440]">
180              <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
181             <xsl:call-template name="chopPunctuation">
182                             <xsl:with-param name="chopString">
183                                 <xsl:call-template name="subfieldSelect">
184                                     <xsl:with-param name="codes">av</xsl:with-param>
185                                 </xsl:call-template>
186                             </xsl:with-param>
187                         </xsl:call-template>
188                         </a>
189                     <xsl:text> </xsl:text><xsl:call-template name="part"/>
190             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
191         </xsl:for-each>
192
193         <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
194              <a href="/cgi-bin/koha/opac-search.pl?q=se:{marc:subfield[@code='a']}">
195                         <xsl:call-template name="chopPunctuation">
196                             <xsl:with-param name="chopString">
197                                 <xsl:call-template name="subfieldSelect">
198                                     <xsl:with-param name="codes">av</xsl:with-param>
199                                 </xsl:call-template>
200                             </xsl:with-param>
201                         </xsl:call-template>
202             </a>
203                     <xsl:call-template name="part"/>
204         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
205         </xsl:for-each>
206         </span>
207         </xsl:if>
208
209         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
210         <xsl:if test="$display880">
211             <xsl:call-template name="m880Select">
212                 <xsl:with-param name="basetags">260</xsl:with-param>
213                 <xsl:with-param name="codes">abcg</xsl:with-param>
214                 <xsl:with-param name="class">results_summary</xsl:with-param>
215                 <xsl:with-param name="label">Publisher: </xsl:with-param>
216             </xsl:call-template>
217         </xsl:if>
218         
219         <xsl:if test="marc:datafield[@tag=260]">
220         <span class="results_summary"><span class="label">Publisher: </span>
221             <xsl:for-each select="marc:datafield[@tag=260]">
222                 <xsl:call-template name="chopPunctuation">
223                   <xsl:with-param name="chopString">
224                     <xsl:call-template name="subfieldSelect">
225                         <xsl:with-param name="codes">bcg</xsl:with-param>
226                     </xsl:call-template>
227                    </xsl:with-param>
228                </xsl:call-template>
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         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
235         <xsl:if test="$display880">
236             <xsl:call-template name="m880Select">
237                 <xsl:with-param name="basetags">250</xsl:with-param>
238                 <xsl:with-param name="codes">ab</xsl:with-param>
239                 <xsl:with-param name="class">results_summary</xsl:with-param>
240                 <xsl:with-param name="label">Edition: </xsl:with-param>
241             </xsl:call-template>
242         </xsl:if>
243         
244         <xsl:if test="marc:datafield[@tag=250]">
245         <span class="results_summary"><span class="label">Edition: </span>
246             <xsl:for-each select="marc:datafield[@tag=250]">
247                 <xsl:call-template name="chopPunctuation">
248                   <xsl:with-param name="chopString">
249                     <xsl:call-template name="subfieldSelect">
250                         <xsl:with-param name="codes">ab</xsl:with-param>
251                     </xsl:call-template>
252                    </xsl:with-param>
253                </xsl:call-template>
254                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
255             </xsl:for-each>
256         </span>
257         </xsl:if>
258
259         <!-- Description: Alternate Graphic Representation (MARC 880) -->
260         <xsl:if test="$display880">
261             <xsl:call-template name="m880Select">
262                 <xsl:with-param name="basetags">300</xsl:with-param>
263                 <xsl:with-param name="codes">abceg</xsl:with-param>
264                 <xsl:with-param name="class">results_summary</xsl:with-param>
265                 <xsl:with-param name="label">Description: </xsl:with-param>
266             </xsl:call-template>
267         </xsl:if>
268         
269         <xsl:if test="marc:datafield[@tag=300]">
270         <span class="results_summary"><span class="label">Description: </span>
271             <xsl:for-each select="marc:datafield[@tag=300]">
272                 <xsl:call-template name="chopPunctuation">
273                   <xsl:with-param name="chopString">
274                     <xsl:call-template name="subfieldSelect">
275                         <xsl:with-param name="codes">abceg</xsl:with-param>
276                     </xsl:call-template>
277                    </xsl:with-param>
278                </xsl:call-template>
279                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
280             </xsl:for-each>
281         </span>
282        </xsl:if>
283
284        <abbr class="unapi-id" title="koha:biblionumber:{marc:datafield[@tag=999]/marc:subfield[@code='c']}" ><!-- unAPI --></abbr>
285
286        <xsl:if test="marc:datafield[@tag=020]">
287         <span class="results_summary"><span class="label">ISBN: </span>
288         <xsl:for-each select="marc:datafield[@tag=020]">
289         <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
290                 <xsl:value-of select="marc:subfield[@code='a']"/>
291                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
292         </xsl:for-each>
293         </span>
294         </xsl:if>
295
296         <xsl:if test="marc:datafield[@tag=022]">
297         <span class="results_summary"><span class="label">ISSN: </span>
298         <xsl:for-each select="marc:datafield[@tag=022]">
299                 <xsl:value-of select="marc:subfield[@code='a']"/>
300                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
301         </xsl:for-each>
302         </span>
303         </xsl:if>
304
305         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
306         <xsl:if test="$display880">
307             <xsl:call-template name="m880Select">
308                 <xsl:with-param name="basetags">246</xsl:with-param>
309                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
310                 <xsl:with-param name="class">results_summary</xsl:with-param>
311                 <xsl:with-param name="label">Other Title: </xsl:with-param>
312             </xsl:call-template>
313         </xsl:if>
314
315         <xsl:if test="marc:datafield[@tag=246]">
316         <span class="results_summary"><span class="label">Other Title: </span>
317             <xsl:for-each select="marc:datafield[@tag=246]">
318                 <xsl:call-template name="chopPunctuation">
319                   <xsl:with-param name="chopString">
320                     <xsl:call-template name="subfieldSelect">
321                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
322                     </xsl:call-template>
323                    </xsl:with-param>
324                </xsl:call-template>
325                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
326             </xsl:for-each>
327         </span>
328        </xsl:if>
329
330         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
331         <xsl:if test="$display880">
332             <xsl:call-template name="m880Select">
333                 <xsl:with-param name="basetags">130,240</xsl:with-param>
334                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
335                 <xsl:with-param name="class">results_summary</xsl:with-param>
336                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
337             </xsl:call-template>
338         </xsl:if>
339
340         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
341         <span class="results_summary"><span class="label">Uniform titles: </span>
342         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
343             <xsl:variable name="str">
344                 <xsl:for-each select="marc:subfield">
345                     <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'])))">
346                         <xsl:value-of select="text()"/>
347                         <xsl:text> </xsl:text>
348                      </xsl:if>
349                 </xsl:for-each>
350             </xsl:variable>
351             <xsl:call-template name="chopPunctuation">
352                 <xsl:with-param name="chopString">
353                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
354                         
355                 </xsl:with-param>
356             </xsl:call-template>
357             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
358         </xsl:for-each>
359         </span>
360         </xsl:if>
361
362         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
363             <span class="results_summary"><span class="label">Related Subjects: </span>
364             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
365             <a>
366             <xsl:choose>
367             <xsl:when test="marc:subfield[@code=9]">
368                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
369             </xsl:when>
370             <xsl:otherwise>
371                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
372             </xsl:otherwise>
373             </xsl:choose>
374             <xsl:call-template name="chopPunctuation">
375                 <xsl:with-param name="chopString">
376                     <xsl:call-template name="subfieldSelect">
377                         <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
378                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
379                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
380                     </xsl:call-template>
381                 </xsl:with-param>
382             </xsl:call-template>
383             </a>
384             <xsl:choose>
385             <xsl:when test="position()=last()"></xsl:when>
386             <xsl:otherwise> | </xsl:otherwise>
387             </xsl:choose>
388
389             </xsl:for-each>
390             </span>
391         </xsl:if>
392
393         <xsl:if test="marc:datafield[@tag=856]">
394         <span class="results_summary"><span class="label">Online Resources: </span>
395         <xsl:for-each select="marc:datafield[@tag=856]">
396                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
397                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
398                                     <xsl:choose>
399                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
400                                         <xsl:call-template name="subfieldSelect">
401                                         <xsl:with-param name="codes">y3z</xsl:with-param>
402                                         </xsl:call-template>
403                                     </xsl:when>
404                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
405                                         <xsl:choose>
406                                         <xsl:when test="$URLLinkText!=''">
407                                                 <xsl:value-of select="$URLLinkText"/>
408                                         </xsl:when>
409                                         <xsl:otherwise>
410                                                 <xsl:text>Click here to access online</xsl:text>
411                                         </xsl:otherwise>
412                                         </xsl:choose>
413                                     </xsl:when>
414                                     </xsl:choose>
415                                     </a>
416                               </xsl:if>
417                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
418                                    <a target='_blank'><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
419                                     <xsl:choose>
420                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
421                                         <xsl:call-template name="subfieldSelect">
422                                         <xsl:with-param name="codes">y3z</xsl:with-param>
423                                         </xsl:call-template>
424                                     </xsl:when>
425                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
426                                         <xsl:choose>
427                                         <xsl:when test="$URLLinkText!=''">
428                                                 <xsl:value-of select="$URLLinkText"/>
429                                         </xsl:when>
430                                         <xsl:otherwise>
431                                                 <xsl:text>Click here to access online</xsl:text>
432                                         </xsl:otherwise>
433                                         </xsl:choose>
434                                     </xsl:when>
435                                     </xsl:choose>
436                                     </a>
437                               </xsl:if>
438                                     <xsl:choose>
439                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
440                                     <xsl:otherwise> | </xsl:otherwise>
441                                     </xsl:choose>
442
443         </xsl:for-each>
444         </span>
445         </xsl:if>
446         <xsl:if test="marc:datafield[@tag=505]">
447         <xsl:for-each select="marc:datafield[@tag=505]">
448         <span class="results_summary"><span class="label">
449         <xsl:choose>
450         <xsl:when test="@ind1=0">
451             Contents:
452         </xsl:when>
453         <xsl:when test="@ind1=1">
454             Incomplete contents:
455         </xsl:when>
456         <xsl:when test="@ind1=1">
457             Partial contents:
458         </xsl:when>
459         </xsl:choose>  
460         </span>
461         <xsl:choose>
462         <xsl:when test="@ind2=0">
463             <xsl:for-each select="marc:subfield[@code='t']">
464                 <xsl:value-of select="marc:subfield[@code=t]"/> <xsl:value-of select="marc:subfield[@code=r]"/>
465             </xsl:for-each> 
466         </xsl:when>
467         <xsl:otherwise>
468             <xsl:call-template name="subfieldSelect">
469                 <xsl:with-param name="codes">au</xsl:with-param>
470             </xsl:call-template>
471         </xsl:otherwise>
472         </xsl:choose>
473         </span>
474         </xsl:for-each>
475         </xsl:if>
476
477         <!-- 780 -->
478         <xsl:if test="marc:datafield[@tag=780]">
479         <xsl:for-each select="marc:datafield[@tag=780]">
480         <span class="results_summary"><span class="label">
481         <xsl:choose>
482         <xsl:when test="@ind2=0">
483             Continues:
484         </xsl:when>
485         <xsl:when test="@ind2=1">
486             Continues in part:
487         </xsl:when>
488         <xsl:when test="@ind2=2">
489             Supersedes:
490         </xsl:when>
491         <xsl:when test="@ind2=3">
492             Supersedes in part:
493         </xsl:when>
494         <xsl:when test="@ind2=4">
495             Formed by the union: ... and: ...
496         </xsl:when>
497         <xsl:when test="@ind2=5">
498             Absorbed:
499         </xsl:when>
500         <xsl:when test="@ind2=6">
501             Absorbed in part:
502         </xsl:when>
503         <xsl:when test="@ind2=7">
504             Separated from:
505         </xsl:when>
506         </xsl:choose>
507         </span>
508                 <xsl:variable name="f780">
509                     <xsl:call-template name="subfieldSelect">
510                         <xsl:with-param name="codes">at</xsl:with-param>
511                     </xsl:call-template>
512                 </xsl:variable>
513              <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
514                 <xsl:value-of select="translate($f780, '()', '')"/>
515             </a>
516         </span>
517  
518         <xsl:choose>
519         <xsl:when test="@ind1=0">
520             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
521         </xsl:when>
522         </xsl:choose>
523
524         </xsl:for-each>
525         </xsl:if>
526
527         <!-- 785 -->
528         <xsl:if test="marc:datafield[@tag=785]">
529         <xsl:for-each select="marc:datafield[@tag=785]">
530         <span class="results_summary"><span class="label">
531         <xsl:choose>
532         <xsl:when test="@ind2=0">
533             Continued by:
534         </xsl:when>
535         <xsl:when test="@ind2=1">
536             Continued in part by:
537         </xsl:when>
538         <xsl:when test="@ind2=2">
539             Superseded by:
540         </xsl:when>
541         <xsl:when test="@ind2=3">
542             Superseded in part by:
543         </xsl:when>
544         <xsl:when test="@ind2=4">
545             Absorbed by:
546         </xsl:when>
547         <xsl:when test="@ind2=5">
548             Absorbed in part by:
549         </xsl:when>
550         <xsl:when test="@ind2=6">
551             Split into .. and ...:
552         </xsl:when>
553         <xsl:when test="@ind2=7">
554             Merged with ... to form ...
555         </xsl:when>
556         <xsl:when test="@ind2=8">
557             Changed back to:
558         </xsl:when>
559
560         </xsl:choose>
561         </span>
562                    <xsl:variable name="f785">
563                     <xsl:call-template name="subfieldSelect">
564                         <xsl:with-param name="codes">at</xsl:with-param>
565                     </xsl:call-template>
566                 </xsl:variable>
567
568                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
569                 <xsl:value-of select="translate($f785, '()', '')"/>
570             </a>
571
572         </span>
573         </xsl:for-each>
574         </xsl:if>
575
576     </xsl:template>
577
578     <xsl:template name="nameABCDQ">
579             <xsl:call-template name="chopPunctuation">
580                 <xsl:with-param name="chopString">
581                     <xsl:call-template name="subfieldSelect">
582                         <xsl:with-param name="codes">aq</xsl:with-param>
583                     </xsl:call-template>
584                 </xsl:with-param>
585                 <xsl:with-param name="punctuation">
586                     <xsl:text>:,;/ </xsl:text>
587                 </xsl:with-param>
588             </xsl:call-template>
589         <xsl:call-template name="termsOfAddress"/>
590     </xsl:template>
591
592     <xsl:template name="nameABCDN">
593         <xsl:for-each select="marc:subfield[@code='a']">
594                 <xsl:call-template name="chopPunctuation">
595                     <xsl:with-param name="chopString" select="."/>
596                 </xsl:call-template>
597         </xsl:for-each>
598         <xsl:for-each select="marc:subfield[@code='b']">
599                 <xsl:value-of select="."/>
600         </xsl:for-each>
601         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
602                 <xsl:call-template name="subfieldSelect">
603                     <xsl:with-param name="codes">cdn</xsl:with-param>
604                 </xsl:call-template>
605         </xsl:if>
606     </xsl:template>
607
608     <xsl:template name="nameACDEQ">
609             <xsl:call-template name="subfieldSelect">
610                 <xsl:with-param name="codes">acdeq</xsl:with-param>
611             </xsl:call-template>
612     </xsl:template>
613     <xsl:template name="termsOfAddress">
614         <xsl:if test="marc:subfield[@code='b' or @code='c']">
615             <xsl:call-template name="chopPunctuation">
616                 <xsl:with-param name="chopString">
617                     <xsl:call-template name="subfieldSelect">
618                         <xsl:with-param name="codes">bc</xsl:with-param>
619                     </xsl:call-template>
620                 </xsl:with-param>
621             </xsl:call-template>
622         </xsl:if>
623     </xsl:template>
624
625     <xsl:template name="part">
626         <xsl:variable name="partNumber">
627             <xsl:call-template name="specialSubfieldSelect">
628                 <xsl:with-param name="axis">n</xsl:with-param>
629                 <xsl:with-param name="anyCodes">n</xsl:with-param>
630                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
631             </xsl:call-template>
632         </xsl:variable>
633         <xsl:variable name="partName">
634             <xsl:call-template name="specialSubfieldSelect">
635                 <xsl:with-param name="axis">p</xsl:with-param>
636                 <xsl:with-param name="anyCodes">p</xsl:with-param>
637                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
638             </xsl:call-template>
639         </xsl:variable>
640         <xsl:if test="string-length(normalize-space($partNumber))">
641                 <xsl:call-template name="chopPunctuation">
642                     <xsl:with-param name="chopString" select="$partNumber"/>
643                 </xsl:call-template>
644         </xsl:if>
645         <xsl:if test="string-length(normalize-space($partName))">
646                 <xsl:call-template name="chopPunctuation">
647                     <xsl:with-param name="chopString" select="$partName"/>
648                 </xsl:call-template>
649         </xsl:if>
650     </xsl:template>
651
652     <xsl:template name="specialSubfieldSelect">
653         <xsl:param name="anyCodes"/>
654         <xsl:param name="axis"/>
655         <xsl:param name="beforeCodes"/>
656         <xsl:param name="afterCodes"/>
657         <xsl:variable name="str">
658             <xsl:for-each select="marc:subfield">
659                 <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])">
660                     <xsl:value-of select="text()"/>
661                     <xsl:text> </xsl:text>
662                 </xsl:if>
663             </xsl:for-each>
664         </xsl:variable>
665         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
666     </xsl:template>
667 </xsl:stylesheet>