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