Bug 4506: Add link to volumes of traced series to series record
[wip/koha-chris_n.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              <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
720                 <xsl:value-of select="translate($f780, '()', '')"/>
721             </a>
722         </span>
723
724         <xsl:if test="marc:subfield[@code='n']">
725             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
726         </xsl:if>
727
728         </xsl:if>
729         </xsl:for-each>
730         </xsl:if>
731
732         <!-- 785 -->
733         <xsl:if test="marc:datafield[@tag=785]">
734         <xsl:for-each select="marc:datafield[@tag=785]">
735         <xsl:if test="@ind1=0">
736         <span class="results_summary">
737         <xsl:choose>
738         <xsl:when test="@ind2=0">
739             <span class="label">Continued by:</span>
740         </xsl:when>
741         <xsl:when test="@ind2=1">
742             <span class="label">Continued in part by:</span>
743         </xsl:when>
744         <xsl:when test="@ind2=2">
745             <span class="label">Superseded by:</span>
746         </xsl:when>
747         <xsl:when test="@ind2=3">
748             <span class="label">Superseded in part by:</span>
749         </xsl:when>
750         <xsl:when test="@ind2=4">
751             <span class="label">Absorbed by:</span>
752         </xsl:when>
753         <xsl:when test="@ind2=5">
754             <span class="label">Absorbed in part by:</span>
755         </xsl:when>
756         <xsl:when test="@ind2=6">
757             <span class="label">Split into .. and ...:</span>
758         </xsl:when>
759         <xsl:when test="@ind2=7">
760             <span class="label">Merged with ... to form ...</span>
761         </xsl:when>
762         <xsl:when test="@ind2=8">
763             <span class="label">Changed back to:</span>
764         </xsl:when>
765
766         </xsl:choose>
767                    <xsl:variable name="f785">
768                     <xsl:call-template name="subfieldSelect">
769                         <xsl:with-param name="codes">at</xsl:with-param>
770                     </xsl:call-template>
771                 </xsl:variable>
772
773                 <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
774                 <xsl:value-of select="translate($f785, '()', '')"/>
775             </a>
776
777         </span>
778
779         <xsl:if test="marc:subfield[@code='n']">
780             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
781         </xsl:if>
782
783         </xsl:if>
784         </xsl:for-each>
785         </xsl:if>
786
787     </xsl:template>
788
789     <xsl:template name="nameABCDQ">
790             <xsl:call-template name="chopPunctuation">
791                 <xsl:with-param name="chopString">
792                     <xsl:call-template name="subfieldSelect">
793                         <xsl:with-param name="codes">aq</xsl:with-param>
794                     </xsl:call-template>
795                 </xsl:with-param>
796                 <xsl:with-param name="punctuation">
797                     <xsl:text>:,;/ </xsl:text>
798                 </xsl:with-param>
799             </xsl:call-template>
800         <xsl:call-template name="termsOfAddress"/>
801     </xsl:template>
802
803     <xsl:template name="nameABCDN">
804         <xsl:for-each select="marc:subfield[@code='a']">
805                 <xsl:call-template name="chopPunctuation">
806                     <xsl:with-param name="chopString" select="."/>
807                 </xsl:call-template>
808         </xsl:for-each>
809         <xsl:for-each select="marc:subfield[@code='b']">
810                 <xsl:value-of select="."/>
811         </xsl:for-each>
812         <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
813                 <xsl:call-template name="subfieldSelect">
814                     <xsl:with-param name="codes">cdn</xsl:with-param>
815                 </xsl:call-template>
816         </xsl:if>
817     </xsl:template>
818
819     <xsl:template name="nameACDEQ">
820             <xsl:call-template name="subfieldSelect">
821                 <xsl:with-param name="codes">acdeq</xsl:with-param>
822             </xsl:call-template>
823     </xsl:template>
824     <xsl:template name="termsOfAddress">
825         <xsl:if test="marc:subfield[@code='b' or @code='c']">
826             <xsl:call-template name="chopPunctuation">
827                 <xsl:with-param name="chopString">
828                     <xsl:call-template name="subfieldSelect">
829                         <xsl:with-param name="codes">bc</xsl:with-param>
830                     </xsl:call-template>
831                 </xsl:with-param>
832             </xsl:call-template>
833         </xsl:if>
834     </xsl:template>
835
836     <xsl:template name="part">
837         <xsl:variable name="partNumber">
838             <xsl:call-template name="specialSubfieldSelect">
839                 <xsl:with-param name="axis">n</xsl:with-param>
840                 <xsl:with-param name="anyCodes">n</xsl:with-param>
841                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
842             </xsl:call-template>
843         </xsl:variable>
844         <xsl:variable name="partName">
845             <xsl:call-template name="specialSubfieldSelect">
846                 <xsl:with-param name="axis">p</xsl:with-param>
847                 <xsl:with-param name="anyCodes">p</xsl:with-param>
848                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
849             </xsl:call-template>
850         </xsl:variable>
851         <xsl:if test="string-length(normalize-space($partNumber))">
852                 <xsl:call-template name="chopPunctuation">
853                     <xsl:with-param name="chopString" select="$partNumber"/>
854                 </xsl:call-template>
855         </xsl:if>
856         <xsl:if test="string-length(normalize-space($partName))">
857                 <xsl:call-template name="chopPunctuation">
858                     <xsl:with-param name="chopString" select="$partName"/>
859                 </xsl:call-template>
860         </xsl:if>
861     </xsl:template>
862
863     <xsl:template name="specialSubfieldSelect">
864         <xsl:param name="anyCodes"/>
865         <xsl:param name="axis"/>
866         <xsl:param name="beforeCodes"/>
867         <xsl:param name="afterCodes"/>
868         <xsl:variable name="str">
869             <xsl:for-each select="marc:subfield">
870                 <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])">
871                     <xsl:value-of select="text()"/>
872                     <xsl:text> </xsl:text>
873                 </xsl:if>
874             </xsl:for-each>
875         </xsl:variable>
876         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
877     </xsl:template>
878 </xsl:stylesheet>