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