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