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