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