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