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