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