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