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