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