Bug 4300 Display 866z summary holdings public note 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        <abbr class="unapi-id" title="koha:biblionumber:{marc:datafield[@tag=999]/marc:subfield[@code='c']}" ><!-- unAPI --></abbr>
306
307        <xsl:if test="marc:datafield[@tag=020]">
308         <span class="results_summary"><span class="label">ISBN: </span>
309         <xsl:for-each select="marc:datafield[@tag=020]">
310         <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
311                 <xsl:value-of select="marc:subfield[@code='a']"/>
312                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
313         </xsl:for-each>
314         </span>
315         </xsl:if>
316
317         <xsl:if test="marc:datafield[@tag=022]">
318         <span class="results_summary"><span class="label">ISSN: </span>
319         <xsl:for-each select="marc:datafield[@tag=022]">
320                 <xsl:value-of select="marc:subfield[@code='a']"/>
321                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
322         </xsl:for-each>
323         </span>
324         </xsl:if>
325
326         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
327         <xsl:if test="$display880">
328             <xsl:call-template name="m880Select">
329                 <xsl:with-param name="basetags">246</xsl:with-param>
330                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
331                 <xsl:with-param name="class">results_summary</xsl:with-param>
332                 <xsl:with-param name="label">Other Title: </xsl:with-param>
333             </xsl:call-template>
334         </xsl:if>
335
336         <xsl:if test="marc:datafield[@tag=246]">
337         <span class="results_summary"><span class="label">Other Title: </span>
338             <xsl:for-each select="marc:datafield[@tag=246]">
339                 <xsl:call-template name="chopPunctuation">
340                   <xsl:with-param name="chopString">
341                     <xsl:call-template name="subfieldSelect">
342                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
343                     </xsl:call-template>
344                    </xsl:with-param>
345                </xsl:call-template>
346                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
347             </xsl:for-each>
348         </span>
349        </xsl:if>
350
351         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
352         <xsl:if test="$display880">
353             <xsl:call-template name="m880Select">
354                 <xsl:with-param name="basetags">130,240</xsl:with-param>
355                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
356                 <xsl:with-param name="class">results_summary</xsl:with-param>
357                 <xsl:with-param name="label">Uniform Title: </xsl:with-param>
358             </xsl:call-template>
359         </xsl:if>
360
361         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
362         <span class="results_summary"><span class="label">Uniform titles: </span>
363         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
364             <xsl:variable name="str">
365                 <xsl:for-each select="marc:subfield">
366                     <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'])))">
367                         <xsl:value-of select="text()"/>
368                         <xsl:text> </xsl:text>
369                      </xsl:if>
370                 </xsl:for-each>
371             </xsl:variable>
372             <xsl:call-template name="chopPunctuation">
373                 <xsl:with-param name="chopString">
374                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
375                         
376                 </xsl:with-param>
377             </xsl:call-template>
378             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
379         </xsl:for-each>
380         </span>
381         </xsl:if>
382
383         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
384             <span class="results_summary"><span class="label">Related Subjects: </span>
385             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
386             <a>
387             <xsl:choose>
388             <xsl:when test="marc:subfield[@code=9]">
389                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
390             </xsl:when>
391             <xsl:otherwise>
392                 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
393             </xsl:otherwise>
394             </xsl:choose>
395             <xsl:call-template name="chopPunctuation">
396                 <xsl:with-param name="chopString">
397                     <xsl:call-template name="subfieldSelect">
398                         <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
399                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
400                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
401                     </xsl:call-template>
402                 </xsl:with-param>
403             </xsl:call-template>
404             </a>
405             <xsl:choose>
406             <xsl:when test="position()=last()"></xsl:when>
407             <xsl:otherwise> | </xsl:otherwise>
408             </xsl:choose>
409
410             </xsl:for-each>
411             </span>
412         </xsl:if>
413
414         <xsl:if test="marc:datafield[@tag=856]">
415         <span class="results_summary"><span class="label">Online Resources: </span>
416         <xsl:for-each select="marc:datafield[@tag=856]">
417                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
418                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
419                                     <xsl:choose>
420                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
421                                         <xsl:call-template name="subfieldSelect">
422                                         <xsl:with-param name="codes">y3z</xsl:with-param>
423                                         </xsl:call-template>
424                                     </xsl:when>
425                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
426                                         <xsl:choose>
427                                         <xsl:when test="$URLLinkText!=''">
428                                                 <xsl:value-of select="$URLLinkText"/>
429                                         </xsl:when>
430                                         <xsl:otherwise>
431                                                 <xsl:text>Click here to access online</xsl:text>
432                                         </xsl:otherwise>
433                                         </xsl:choose>
434                                     </xsl:when>
435                                     </xsl:choose>
436                                     </a>
437                               </xsl:if>
438                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
439                                    <a target='_blank'><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
440                                     <xsl:choose>
441                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
442                                         <xsl:call-template name="subfieldSelect">
443                                         <xsl:with-param name="codes">y3z</xsl:with-param>
444                                         </xsl:call-template>
445                                     </xsl:when>
446                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
447                                         <xsl:choose>
448                                         <xsl:when test="$URLLinkText!=''">
449                                                 <xsl:value-of select="$URLLinkText"/>
450                                         </xsl:when>
451                                         <xsl:otherwise>
452                                                 <xsl:text>Click here to access online</xsl:text>
453                                         </xsl:otherwise>
454                                         </xsl:choose>
455                                     </xsl:when>
456                                     </xsl:choose>
457                                     </a>
458                               </xsl:if>
459                                     <xsl:choose>
460                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
461                                     <xsl:otherwise> | </xsl:otherwise>
462                                     </xsl:choose>
463
464         </xsl:for-each>
465         </span>
466         </xsl:if>
467         <xsl:if test="marc:datafield[@tag=505]">
468         <xsl:for-each select="marc:datafield[@tag=505]">
469         <span class="results_summary"><span class="label">
470         <xsl:choose>
471         <xsl:when test="@ind1=1">
472             Incomplete contents:
473         </xsl:when>
474         <xsl:when test="@ind1=1">
475             Partial contents:
476         </xsl:when>
477         <xsl:otherwise>
478             Contents:
479         </xsl:otherwise>
480         </xsl:choose>  
481         </span>
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             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
525
526         </xsl:if>
527         </xsl:for-each>
528         </xsl:if>
529
530         <xsl:for-each select="marc:datafield[@tag=520]">
531         <span class="results_summary"><span class="label">
532         <xsl:choose>
533           <xsl:when test="@ind1=0"><xsl:text>Subject: </xsl:text></xsl:when>
534           <xsl:when test="@ind1=1"><xsl:text>Review: </xsl:text></xsl:when>
535           <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
536           <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
537           <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
538           <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
539         </xsl:choose>
540         </span>
541         <xsl:call-template name="subfieldSelect">
542           <xsl:with-param name="codes">abcu</xsl:with-param>
543         </xsl:call-template>
544         </span>
545         </xsl:for-each>
546
547         <!-- 866 holdings public note -->
548         <xsl:if test="marc:datafield[@tag=866]">
549         <span class="results_summary"><span class="label">Holdings Note: </span>
550         <xsl:for-each select="marc:datafield[@tag=866]">
551                 <xsl:value-of select="marc:subfield[@code='z']"/>
552                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
553         </xsl:for-each>
554         </span>
555         </xsl:if>
556
557         <!-- 780 -->
558         <xsl:if test="marc:datafield[@tag=780]">
559         <xsl:for-each select="marc:datafield[@tag=780]">
560         <xsl:if test="@ind1=0">
561         <span class="results_summary"><span class="label">
562         <xsl:choose>
563         <xsl:when test="@ind2=0">
564             Continues:
565         </xsl:when>
566         <xsl:when test="@ind2=1">
567             Continues in part:
568         </xsl:when>
569         <xsl:when test="@ind2=2">
570             Supersedes:
571         </xsl:when>
572         <xsl:when test="@ind2=3">
573             Supersedes in part:
574         </xsl:when>
575         <xsl:when test="@ind2=4">
576             Formed by the union: ... and: ...
577         </xsl:when>
578         <xsl:when test="@ind2=5">
579             Absorbed:
580         </xsl:when>
581         <xsl:when test="@ind2=6">
582             Absorbed in part:
583         </xsl:when>
584         <xsl:when test="@ind2=7">
585             Separated from:
586         </xsl:when>
587         </xsl:choose>
588         </span>
589                 <xsl:variable name="f780">
590                     <xsl:call-template name="subfieldSelect">
591                         <xsl:with-param name="codes">at</xsl:with-param>
592                     </xsl:call-template>
593                 </xsl:variable>
594              <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
595                 <xsl:value-of select="translate($f780, '()', '')"/>
596             </a>
597         </span>
598  
599         <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
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"><span class="label">
610         <xsl:choose>
611         <xsl:when test="@ind2=0">
612             Continued by:
613         </xsl:when>
614         <xsl:when test="@ind2=1">
615             Continued in part by:
616         </xsl:when>
617         <xsl:when test="@ind2=2">
618             Superseded by:
619         </xsl:when>
620         <xsl:when test="@ind2=3">
621             Superseded in part by:
622         </xsl:when>
623         <xsl:when test="@ind2=4">
624             Absorbed by:
625         </xsl:when>
626         <xsl:when test="@ind2=5">
627             Absorbed in part by:
628         </xsl:when>
629         <xsl:when test="@ind2=6">
630             Split into .. and ...:
631         </xsl:when>
632         <xsl:when test="@ind2=7">
633             Merged with ... to form ...
634         </xsl:when>
635         <xsl:when test="@ind2=8">
636             Changed back to:
637         </xsl:when>
638
639         </xsl:choose>
640         </span>
641                    <xsl:variable name="f785">
642                     <xsl:call-template name="subfieldSelect">
643                         <xsl:with-param name="codes">at</xsl:with-param>
644                     </xsl:call-template>
645                 </xsl:variable>
646
647                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
648                 <xsl:value-of select="translate($f785, '()', '')"/>
649             </a>
650
651         </span>
652         </xsl:if>
653         </xsl:for-each>
654         </xsl:if>
655
656     </xsl:template>
657
658     <xsl:template name="nameABCDQ">
659             <xsl:call-template name="chopPunctuation">
660                 <xsl:with-param name="chopString">
661                     <xsl:call-template name="subfieldSelect">
662                         <xsl:with-param name="codes">aq</xsl:with-param>
663                     </xsl:call-template>
664                 </xsl:with-param>
665                 <xsl:with-param name="punctuation">
666                     <xsl:text>:,;/ </xsl:text>
667                 </xsl:with-param>
668             </xsl:call-template>
669         <xsl:call-template name="termsOfAddress"/>
670     </xsl:template>
671
672     <xsl:template name="nameABCDN">
673         <xsl:for-each select="marc:subfield[@code='a']">
674                 <xsl:call-template name="chopPunctuation">
675                     <xsl:with-param name="chopString" select="."/>
676                 </xsl:call-template>
677         </xsl:for-each>
678         <xsl:for-each select="marc:subfield[@code='b']">
679                 <xsl:value-of select="."/>
680         </xsl:for-each>
681         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
682                 <xsl:call-template name="subfieldSelect">
683                     <xsl:with-param name="codes">cdn</xsl:with-param>
684                 </xsl:call-template>
685         </xsl:if>
686     </xsl:template>
687
688     <xsl:template name="nameACDEQ">
689             <xsl:call-template name="subfieldSelect">
690                 <xsl:with-param name="codes">acdeq</xsl:with-param>
691             </xsl:call-template>
692     </xsl:template>
693     <xsl:template name="termsOfAddress">
694         <xsl:if test="marc:subfield[@code='b' or @code='c']">
695             <xsl:call-template name="chopPunctuation">
696                 <xsl:with-param name="chopString">
697                     <xsl:call-template name="subfieldSelect">
698                         <xsl:with-param name="codes">bc</xsl:with-param>
699                     </xsl:call-template>
700                 </xsl:with-param>
701             </xsl:call-template>
702         </xsl:if>
703     </xsl:template>
704
705     <xsl:template name="part">
706         <xsl:variable name="partNumber">
707             <xsl:call-template name="specialSubfieldSelect">
708                 <xsl:with-param name="axis">n</xsl:with-param>
709                 <xsl:with-param name="anyCodes">n</xsl:with-param>
710                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
711             </xsl:call-template>
712         </xsl:variable>
713         <xsl:variable name="partName">
714             <xsl:call-template name="specialSubfieldSelect">
715                 <xsl:with-param name="axis">p</xsl:with-param>
716                 <xsl:with-param name="anyCodes">p</xsl:with-param>
717                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
718             </xsl:call-template>
719         </xsl:variable>
720         <xsl:if test="string-length(normalize-space($partNumber))">
721                 <xsl:call-template name="chopPunctuation">
722                     <xsl:with-param name="chopString" select="$partNumber"/>
723                 </xsl:call-template>
724         </xsl:if>
725         <xsl:if test="string-length(normalize-space($partName))">
726                 <xsl:call-template name="chopPunctuation">
727                     <xsl:with-param name="chopString" select="$partName"/>
728                 </xsl:call-template>
729         </xsl:if>
730     </xsl:template>
731
732     <xsl:template name="specialSubfieldSelect">
733         <xsl:param name="anyCodes"/>
734         <xsl:param name="axis"/>
735         <xsl:param name="beforeCodes"/>
736         <xsl:param name="afterCodes"/>
737         <xsl:variable name="str">
738             <xsl:for-each select="marc:subfield">
739                 <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])">
740                     <xsl:value-of select="text()"/>
741                     <xsl:text> </xsl:text>
742                 </xsl:if>
743             </xsl:for-each>
744         </xsl:variable>
745         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
746     </xsl:template>
747 </xsl:stylesheet>