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