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