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