9c1862ef98b515208fd310a6b8e8bdf1513d743c
[koha_gimpoz] / 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         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
23         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
24         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
25
26         <xsl:variable name="leader" select="marc:leader"/>
27         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
28         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
29         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
30         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
31         <xsl:variable name="materialTypeCode">
32             <xsl:choose>
33                 <xsl:when test="$leader19='a'">ST</xsl:when>
34                 <xsl:when test="$leader6='a'">
35                     <xsl:choose>
36                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
37                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
38                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
39                     </xsl:choose>
40                 </xsl:when>
41                 <xsl:when test="$leader6='t'">BK</xsl:when>
42                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
43                 <xsl:when test="$leader6='m'">CF</xsl:when>
44                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
45                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
46                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
47                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
48             </xsl:choose>
49         </xsl:variable>
50         <xsl:variable name="materialTypeLabel">
51             <xsl:choose>
52                 <xsl:when test="$leader19='a'">Set</xsl:when>
53                 <xsl:when test="$leader6='a'">
54                     <xsl:choose>
55                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
56                         <xsl:when test="$leader7='i' or $leader7='s'">
57                             <xsl:choose>
58                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing Resource</xsl:when>
59                                 <xsl:otherwise>Series</xsl:otherwise>
60                             </xsl:choose>
61                         </xsl:when>
62                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
63                     </xsl:choose>
64                 </xsl:when>
65                 <xsl:when test="$leader6='t'">Book</xsl:when>
66                 <xsl:when test="$leader6='o'">Kit</xsl:when>                            
67                 <xsl:when test="$leader6='p'">Mixed Materials</xsl:when>
68                 <xsl:when test="$leader6='m'">Computer File</xsl:when>
69                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
70                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual Material</xsl:when>
71                 <xsl:when test="$leader6='j'">Music</xsl:when>
72                 <xsl:when test="$leader6='i'">Sound</xsl:when>
73                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
74             </xsl:choose>
75         </xsl:variable>
76
77         <!-- Title Statement -->
78         <!-- Alternate Graphic Representation (MARC 880) -->
79         <xsl:if test="$display880">
80             <h1 class="title">
81                 <xsl:call-template name="m880Select">
82                     <xsl:with-param name="basetags">245</xsl:with-param>
83                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
84                 </xsl:call-template>
85             </h1>
86         </xsl:if>
87
88         <xsl:if test="marc:datafield[@tag=245]">
89         <h1>
90             <xsl:for-each select="marc:datafield[@tag=245]">
91                     <xsl:call-template name="subfieldSelect">
92                         <xsl:with-param name="codes">a</xsl:with-param>
93                     </xsl:call-template>
94                     <xsl:if test="marc:subfield[@code='b']">
95                         <xsl:text> </xsl:text>
96                         <xsl:call-template name="subfieldSelect">
97                             <xsl:with-param name="codes">b</xsl:with-param>
98                         </xsl:call-template>
99                     </xsl:if>
100                     <xsl:if test="marc:subfield[@code='h']">
101                         <xsl:text> </xsl:text>
102                         <xsl:call-template name="subfieldSelect">
103                             <xsl:with-param name="codes">h</xsl:with-param>
104                         </xsl:call-template>
105                     </xsl:if>
106                     <xsl:text> </xsl:text>
107                     <xsl:call-template name="subfieldSelect">
108                         <xsl:with-param name="codes">fgknps</xsl:with-param>
109                     </xsl:call-template>
110             </xsl:for-each>
111         </h1>
112         </xsl:if>
113
114         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
115         <xsl:if test="$display880">
116             <h5 class="author">
117                 <xsl:call-template name="m880Select">
118                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
119                     <xsl:with-param name="codes">abc</xsl:with-param>
120                     <xsl:with-param name="index">au</xsl:with-param>
121                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
122                 </xsl:call-template>
123             </h5>
124         </xsl:if>
125
126         <!-- Author Statement -->
127         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
128         <xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
129
130    <xsl:if test="$materialTypeCode!=''">
131         <span class="results_summary"><span class="label">Type: </span>
132         <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>
133         <xsl:text> </xsl:text>
134         <xsl:value-of select="$materialTypeLabel"/>
135         </span>
136    </xsl:if>
137
138         <!--Series: Alternate Graphic Representation (MARC 880) -->
139         <xsl:if test="$display880">
140             <xsl:call-template name="m880Select">
141                 <xsl:with-param name="basetags">440,490</xsl:with-param>
142                 <xsl:with-param name="codes">av</xsl:with-param>
143                 <xsl:with-param name="class">results_summary</xsl:with-param>
144                 <xsl:with-param name="label">Series: </xsl:with-param>
145                 <xsl:with-param name="index">se</xsl:with-param>
146             </xsl:call-template>
147         </xsl:if>
148         
149         <!-- Series -->
150         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
151         <span class="results_summary"><span class="label">Series: </span>
152         <!-- 440 -->
153         <xsl:for-each select="marc:datafield[@tag=440]">
154              <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
155             <xsl:call-template name="chopPunctuation">
156                             <xsl:with-param name="chopString">
157                                 <xsl:call-template name="subfieldSelect">
158                                     <xsl:with-param name="codes">av</xsl:with-param>
159                                 </xsl:call-template>
160                             </xsl:with-param>
161                         </xsl:call-template>
162                         </a>
163                     <xsl:text> </xsl:text><xsl:call-template name="part"/>
164             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
165         </xsl:for-each>
166
167         <!-- 490 Series not traced, Ind1 = 0 -->
168         <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
169              <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
170                         <xsl:call-template name="chopPunctuation">
171                             <xsl:with-param name="chopString">
172                                 <xsl:call-template name="subfieldSelect">
173                                     <xsl:with-param name="codes">av</xsl:with-param>
174                                 </xsl:call-template>
175                             </xsl:with-param>
176                         </xsl:call-template>
177             </a>
178                     <xsl:call-template name="part"/>
179         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
180         </xsl:for-each>
181         <!-- 490 Series traced, Ind1 = 1 -->
182         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
183             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
184                 <xsl:choose>
185                     <xsl:when test="marc:subfield[@code='w']">
186                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
187                             <xsl:call-template name="chopPunctuation">
188                                 <xsl:with-param name="chopString">
189                                     <xsl:call-template name="subfieldSelect">
190                                         <xsl:with-param name="codes">at</xsl:with-param>
191                                     </xsl:call-template>
192                                 </xsl:with-param>
193                             </xsl:call-template>
194                         </a>
195                     </xsl:when>
196                     <xsl:otherwise>
197                         <a href="/cgi-bin/koha/catalogue/search.pl?q=se:{marc:subfield[@code='a']}">
198                             <xsl:call-template name="chopPunctuation">
199                                 <xsl:with-param name="chopString">
200                                     <xsl:call-template name="subfieldSelect">
201                                         <xsl:with-param name="codes">at</xsl:with-param>
202                                     </xsl:call-template>
203                                 </xsl:with-param>
204                             </xsl:call-template>
205                         </a>
206                         <xsl:call-template name="part"/>
207                     </xsl:otherwise>
208                 </xsl:choose>
209                 <xsl:text>: </xsl:text>
210                 <xsl:value-of  select="marc:subfield[@code='v']" />
211             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
212             </xsl:for-each>
213         </xsl:if>
214
215         </span>
216         </xsl:if>
217
218         <!-- Volumes of sets and traced series -->
219         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
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/catalogue/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/catalogue/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] and $UseAuthoritiesForTracings='1'">
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:when test="$TraceSubjectSubdivisions='1'">
426                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
427                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
428                         <xsl:with-param name="delimeter"> and </xsl:with-param>
429                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:"</xsl:with-param>
430                         <xsl:with-param name="suffix">")</xsl:with-param>
431                     </xsl:call-template>
432                 </xsl:attribute>
433             </xsl:when>
434             <xsl:otherwise>
435                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
436             </xsl:otherwise>
437             </xsl:choose>
438             <xsl:call-template name="chopPunctuation">
439                 <xsl:with-param name="chopString">
440                     <xsl:call-template name="subfieldSelect">
441                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
442                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
443                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
444                     </xsl:call-template>
445                 </xsl:with-param>
446             </xsl:call-template>
447             </a>
448             <xsl:choose>
449             <xsl:when test="position()=last()"></xsl:when>
450             <xsl:otherwise> | </xsl:otherwise>
451             </xsl:choose>
452
453             </xsl:for-each>
454             </span>
455         </xsl:if>
456
457         <xsl:if test="marc:datafield[@tag=856]">
458         <span class="results_summary"><span class="label">Online Resources: </span>
459         <xsl:for-each select="marc:datafield[@tag=856]">
460                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
461                                     <xsl:choose>
462                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
463                                         <xsl:call-template name="subfieldSelect">
464                                         <xsl:with-param name="codes">y3z</xsl:with-param>
465                                         </xsl:call-template>
466                                     </xsl:when>
467                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
468                                         <xsl:choose>
469                                         <xsl:when test="$URLLinkText!=''">
470                                                 <xsl:value-of select="$URLLinkText"/>
471                                         </xsl:when>
472                                         <xsl:otherwise>
473                                                 <xsl:text>Click here to access online</xsl:text>
474                                         </xsl:otherwise>
475                                         </xsl:choose>
476                                     </xsl:when>
477                                     </xsl:choose>
478                                     </a>
479                                     <xsl:choose>
480                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
481                                     <xsl:otherwise> | </xsl:otherwise>
482                                     </xsl:choose>
483
484         </xsl:for-each>
485         </span>
486         </xsl:if>
487         <xsl:if test="marc:datafield[@tag=505]">
488         <xsl:for-each select="marc:datafield[@tag=505]">
489         <span class="results_summary">
490         <xsl:choose>
491         <xsl:when test="@ind1=0">
492             <span class="label">Contents:</span>
493         </xsl:when>
494         <xsl:when test="@ind1=1">
495             <span class="label">Incomplete contents:</span>
496         </xsl:when>
497         <xsl:when test="@ind1=1">
498             <span class="label">Partial contents:</span>
499         </xsl:when>
500         </xsl:choose>  
501         <xsl:choose>
502         <xsl:when test="@ind2=0">
503             <xsl:call-template name="subfieldSelect">
504                 <xsl:with-param name="codes">tru</xsl:with-param>
505             </xsl:call-template>
506         </xsl:when>
507         <xsl:otherwise>
508             <xsl:call-template name="subfieldSelect">
509                 <xsl:with-param name="codes">au</xsl:with-param>
510             </xsl:call-template>
511         </xsl:otherwise>
512         </xsl:choose>
513         </span>
514         </xsl:for-each>
515         </xsl:if>
516
517         <!-- 773 -->
518         <xsl:if test="marc:datafield[@tag=773]">
519         <xsl:for-each select="marc:datafield[@tag=773]">
520         <xsl:if test="@ind1=0">
521         <span class="results_summary"><span class="label">
522         <xsl:choose>
523         <xsl:when test="@ind2=' '">
524             In:
525         </xsl:when>
526         <xsl:when test="@ind2=8">
527             <xsl:if test="marc:subfield[@code='i']">
528                 <xsl:value-of select="marc:subfield[@code='i']"/>
529             </xsl:if>
530         </xsl:when>
531         </xsl:choose>
532         </span>
533                 <xsl:variable name="f773">
534                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
535                         <xsl:with-param name="codes">at</xsl:with-param>
536                     </xsl:call-template></xsl:with-param></xsl:call-template>
537                 </xsl:variable>
538             <xsl:choose>
539                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
540                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
541                         <xsl:value-of select="translate($f773, '()', '')"/><xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
542                     </a>
543                 </xsl:when>
544                 <xsl:otherwise>
545                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
546                         <xsl:value-of select="$f773"/><xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
547                     </a>
548                 </xsl:otherwise>
549             </xsl:choose>
550         </span>
551
552         <xsl:if test="marc:subfield[@code='n']">
553             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
554         </xsl:if>
555
556         </xsl:if>
557         </xsl:for-each>
558         </xsl:if>
559
560         <!--  775 Other Edition  -->
561         <xsl:if test="marc:datafield[@tag=775]">
562         <span class="results_summary"><span class="label">Other Editions: </span>
563         <xsl:for-each select="marc:datafield[@tag=775]">
564             <xsl:if test="marc:subfield[@code='i']">
565                 <xsl:call-template name="subfieldSelect">
566                     <xsl:with-param name="codes">i</xsl:with-param>
567                 </xsl:call-template>
568                 <xsl:text>: </xsl:text>
569             </xsl:if>
570             <a>
571             <xsl:choose>
572             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
573                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
574             </xsl:when>
575             <xsl:otherwise>
576                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
577             </xsl:otherwise>
578             </xsl:choose>
579             <xsl:call-template name="subfieldSelect">
580                 <xsl:with-param name="codes">t</xsl:with-param>
581             </xsl:call-template>
582             </a>
583             <xsl:choose>
584                 <xsl:when test="position()=last()"></xsl:when>
585                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
586             </xsl:choose>
587         </xsl:for-each>
588         </span>
589         </xsl:if>
590
591         <!-- 780 -->
592         <xsl:if test="marc:datafield[@tag=780]">
593         <xsl:for-each select="marc:datafield[@tag=780]">
594         <xsl:if test="@ind1=0">
595         <span class="results_summary">
596         <xsl:choose>
597         <xsl:when test="@ind2=0">
598             <span class="label">Continues:</span>
599         </xsl:when>
600         <xsl:when test="@ind2=1">
601             <span class="label">Continues in part:</span>
602         </xsl:when>
603         <xsl:when test="@ind2=2">
604             <span class="label">Supersedes:</span>
605         </xsl:when>
606         <xsl:when test="@ind2=3">
607             <span class="label">Supersedes in part:</span>
608         </xsl:when>
609         <xsl:when test="@ind2=4">
610             <span class="label">Formed by the union: ... and: ...</span>
611         </xsl:when>
612         <xsl:when test="@ind2=5">
613             <span class="label">Absorbed:</span>
614         </xsl:when>
615         <xsl:when test="@ind2=6">
616             <span class="label">Absorbed in part:</span>
617         </xsl:when>
618         <xsl:when test="@ind2=7">
619             <span class="label">Separated from:</span>
620         </xsl:when>
621         </xsl:choose>
622                 <xsl:variable name="f780">
623                     <xsl:call-template name="subfieldSelect">
624                         <xsl:with-param name="codes">at</xsl:with-param>
625                     </xsl:call-template>
626                 </xsl:variable>
627             <xsl:choose>
628                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
629                     <a href="/cgi-bin/koha/catalogue/search.pl?q=Control-number:{marc:subfield[@code='w']}">
630                         <xsl:value-of select="translate($f780, '()', '')"/>
631                     </a>
632                 </xsl:when>
633                 <xsl:otherwise>
634                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
635                         <xsl:value-of select="translate($f780, '()', '')"/>
636                     </a>
637                 </xsl:otherwise>
638             </xsl:choose>
639         </span>
640  
641         <xsl:if test="marc:subfield[@code='n']">
642             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
643         </xsl:if>
644
645         </xsl:if>
646         </xsl:for-each>
647         </xsl:if>
648
649         <!-- 785 -->
650         <xsl:if test="marc:datafield[@tag=785]">
651         <xsl:for-each select="marc:datafield[@tag=785]">
652         <span class="results_summary">
653         <xsl:choose>
654         <xsl:when test="@ind2=0">
655             <span class="label">Continued by:</span>
656         </xsl:when>
657         <xsl:when test="@ind2=1">
658             <span class="label">Continued in part by:</span>
659         </xsl:when>
660         <xsl:when test="@ind2=2">
661             <span class="label">Superseded by:</span>
662         </xsl:when>
663         <xsl:when test="@ind2=3">
664             <span class="label">Superseded in part by:</span>
665         </xsl:when>
666         <xsl:when test="@ind2=4">
667             <span class="label">Absorbed by:</span>
668         </xsl:when>
669         <xsl:when test="@ind2=5">
670             <span class="label">Absorbed in part by:</span>
671         </xsl:when>
672         <xsl:when test="@ind2=6">
673             <span class="label">Split into .. and ...:</span>
674         </xsl:when>
675         <xsl:when test="@ind2=7">
676             <span class="label">Merged with ... to form ...</span>
677         </xsl:when>
678         <xsl:when test="@ind2=8">
679             <span class="label">Changed back to:</span>
680         </xsl:when>
681
682         </xsl:choose>
683                    <xsl:variable name="f785">
684                     <xsl:call-template name="subfieldSelect">
685                         <xsl:with-param name="codes">at</xsl:with-param>
686                     </xsl:call-template>
687                 </xsl:variable>
688
689             <xsl:choose>
690                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
691                     <a href="/cgi-bin/koha/catalogue/search.pl?q=Control-number:{marc:subfield[@code='w']}">
692                         <xsl:value-of select="translate($f785, '()', '')"/>
693                     </a>
694                 </xsl:when>
695                 <xsl:otherwise>
696                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
697                         <xsl:value-of select="translate($f785, '()', '')"/>
698                     </a>
699                 </xsl:otherwise>
700             </xsl:choose>
701
702         </span>
703         </xsl:for-each>
704         </xsl:if>
705
706         <xsl:if test="$OPACBaseURL!=''">
707         <span class="results_summary"><span class="label">OPAC view: </span>
708             <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>.
709         </span>
710         </xsl:if>
711
712     </xsl:template>
713
714     <xsl:template name="nameABCDQ">
715             <xsl:call-template name="chopPunctuation">
716                 <xsl:with-param name="chopString">
717                     <xsl:call-template name="subfieldSelect">
718                         <xsl:with-param name="codes">aq</xsl:with-param>
719                     </xsl:call-template>
720                 </xsl:with-param>
721                 <xsl:with-param name="punctuation">
722                     <xsl:text>:,;/ </xsl:text>
723                 </xsl:with-param>
724             </xsl:call-template>
725         <xsl:call-template name="termsOfAddress"/>
726     </xsl:template>
727
728     <xsl:template name="nameABCDN">
729         <xsl:for-each select="marc:subfield[@code='a']">
730                 <xsl:call-template name="chopPunctuation">
731                     <xsl:with-param name="chopString" select="."/>
732                 </xsl:call-template>
733         </xsl:for-each>
734         <xsl:for-each select="marc:subfield[@code='b']">
735                 <xsl:value-of select="."/>
736         </xsl:for-each>
737         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
738                 <xsl:call-template name="subfieldSelect">
739                     <xsl:with-param name="codes">cdn</xsl:with-param>
740                 </xsl:call-template>
741         </xsl:if>
742     </xsl:template>
743
744     <xsl:template name="nameACDEQ">
745             <xsl:call-template name="subfieldSelect">
746                 <xsl:with-param name="codes">acdeq</xsl:with-param>
747             </xsl:call-template>
748     </xsl:template>
749     <xsl:template name="termsOfAddress">
750         <xsl:if test="marc:subfield[@code='b' or @code='c']">
751             <xsl:call-template name="chopPunctuation">
752                 <xsl:with-param name="chopString">
753                     <xsl:call-template name="subfieldSelect">
754                         <xsl:with-param name="codes">bc</xsl:with-param>
755                     </xsl:call-template>
756                 </xsl:with-param>
757             </xsl:call-template>
758         </xsl:if>
759     </xsl:template>
760
761     <xsl:template name="part">
762         <xsl:variable name="partNumber">
763             <xsl:call-template name="specialSubfieldSelect">
764                 <xsl:with-param name="axis">n</xsl:with-param>
765                 <xsl:with-param name="anyCodes">n</xsl:with-param>
766                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
767             </xsl:call-template>
768         </xsl:variable>
769         <xsl:variable name="partName">
770             <xsl:call-template name="specialSubfieldSelect">
771                 <xsl:with-param name="axis">p</xsl:with-param>
772                 <xsl:with-param name="anyCodes">p</xsl:with-param>
773                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
774             </xsl:call-template>
775         </xsl:variable>
776         <xsl:if test="string-length(normalize-space($partNumber))">
777                 <xsl:call-template name="chopPunctuation">
778                     <xsl:with-param name="chopString" select="$partNumber"/>
779                 </xsl:call-template>
780         </xsl:if>
781         <xsl:if test="string-length(normalize-space($partName))">
782                 <xsl:call-template name="chopPunctuation">
783                     <xsl:with-param name="chopString" select="$partName"/>
784                 </xsl:call-template>
785         </xsl:if>
786     </xsl:template>
787
788     <xsl:template name="specialSubfieldSelect">
789         <xsl:param name="anyCodes"/>
790         <xsl:param name="axis"/>
791         <xsl:param name="beforeCodes"/>
792         <xsl:param name="afterCodes"/>
793         <xsl:variable name="str">
794             <xsl:for-each select="marc:subfield">
795                 <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])">
796                     <xsl:value-of select="text()"/>
797                     <xsl:text> </xsl:text>
798                 </xsl:if>
799             </xsl:for-each>
800         </xsl:variable>
801         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
802     </xsl:template>
803
804     <xsl:template name="showAuthor">
805         <xsl:param name="authorfield"/>
806     <xsl:param name="UseAuthoritiesForTracings"/>
807         <xsl:if test="count($authorfield)&gt;0">
808         <h5 class="author">
809         <xsl:for-each select="$authorfield">
810         <xsl:choose>
811           <xsl:when test="position()&gt;1"/>
812           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
813           <xsl:otherwise>Additional author(s): </xsl:otherwise>
814         </xsl:choose>
815         <a>
816         <xsl:choose>
817             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
818                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
819             </xsl:when>
820             <xsl:otherwise>
821             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
822             </xsl:otherwise>
823         </xsl:choose>
824         <xsl:choose>
825           <xsl:when test="@tag=100 or @tag=700"><xsl:call-template name="nameABCDQ"/></xsl:when>
826           <xsl:when test="@tag=110 or @tag=710"><xsl:call-template name="nameABCDN"/></xsl:when>
827           <xsl:when test="@tag=111 or @tag=711"><xsl:call-template name="nameACDEQ"/></xsl:when>
828         </xsl:choose>
829         <!-- add relator code too between brackets-->
830         <xsl:if test="marc:subfield[@code='4' or @code='e']">
831           <xsl:text>[</xsl:text>
832           <xsl:choose>
833             <xsl:when test="marc:subfield[@code=4]"><xsl:value-of select="marc:subfield[@code=4]"/></xsl:when>
834             <xsl:otherwise><xsl:value-of select="marc:subfield[@code='e']"/></xsl:otherwise>
835           </xsl:choose>
836           <xsl:text>]</xsl:text>
837         </xsl:if>
838         </a>
839         <xsl:choose>
840           <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
841         </xsl:choose>
842         </xsl:for-each>
843         </h5>
844         </xsl:if>
845     </xsl:template>
846
847 </xsl:stylesheet>