Bug 13734: RDA: Display 33xs
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
4
5 <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ -->
6 <!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com  -->
7 <xsl:stylesheet version="1.0"
8   xmlns:marc="http://www.loc.gov/MARC21/slim"
9   xmlns:items="http://www.koha-community.org/items"
10   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11   exclude-result-prefixes="marc items">
12     <xsl:import href="MARC21slimUtils.xsl"/>
13     <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
14     <xsl:template match="/">
15             <xsl:apply-templates/>
16     </xsl:template>
17
18     <xsl:template match="marc:record">
19
20         <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
21         <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/>
22         <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/>
23         <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
24         <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
25         <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
26         <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
27         <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
28         <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
29         <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
30         <xsl:variable name="TracingQuotesLeft">
31            <xsl:choose>
32              <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
33              <xsl:otherwise>"</xsl:otherwise>
34            </xsl:choose>
35         </xsl:variable>
36         <xsl:variable name="TracingQuotesRight">
37           <xsl:choose>
38             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
39             <xsl:otherwise>"</xsl:otherwise>
40           </xsl:choose>
41         </xsl:variable>
42         <xsl:variable name="leader" select="marc:leader"/>
43         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
44         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
45         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
46         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
47         <xsl:variable name="materialTypeCode">
48             <xsl:choose>
49                 <xsl:when test="$leader19='a'">ST</xsl:when>
50                 <xsl:when test="$leader6='a'">
51                     <xsl:choose>
52                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
53                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
54                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
55                     </xsl:choose>
56                 </xsl:when>
57                 <xsl:when test="$leader6='t'">BK</xsl:when>
58                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
59                 <xsl:when test="$leader6='m'">CF</xsl:when>
60                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
61                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">VM</xsl:when>
62                 <xsl:when test="$leader6='i' or $leader6='j'">MU</xsl:when>
63                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
64             </xsl:choose>
65         </xsl:variable>
66         <xsl:variable name="materialTypeLabel">
67             <xsl:choose>
68                 <xsl:when test="$leader19='a'">Set</xsl:when>
69                 <xsl:when test="$leader6='a'">
70                     <xsl:choose>
71                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Book</xsl:when>
72                         <xsl:when test="$leader7='i' or $leader7='s'">
73                             <xsl:choose>
74                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
75                                 <xsl:otherwise>Series</xsl:otherwise>
76                             </xsl:choose>
77                         </xsl:when>
78                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
79                     </xsl:choose>
80                 </xsl:when>
81                 <xsl:when test="$leader6='t'">Book</xsl:when>
82                 <xsl:when test="$leader6='o'">Kit</xsl:when>                            
83                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
84                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
85                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
86                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='r'">Visual material</xsl:when>
87                 <xsl:when test="$leader6='j'">Music</xsl:when>
88                 <xsl:when test="$leader6='i'">Sound</xsl:when>
89                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
90             </xsl:choose>
91         </xsl:variable>
92
93         <!-- Title Statement -->
94         <!-- Alternate Graphic Representation (MARC 880) -->
95         <xsl:if test="$display880">
96             <h1 class="title">
97                 <xsl:call-template name="m880Select">
98                     <xsl:with-param name="basetags">245</xsl:with-param>
99                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
100                 </xsl:call-template>
101             </h1>
102         </xsl:if>
103
104         <!--Bug 13381 -->
105         <xsl:if test="marc:datafield[@tag=245]">
106             <h1 class="title" property="name">
107                 <xsl:for-each select="marc:datafield[@tag=245]">
108                     <xsl:call-template name="subfieldSelect">
109                         <xsl:with-param name="codes">a</xsl:with-param>
110                     </xsl:call-template>
111                     <xsl:text> </xsl:text>
112                     <!-- 13381 add additional subfields-->
113                     <xsl:for-each select="marc:subfield[contains('bchknps', @code)]">
114                         <xsl:choose>
115                             <xsl:when test="@code='h'">
116                                 <!--  13381 Span class around subfield h so it can be suppressed via css -->
117                                 <span class="title_medium"><xsl:apply-templates/> </span>
118                             </xsl:when>
119                             <xsl:when test="@code='c'">
120                                 <!--  13381 Span class around subfield c so it can be suppressed via css -->
121                                 <span class="title_resp_stmt"><xsl:apply-templates/> </span>
122                             </xsl:when>
123                             <xsl:otherwise>
124                                 <xsl:apply-templates/>
125                                 <xsl:text> </xsl:text>
126                             </xsl:otherwise>
127                         </xsl:choose>
128                     </xsl:for-each>
129                 </xsl:for-each>
130             </h1>
131         </xsl:if>
132
133         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
134         <xsl:if test="$display880">
135             <h5 class="author">
136                 <xsl:call-template name="m880Select">
137                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
138                     <xsl:with-param name="codes">abc</xsl:with-param>
139                     <xsl:with-param name="index">au</xsl:with-param>
140                     <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
141                     <!-- do not use label 'by ' here, it would be repeated for every occurence of 100,110,111,700,710,711 -->
142                 </xsl:call-template>
143             </h5>
144         </xsl:if>
145
146         <!-- Author Statement -->
147         <xsl:call-template name="showAuthor">
148             <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
149             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
150         </xsl:call-template>
151
152         <!-- #13382 Suppress 700$i and 7xx/@ind2=2 -->
153         <xsl:call-template name="showAuthor">
154             <xsl:with-param name="authorfield" select="marc:datafield[(@tag=700 or @tag=710 or @tag=711) and not(@ind2=2) and not(marc:subfield[@code='i'])]"/>
155             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
156         </xsl:call-template>
157
158     <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
159         <span class="results_summary type"><span class="label">Material type: </span>
160         <xsl:element name="img"><xsl:attribute name="src">/intranet-tmpl/prog/img/famfamfam/<xsl:value-of select="$materialTypeCode"/>.png</xsl:attribute><xsl:attribute name="alt"></xsl:attribute></xsl:element>
161         <xsl:text> </xsl:text>
162         <xsl:value-of select="$materialTypeLabel"/>
163         </span>
164     </xsl:if>
165
166
167         <!--Series: Alternate Graphic Representation (MARC 880) -->
168         <xsl:if test="$display880">
169             <xsl:call-template name="m880Select">
170                 <xsl:with-param name="basetags">440,490</xsl:with-param>
171                 <xsl:with-param name="codes">av</xsl:with-param>
172                 <xsl:with-param name="class">results_summary series</xsl:with-param>
173                 <xsl:with-param name="label">Series: </xsl:with-param>
174                 <xsl:with-param name="index">se</xsl:with-param>
175             </xsl:call-template>
176         </xsl:if>
177         
178         <!-- Series -->
179         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
180         <span class="results_summary series"><span class="label">Series: </span>
181         <!-- 440 -->
182         <xsl:for-each select="marc:datafield[@tag=440]">
183             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
184             <xsl:call-template name="chopPunctuation">
185                             <xsl:with-param name="chopString">
186                                 <xsl:call-template name="subfieldSelect">
187                                     <xsl:with-param name="codes">av</xsl:with-param>
188                                 </xsl:call-template>
189                             </xsl:with-param>
190                         </xsl:call-template>
191             </a>
192             <xsl:call-template name="part"/>
193             <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text> ; </xsl:text></xsl:otherwise></xsl:choose>
194         </xsl:for-each>
195
196         <!-- 490 Series not traced, Ind1 = 0 -->
197         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
198             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
199                         <xsl:call-template name="chopPunctuation">
200                             <xsl:with-param name="chopString">
201                                 <xsl:call-template name="subfieldSelect">
202                                     <xsl:with-param name="codes">av</xsl:with-param>
203                                 </xsl:call-template>
204                             </xsl:with-param>
205                         </xsl:call-template>
206             </a>
207                     <xsl:call-template name="part"/>
208         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
209         </xsl:for-each>
210         <!-- 490 Series traced, Ind1 = 1 -->
211         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
212             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811 or @tag=830]">
213                 <xsl:choose>
214                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
215                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
216                             <xsl:call-template name="chopPunctuation">
217                                 <xsl:with-param name="chopString">
218                                     <xsl:call-template name="subfieldSelect">
219                                         <xsl:with-param name="codes">a_t</xsl:with-param>
220                                     </xsl:call-template>
221                                 </xsl:with-param>
222                             </xsl:call-template>
223                         </a>
224                     </xsl:when>
225                     <xsl:otherwise>
226                         <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
227                             <xsl:call-template name="chopPunctuation">
228                                 <xsl:with-param name="chopString">
229                                     <xsl:call-template name="subfieldSelect">
230                                         <xsl:with-param name="codes">a_t</xsl:with-param>
231                                     </xsl:call-template>
232                                 </xsl:with-param>
233                             </xsl:call-template>
234                         </a>
235                         <xsl:call-template name="part"/>
236                     </xsl:otherwise>
237                 </xsl:choose>
238                 <xsl:text>: </xsl:text>
239                 <xsl:value-of  select="marc:subfield[@code='v']" />
240             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
241             </xsl:for-each>
242         </xsl:if>
243
244         </span>
245         </xsl:if>
246
247         <!-- Analytics -->
248         <xsl:if test="$leader7='s'">
249         <span class="results_summary analytics"><span class="label">Analytics: </span>
250             <a>
251             <xsl:choose>
252             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
253                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+and+(bib-level:a+or+bib-level:b)</xsl:attribute>
254             </xsl:when>
255             <xsl:otherwise>
256                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
257             </xsl:otherwise>
258             </xsl:choose>
259             <xsl:text>Show analytics</xsl:text>
260             </a>
261         </span>
262         </xsl:if>
263
264         <!-- Volumes of sets and traced series -->
265         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
266         <span class="results_summary volumes"><span class="label">Volumes: </span>
267             <a>
268             <xsl:choose>
269             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
270                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/>+not+(bib-level:a+or+bib-level:b)</xsl:attribute>
271             </xsl:when>
272             <xsl:otherwise>
273                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', '')"/></xsl:attribute>
274             </xsl:otherwise>
275             </xsl:choose>
276             <xsl:text>Show volumes</xsl:text>
277             </a>
278         </span>
279         </xsl:if>
280
281         <!-- Set -->
282         <xsl:if test="$leader19='c'">
283         <span class="results_summary set"><span class="label">Set: </span>
284         <xsl:for-each select="marc:datafield[@tag=773]">
285             <a>
286             <xsl:choose>
287             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
288                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
289             </xsl:when>
290             <xsl:otherwise>
291                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
292             </xsl:otherwise>
293             </xsl:choose>
294             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
295             </a>
296             <xsl:choose>
297                 <xsl:when test="position()=last()"></xsl:when>
298                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
299             </xsl:choose>
300         </xsl:for-each>
301         </span>
302         </xsl:if>
303
304         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
305         <xsl:if test="$display880">
306             <xsl:call-template name="m880Select">
307                 <xsl:with-param name="basetags">260</xsl:with-param>
308                 <xsl:with-param name="codes">abcg</xsl:with-param>
309                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
310                 <xsl:with-param name="label">Publisher: </xsl:with-param>
311             </xsl:call-template>
312         </xsl:if>
313
314         <!-- Publisher info and RDA related info from tags 260, 264 -->
315         <xsl:choose>
316         <xsl:when test="marc:datafield[@tag=260]">
317         <span class="results_summary publisher"><span class="label">Publisher: </span>
318             <xsl:for-each select="marc:datafield[@tag=260]">
319                 <xsl:if test="marc:subfield[@code='a']">
320                     <xsl:call-template name="subfieldSelect">
321                         <xsl:with-param name="codes">a</xsl:with-param>
322                     </xsl:call-template>
323                 </xsl:if>
324                 <xsl:text> </xsl:text>
325                 <xsl:if test="marc:subfield[@code='b']">
326                 <a href="/cgi-bin/koha/catalogue/search.pl?q=pb:{marc:subfield[@code='b']}">
327                     <xsl:call-template name="subfieldSelect">
328                         <xsl:with-param name="codes">b</xsl:with-param>
329                     </xsl:call-template>
330                </a>
331                </xsl:if>
332                <xsl:text> </xsl:text>
333                 <xsl:call-template name="chopPunctuation">
334                   <xsl:with-param name="chopString">
335                     <xsl:call-template name="subfieldSelect">
336                         <xsl:with-param name="codes">cg</xsl:with-param>
337                     </xsl:call-template>
338                    </xsl:with-param>
339                </xsl:call-template>
340                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
341             </xsl:for-each>
342             <xsl:if test="marc:datafield[@tag=264]">
343                 <xsl:text>; </xsl:text>
344                 <xsl:call-template name="showRDAtag264"/>
345             </xsl:if>
346         </span>
347         </xsl:when>
348         <xsl:when test="marc:datafield[@tag=264]">
349             <span class="results_summary">
350                 <xsl:call-template name="showRDAtag264"/>
351             </span>
352         </xsl:when>
353         </xsl:choose>
354
355         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
356         <xsl:if test="$display880">
357             <xsl:call-template name="m880Select">
358                 <xsl:with-param name="basetags">250</xsl:with-param>
359                 <xsl:with-param name="codes">ab</xsl:with-param>
360                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
361                 <xsl:with-param name="label">Edition: </xsl:with-param>
362             </xsl:call-template>
363         </xsl:if>
364         
365         <xsl:if test="marc:datafield[@tag=250]">
366         <span class="results_summary edition"><span class="label">Edition: </span>
367             <xsl:for-each select="marc:datafield[@tag=250]">
368                 <xsl:call-template name="chopPunctuation">
369                   <xsl:with-param name="chopString">
370                     <xsl:call-template name="subfieldSelect">
371                         <xsl:with-param name="codes">ab</xsl:with-param>
372                     </xsl:call-template>
373                    </xsl:with-param>
374                </xsl:call-template>
375                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
376             </xsl:for-each>
377         </span>
378         </xsl:if>
379
380         <!-- Description: Alternate Graphic Representation (MARC 880) -->
381         <xsl:if test="$display880">
382             <xsl:call-template name="m880Select">
383                 <xsl:with-param name="basetags">300</xsl:with-param>
384                 <xsl:with-param name="codes">abceg</xsl:with-param>
385                 <xsl:with-param name="class">results_summary description</xsl:with-param>
386                 <xsl:with-param name="label">Description: </xsl:with-param>
387             </xsl:call-template>
388         </xsl:if>
389         
390         <xsl:if test="marc:datafield[@tag=300]">
391         <span class="results_summary description"><span class="label">Description: </span>
392             <xsl:for-each select="marc:datafield[@tag=300]">
393                 <xsl:call-template name="chopPunctuation">
394                   <xsl:with-param name="chopString">
395                     <xsl:call-template name="subfieldSelect">
396                         <xsl:with-param name="codes">abceg</xsl:with-param>
397                     </xsl:call-template>
398                    </xsl:with-param>
399                </xsl:call-template>
400                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
401             </xsl:for-each>
402         </span>
403        </xsl:if>
404
405         <!-- Content Type -->
406         <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
407             <span class="results_summary" id="content_type">
408                 <xsl:if test="marc:datafield[@tag=336]">
409                     <span class="label">Content Type: </span>
410                     <xsl:for-each select="marc:datafield[@tag=336]">
411                         <xsl:call-template name="subfieldSelect">
412                             <xsl:with-param name="codes">a</xsl:with-param>
413                             <xsl:with-param name="delimeter">, </xsl:with-param>
414                         </xsl:call-template>
415                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
416                     </xsl:for-each>
417                 </xsl:if>
418                 <xsl:text> </xsl:text>
419                 <!-- Media Type -->
420                 <xsl:if test="marc:datafield[@tag=337]">
421                     <span class="label">Media Type: </span>
422                     <xsl:for-each select="marc:datafield[@tag=337]">
423                         <xsl:call-template name="subfieldSelect">
424                             <xsl:with-param name="codes">a</xsl:with-param>
425                             <xsl:with-param name="delimeter">, </xsl:with-param>
426                         </xsl:call-template>
427                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
428                     </xsl:for-each>
429                 </xsl:if>
430                 <xsl:text> </xsl:text>
431                 <!-- Media Type -->
432                 <xsl:if test="marc:datafield[@tag=338]">
433                     <span class="label">Carrier Type: </span>
434                     <xsl:for-each select="marc:datafield[@tag=338]">
435                         <xsl:call-template name="subfieldSelect">
436                             <xsl:with-param name="codes">a</xsl:with-param>
437                             <xsl:with-param name="delimeter">, </xsl:with-param>
438                         </xsl:call-template>
439                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
440                     </xsl:for-each>
441                 </xsl:if>
442             </span>
443         </xsl:if>
444
445
446         <!-- Build ISBN -->
447         <xsl:if test="marc:datafield[@tag=020]/marc:subfield[@code='a']">
448           <span class="results_summary isbn"><span class="label">ISBN: </span>
449             <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">
450               <span property="isbn">
451                 <xsl:value-of select="."/>
452                 <xsl:choose>
453                   <xsl:when test="position()=last()">
454                     <xsl:text>.</xsl:text>
455                   </xsl:when>
456                   <xsl:otherwise>
457                     <xsl:text>; </xsl:text>
458                   </xsl:otherwise>
459                 </xsl:choose>
460               </span>
461             </xsl:for-each>
462           </span>
463         </xsl:if>
464
465         <!-- Build ISSN -->
466         <xsl:if test="marc:datafield[@tag=022]/marc:subfield[@code='a']">
467           <span class="results_summary issn"><span class="label">ISSN: </span>
468             <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">
469               <span property="issn">
470                 <xsl:value-of select="."/>
471                 <xsl:choose>
472                   <xsl:when test="position()=last()">
473                     <xsl:text>.</xsl:text>
474                   </xsl:when>
475                   <xsl:otherwise>
476                     <xsl:text>; </xsl:text>
477                   </xsl:otherwise>
478                 </xsl:choose>
479               </span>
480             </xsl:for-each>
481           </span>
482         </xsl:if>
483
484         <xsl:if test="marc:datafield[@tag=013]">
485             <span class="results_summary patent_info">
486                 <span class="label">Patent information: </span>
487                 <xsl:for-each select="marc:datafield[@tag=013]">
488                     <xsl:call-template name="subfieldSelect">
489                         <xsl:with-param name="codes">acdef</xsl:with-param>
490                         <xsl:with-param name="delimeter">, </xsl:with-param>
491                     </xsl:call-template>
492                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
493                 </xsl:for-each>
494             </span>
495         </xsl:if>
496
497         <xsl:if test="marc:datafield[@tag=088]">
498             <span class="results_summary report_number">
499                 <span class="label">Report number: </span>
500                 <xsl:for-each select="marc:datafield[@tag=088]">
501                     <xsl:call-template name="subfieldSelect">
502                         <xsl:with-param name="codes">a</xsl:with-param>
503                     </xsl:call-template>
504                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
505                 </xsl:for-each>
506             </span>
507         </xsl:if>
508
509         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
510         <xsl:if test="$display880">
511             <xsl:call-template name="m880Select">
512                 <xsl:with-param name="basetags">246</xsl:with-param>
513                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
514                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
515                 <xsl:with-param name="label">Other title: </xsl:with-param>
516             </xsl:call-template>
517         </xsl:if>
518
519         <xsl:if test="marc:datafield[@tag=246]">
520         <span class="results_summary other_title"><span class="label">Other title: </span>
521             <xsl:for-each select="marc:datafield[@tag=246]">
522                 <xsl:call-template name="chopPunctuation">
523                   <xsl:with-param name="chopString">
524                     <xsl:call-template name="subfieldSelect">
525                         <xsl:with-param name="codes">iabhfgnp</xsl:with-param>
526                     </xsl:call-template>
527                    </xsl:with-param>
528                </xsl:call-template>
529                 <!-- #13386 added separator | -->
530                 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise></xsl:choose>
531             </xsl:for-each>
532         </span>
533        </xsl:if>
534
535         <xsl:if test="marc:datafield[@tag=242]">
536         <span class="results_summary translated_title"><span class="label">Title translated: </span>
537             <xsl:for-each select="marc:datafield[@tag=242]">
538                 <xsl:call-template name="chopPunctuation">
539                   <xsl:with-param name="chopString">
540                     <xsl:call-template name="subfieldSelect">
541                         <xsl:with-param name="codes">abchnp</xsl:with-param>
542                     </xsl:call-template>
543                    </xsl:with-param>
544                </xsl:call-template>
545                     <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
546             </xsl:for-each>
547         </span>
548        </xsl:if>
549
550         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
551         <xsl:if test="$display880">
552             <xsl:call-template name="m880Select">
553                 <xsl:with-param name="basetags">130,240</xsl:with-param>
554                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
555                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
556                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
557             </xsl:call-template>
558         </xsl:if>
559
560         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
561         <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
562         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
563             <xsl:variable name="str">
564                 <xsl:for-each select="marc:subfield">
565                     <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'])))">
566                         <xsl:value-of select="text()"/>
567                         <xsl:text> </xsl:text>
568                      </xsl:if>
569                 </xsl:for-each>
570             </xsl:variable>
571             <xsl:call-template name="chopPunctuation">
572                 <xsl:with-param name="chopString">
573                     <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
574                         
575                 </xsl:with-param>
576             </xsl:call-template>
577             <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
578         </xsl:for-each>
579         </span>
580         </xsl:if>
581
582         <!-- #13382 Added Related works 700$i -->
583         <xsl:if test="marc:datafield[@tag=700][marc:subfield[@code='i']] or marc:datafield[@tag=710][marc:subfield[@code='i']] or marc:datafield[@tag=711][marc:subfield[@code='i']]">
584             <span class="results_summary related_works"><span class="label">Related Works: </span>
585                 <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='i']] | marc:datafield[@tag=710][marc:subfield[@code='i']] | marc:datafield[@tag=711][marc:subfield[@code='i']]">
586                     <xsl:variable name="str">
587                         <xsl:call-template name="subfieldSelect">
588                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
589                         </xsl:call-template>
590                     </xsl:variable>
591                     <xsl:call-template name="chopPunctuation">
592                         <xsl:with-param name="chopString">
593                             <xsl:value-of select="$str"/>
594                         </xsl:with-param>
595                     </xsl:call-template>
596                     <!-- add relator code too between brackets-->
597                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
598                         <span class="relatorcode">
599                             <xsl:text> [</xsl:text>
600                             <xsl:choose>
601                                 <xsl:when test="marc:subfield[@code='e']">
602                                     <xsl:for-each select="marc:subfield[@code='e']">
603                                         <xsl:value-of select="."/>
604                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
605                                     </xsl:for-each>
606                                 </xsl:when>
607                                 <xsl:otherwise>
608                                     <xsl:for-each select="marc:subfield[@code='4']">
609                                         <xsl:value-of select="."/>
610                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
611                                     </xsl:for-each>
612                                 </xsl:otherwise>
613                             </xsl:choose>
614                             <xsl:text>]</xsl:text>
615                         </span>
616                     </xsl:if>
617                     <xsl:choose>
618                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
619                     </xsl:choose>
620                 </xsl:for-each>
621             </span>
622         </xsl:if>
623
624         <!-- #13382 Added Contained Works 7xx@ind2=2 -->
625         <xsl:if test="marc:datafield[@tag=700][@ind2=2 and not(marc:subfield[@code='i'])] or marc:datafield[@tag=710][@ind2=2 and not(marc:subfield[@code='i'])] or marc:datafield[@tag=711][@ind2=2 and not(marc:subfield[@code='i'])]">
626             <span class="results_summary contained_works"><span class="label">Contained Works: </span>
627                 <xsl:for-each select="marc:datafield[@tag=700][@ind2=2][not(marc:subfield[@code='i'])] | marc:datafield[@tag=710][@ind2=2][not(marc:subfield[@code='i'])] | marc:datafield[@tag=711][@ind2=2][not(marc:subfield[@code='i'])]">
628                     <xsl:variable name="str">
629                         <xsl:call-template name="subfieldSelect">
630                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
631                         </xsl:call-template>
632                     </xsl:variable>
633                     <xsl:call-template name="chopPunctuation">
634                         <xsl:with-param name="chopString">
635                             <xsl:value-of select="$str"/>
636                         </xsl:with-param>
637                     </xsl:call-template>
638                     <!-- add relator code too between brackets-->
639                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
640                         <span class="relatorcode">
641                             <xsl:text> [</xsl:text>
642                             <xsl:choose>
643                                 <xsl:when test="marc:subfield[@code='e']">
644                                     <xsl:for-each select="marc:subfield[@code='e']">
645                                         <xsl:value-of select="."/>
646                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
647                                     </xsl:for-each>
648                                 </xsl:when>
649                                 <xsl:otherwise>
650                                     <xsl:for-each select="marc:subfield[@code='4']">
651                                         <xsl:value-of select="."/>
652                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
653                                     </xsl:for-each>
654                                 </xsl:otherwise>
655                             </xsl:choose>
656                             <xsl:text>]</xsl:text>
657                         </span>
658                     </xsl:if>
659                     <xsl:choose>
660                         <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
661                     </xsl:choose>
662                 </xsl:for-each>
663             </span>
664         </xsl:if>
665
666
667         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
668             <span class="results_summary subjects"><span class="label">Subject(s): </span>
669             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
670             <a>
671             <xsl:choose>
672             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
673             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
674                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
675             </xsl:when>
676             <xsl:when test="$TraceSubjectSubdivisions='1'">
677                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
678                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
679                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
680                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
681                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
682                     </xsl:call-template>
683                 </xsl:attribute>
684             </xsl:when>
685             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
686             <xsl:otherwise>
687                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
688             </xsl:otherwise>
689             </xsl:choose>
690             <xsl:call-template name="chopPunctuation">
691                 <xsl:with-param name="chopString">
692                     <xsl:call-template name="subfieldSelect">
693                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
694                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
695                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
696                     </xsl:call-template>
697                 </xsl:with-param>
698             </xsl:call-template>
699             </a>
700             <xsl:choose>
701             <xsl:when test="position()=last()"></xsl:when>
702             <xsl:otherwise> | </xsl:otherwise>
703             </xsl:choose>
704
705             </xsl:for-each>
706             </span>
707         </xsl:if>
708
709         <!-- Genre/Form -->
710         <xsl:if test="marc:datafield[@tag=655]">
711             <span class="results_summary genre"><span class="label">Genre/Form: </span>
712                 <xsl:for-each select="marc:datafield[@tag=655]">
713                     <a>
714                         <xsl:choose>
715                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
716                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
717                             </xsl:when>
718                             <xsl:when test="$TraceSubjectSubdivisions='1'">
719                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
720                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
721                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
722                                     <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
723                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
724                                 </xsl:call-template>
725                                 </xsl:attribute>
726                             </xsl:when>
727                             <xsl:otherwise>
728                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
729                             </xsl:otherwise>
730                         </xsl:choose>
731                     <xsl:call-template name="subfieldSelect">
732                         <xsl:with-param name="codes">avxyz</xsl:with-param>
733                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
734                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
735                     </xsl:call-template>
736                     </a>
737                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
738                 </xsl:for-each>
739             </span>
740         </xsl:if>
741
742 <!-- DDC classification -->
743     <xsl:if test="marc:datafield[@tag=082]">
744         <span class="results_summary ddc">
745             <span class="label">DDC classification: </span>
746             <xsl:for-each select="marc:datafield[@tag=082]">
747                 <xsl:call-template name="subfieldSelect">
748                     <xsl:with-param name="codes">a</xsl:with-param>
749                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
750                 </xsl:call-template>
751                 <xsl:choose>
752                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
753                     <xsl:otherwise> | </xsl:otherwise>
754                 </xsl:choose>
755             </xsl:for-each>
756         </span>
757     </xsl:if>
758
759         <xsl:if test="marc:datafield[@tag=856]">
760         <span class="results_summary online_resources"><span class="label">Online resources: </span>
761         <xsl:for-each select="marc:datafield[@tag=856]">
762                                    <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
763                                    <a><xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
764                                     <xsl:choose>
765                                     <xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
766                                         <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="height">100</xsl:attribute></xsl:element><xsl:text></xsl:text>
767                                     </xsl:when>
768                                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
769                                         <xsl:call-template name="subfieldSelect">
770                                         <xsl:with-param name="codes">y3z</xsl:with-param>
771                                         </xsl:call-template>
772                                     </xsl:when>
773                                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
774                                         <xsl:choose>
775                                         <xsl:when test="$URLLinkText!=''">
776                                                 <xsl:value-of select="$URLLinkText"/>
777                                         </xsl:when>
778                                         <xsl:otherwise>
779                                                 <xsl:text>Click here to access online</xsl:text>
780                                         </xsl:otherwise>
781                                         </xsl:choose>
782                                     </xsl:when>
783                                     </xsl:choose>
784                                     </a>
785                                     <xsl:choose>
786                                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
787                                     <xsl:otherwise> | </xsl:otherwise>
788                                     </xsl:choose>
789
790         </xsl:for-each>
791         </span>
792         </xsl:if>
793         <xsl:if test="marc:datafield[@tag=505]">
794             <div class="results_summary contents">
795             <xsl:choose>
796             <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
797                 <span class="label">Contents:</span>
798             </xsl:when>
799             <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
800                 <span class="label">Incomplete contents:</span>
801             </xsl:when>
802             <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
803                 <span class="label">Partial contents:</span>
804             </xsl:when>
805             </xsl:choose>
806                 <xsl:for-each select="marc:datafield[@tag=505]">
807                     <div class='contentblock'>
808                         <xsl:choose>
809                         <xsl:when test="@ind2=0">
810                             <xsl:call-template name="subfieldSelectSpan">
811                                 <xsl:with-param name="codes">tru</xsl:with-param>
812                             </xsl:call-template>
813                         </xsl:when>
814                         <xsl:otherwise>
815                             <xsl:call-template name="subfieldSelectSpan">
816                                 <xsl:with-param name="codes">atru</xsl:with-param>
817                             </xsl:call-template>
818                         </xsl:otherwise>
819                         </xsl:choose>
820                     </div>
821                 </xsl:for-each>
822             </div>
823         </xsl:if>
824
825         <!-- 586 -->
826         <xsl:if test="marc:datafield[@tag=586]">
827             <span class="results_summary awardsnote">
828                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
829                     <span class="label">Awards: </span>
830                 </xsl:if>
831                 <xsl:for-each select="marc:datafield[@tag=586]">
832                     <xsl:value-of select="marc:subfield[@code='a']"/>
833                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
834                 </xsl:for-each>
835             </span>
836         </xsl:if>
837
838         <!-- 508 -->
839         <xsl:if test="marc:datafield[@tag=508]">
840             <div class="results_summary prod_credits">
841                 <span class="label">Production Credits: </span>
842                 <xsl:for-each select="marc:datafield[@tag=508]">
843                     <xsl:call-template name="subfieldSelectSpan">
844                         <xsl:with-param name="codes">a</xsl:with-param>
845                     </xsl:call-template>
846                 </xsl:for-each>
847             </div>
848         </xsl:if>
849
850         <!-- 773 -->
851         <xsl:if test="marc:datafield[@tag=773]">
852         <xsl:for-each select="marc:datafield[@tag=773]">
853         <xsl:if test="@ind1 !=1">
854         <span class="results_summary in"><span class="label">
855         <xsl:choose>
856         <xsl:when test="@ind2=' '">
857             In:
858         </xsl:when>
859         <xsl:when test="@ind2=8">
860             <xsl:if test="marc:subfield[@code='i']">
861                 <xsl:value-of select="marc:subfield[@code='i']"/>
862             </xsl:if>
863         </xsl:when>
864         </xsl:choose>
865         </span>
866                 <xsl:variable name="f773">
867                     <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
868                         <xsl:with-param name="codes">a_t</xsl:with-param>
869                     </xsl:call-template></xsl:with-param></xsl:call-template>
870                 </xsl:variable>
871             <xsl:choose>
872                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
873                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
874                         <xsl:value-of select="translate($f773, '()', '')"/>
875                     </a>
876                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
877                 </xsl:when>
878                 <xsl:when test="marc:subfield[@code='0']">
879                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
880                         <xsl:value-of select="$f773"/>
881                     </a>
882                 </xsl:when>
883                 <xsl:otherwise>
884                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
885                         <xsl:value-of select="$f773"/>
886                     </a>
887                     <xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
888                 </xsl:otherwise>
889             </xsl:choose>
890         </span>
891
892         <xsl:if test="marc:subfield[@code='n']">
893             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
894         </xsl:if>
895
896         </xsl:if>
897         </xsl:for-each>
898         </xsl:if>
899
900         <xsl:if test="marc:datafield[@tag=502]">
901             <span class="results_summary diss_note">
902                 <span class="label">Dissertation note: </span>
903                 <xsl:for-each select="marc:datafield[@tag=502]">
904                     <xsl:call-template name="subfieldSelect">
905                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
906                     </xsl:call-template>
907                 </xsl:for-each>
908                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
909             </span>
910         </xsl:if>
911
912         <!-- 866 textual holdings -->
913         <xsl:if test="marc:datafield[@tag=866]">
914             <span class="results_summary holdings_note"><span class="label">Holdings note: </span>
915                 <xsl:for-each select="marc:datafield[@tag=866]">
916                     <xsl:call-template name="subfieldSelect">
917                         <xsl:with-param name="codes">axz</xsl:with-param>
918                     </xsl:call-template>
919                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
920                 </xsl:for-each>
921             </span>
922         </xsl:if>
923
924         <!--  775 Other Edition  -->
925         <xsl:if test="marc:datafield[@tag=775]">
926         <span class="results_summary other_editions"><span class="label">Other editions: </span>
927         <xsl:for-each select="marc:datafield[@tag=775]">
928             <xsl:variable name="f775">
929                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
930                 <xsl:with-param name="codes">a_t</xsl:with-param>
931                 </xsl:call-template></xsl:with-param></xsl:call-template>
932             </xsl:variable>
933             <xsl:if test="marc:subfield[@code='i']">
934                 <xsl:call-template name="subfieldSelect">
935                     <xsl:with-param name="codes">i</xsl:with-param>
936                 </xsl:call-template>
937                 <xsl:text>: </xsl:text>
938             </xsl:if>
939             <a>
940             <xsl:choose>
941             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
942                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
943             </xsl:when>
944             <xsl:otherwise>
945                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f775, '()', '')"/></xsl:attribute>
946             </xsl:otherwise>
947             </xsl:choose>
948             <xsl:call-template name="subfieldSelect">
949                 <xsl:with-param name="codes">a_t</xsl:with-param>
950             </xsl:call-template>
951             </a>
952             <xsl:choose>
953                 <xsl:when test="position()=last()"></xsl:when>
954                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
955             </xsl:choose>
956         </xsl:for-each>
957         </span>
958         </xsl:if>
959
960         <!-- 780 -->
961         <xsl:if test="marc:datafield[@tag=780]">
962         <xsl:for-each select="marc:datafield[@tag=780]">
963         <xsl:if test="@ind1=0">
964         <span class="results_summary preceeding_entry">
965         <xsl:choose>
966         <xsl:when test="@ind2=0">
967             <span class="label">Continues:</span>
968         </xsl:when>
969         <xsl:when test="@ind2=1">
970             <span class="label">Continues in part:</span>
971         </xsl:when>
972         <xsl:when test="@ind2=2">
973             <span class="label">Supersedes:</span>
974         </xsl:when>
975         <xsl:when test="@ind2=3">
976             <span class="label">Supersedes in part:</span>
977         </xsl:when>
978         <xsl:when test="@ind2=4">
979             <span class="label">Formed by the union: ... and: ...</span>
980         </xsl:when>
981         <xsl:when test="@ind2=5">
982             <span class="label">Absorbed:</span>
983         </xsl:when>
984         <xsl:when test="@ind2=6">
985             <span class="label">Absorbed in part:</span>
986         </xsl:when>
987         <xsl:when test="@ind2=7">
988             <span class="label">Separated from:</span>
989         </xsl:when>
990         </xsl:choose>
991         <xsl:text> </xsl:text>
992                 <xsl:variable name="f780">
993                     <xsl:call-template name="subfieldSelect">
994                         <xsl:with-param name="codes">a_t</xsl:with-param>
995                     </xsl:call-template>
996                 </xsl:variable>
997             <xsl:choose>
998                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
999                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
1000                         <xsl:value-of select="translate($f780, '()', '')"/>
1001                     </a>
1002                 </xsl:when>
1003                 <xsl:otherwise>
1004                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f780, '()', '')"/></xsl:attribute>
1005                         <xsl:value-of select="translate($f780, '()', '')"/>
1006                     </a>
1007                 </xsl:otherwise>
1008             </xsl:choose>
1009         </span>
1010  
1011         <xsl:if test="marc:subfield[@code='n']">
1012             <span class="results_summary"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1013         </xsl:if>
1014
1015         </xsl:if>
1016         </xsl:for-each>
1017         </xsl:if>
1018
1019         <!-- 785 -->
1020         <xsl:if test="marc:datafield[@tag=785]">
1021         <xsl:for-each select="marc:datafield[@tag=785]">
1022         <span class="results_summary succeeding_entry">
1023         <xsl:choose>
1024         <xsl:when test="@ind2=0">
1025             <span class="label">Continued by:</span>
1026         </xsl:when>
1027         <xsl:when test="@ind2=1">
1028             <span class="label">Continued in part by:</span>
1029         </xsl:when>
1030         <xsl:when test="@ind2=2">
1031             <span class="label">Superseded by:</span>
1032         </xsl:when>
1033         <xsl:when test="@ind2=3">
1034             <span class="label">Superseded in part by:</span>
1035         </xsl:when>
1036         <xsl:when test="@ind2=4">
1037             <span class="label">Absorbed by:</span>
1038         </xsl:when>
1039         <xsl:when test="@ind2=5">
1040             <span class="label">Absorbed in part by:</span>
1041         </xsl:when>
1042         <xsl:when test="@ind2=6">
1043             <span class="label">Split into .. and ...:</span>
1044         </xsl:when>
1045         <xsl:when test="@ind2=7">
1046             <span class="label">Merged with ... to form ...</span>
1047         </xsl:when>
1048         <xsl:when test="@ind2=8">
1049             <span class="label">Changed back to:</span>
1050         </xsl:when>
1051         </xsl:choose>
1052         <xsl:text> </xsl:text>
1053                    <xsl:variable name="f785">
1054                     <xsl:call-template name="subfieldSelect">
1055                         <xsl:with-param name="codes">a_t</xsl:with-param>
1056                     </xsl:call-template>
1057                 </xsl:variable>
1058
1059             <xsl:choose>
1060                 <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1061                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute>
1062                         <xsl:value-of select="translate($f785, '()', '')"/>
1063                     </a>
1064                 </xsl:when>
1065                 <xsl:otherwise>
1066                     <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="translate($f785, '()', '')"/></xsl:attribute>
1067                         <xsl:value-of select="translate($f785, '()', '')"/>
1068                     </a>
1069                 </xsl:otherwise>
1070             </xsl:choose>
1071
1072         </span>
1073         </xsl:for-each>
1074         </xsl:if>
1075
1076         <xsl:if test="$OPACBaseURL!=''">
1077         <span class="results_summary"><span class="label">OPAC view: </span>
1078             <a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
1079         </span>
1080         </xsl:if>
1081
1082     </xsl:template>
1083
1084     <xsl:template name="nameABCQ">
1085             <xsl:call-template name="chopPunctuation">
1086                 <xsl:with-param name="chopString">
1087                     <xsl:call-template name="subfieldSelect">
1088                         <xsl:with-param name="codes">abcq</xsl:with-param>
1089                     </xsl:call-template>
1090                 </xsl:with-param>
1091                 <xsl:with-param name="punctuation">
1092                     <xsl:text>:,;/ </xsl:text>
1093                 </xsl:with-param>
1094             </xsl:call-template>
1095     </xsl:template>
1096
1097     <xsl:template name="nameABCDN">
1098             <xsl:call-template name="chopPunctuation">
1099                 <xsl:with-param name="chopString">
1100                     <xsl:call-template name="subfieldSelect">
1101                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1102                     </xsl:call-template>
1103                 </xsl:with-param>
1104                 <xsl:with-param name="punctuation">
1105                     <xsl:text>:,;/ </xsl:text>
1106                 </xsl:with-param>
1107             </xsl:call-template>
1108     </xsl:template>
1109
1110     <xsl:template name="nameACDEQ">
1111             <xsl:call-template name="subfieldSelect">
1112                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1113             </xsl:call-template>
1114     </xsl:template>
1115
1116     <xsl:template name="part">
1117         <xsl:variable name="partNumber">
1118             <xsl:call-template name="specialSubfieldSelect">
1119                 <xsl:with-param name="axis">n</xsl:with-param>
1120                 <xsl:with-param name="anyCodes">n</xsl:with-param>
1121                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1122             </xsl:call-template>
1123         </xsl:variable>
1124         <xsl:variable name="partName">
1125             <xsl:call-template name="specialSubfieldSelect">
1126                 <xsl:with-param name="axis">p</xsl:with-param>
1127                 <xsl:with-param name="anyCodes">p</xsl:with-param>
1128                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
1129             </xsl:call-template>
1130         </xsl:variable>
1131         <xsl:if test="string-length(normalize-space($partNumber))">
1132                 <xsl:call-template name="chopPunctuation">
1133                     <xsl:with-param name="chopString" select="$partNumber"/>
1134                 </xsl:call-template>
1135         </xsl:if>
1136         <xsl:if test="string-length(normalize-space($partName))">
1137                 <xsl:call-template name="chopPunctuation">
1138                     <xsl:with-param name="chopString" select="$partName"/>
1139                 </xsl:call-template>
1140         </xsl:if>
1141     </xsl:template>
1142
1143     <xsl:template name="specialSubfieldSelect">
1144         <xsl:param name="anyCodes"/>
1145         <xsl:param name="axis"/>
1146         <xsl:param name="beforeCodes"/>
1147         <xsl:param name="afterCodes"/>
1148         <xsl:variable name="str">
1149             <xsl:for-each select="marc:subfield">
1150                 <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])">
1151                     <xsl:value-of select="text()"/>
1152                     <xsl:text> </xsl:text>
1153                 </xsl:if>
1154             </xsl:for-each>
1155         </xsl:variable>
1156         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1157     </xsl:template>
1158
1159     <xsl:template name="showAuthor">
1160         <xsl:param name="authorfield"/>
1161     <xsl:param name="UseAuthoritiesForTracings"/>
1162         <xsl:if test="count($authorfield)&gt;0">
1163         <h5 class="author">
1164         <xsl:for-each select="$authorfield">
1165         <xsl:choose>
1166           <xsl:when test="position()&gt;1"/>
1167           <xsl:when test="@tag&lt;700">Author(s): </xsl:when>
1168           <!--#13382 Changed Additional author to contributor -->
1169           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1170         </xsl:choose>
1171         <a>
1172         <xsl:choose>
1173             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1174                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
1175             </xsl:when>
1176             <xsl:otherwise>
1177             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute>
1178             </xsl:otherwise>
1179         </xsl:choose>
1180         <xsl:choose>
1181           <xsl:when test="@tag=100"><xsl:call-template name="nameABCQ"/></xsl:when>
1182           <xsl:when test="@tag=110"><xsl:call-template name="nameABCDN"/></xsl:when>
1183           <xsl:when test="@tag=111"><xsl:call-template name="nameACDEQ"/></xsl:when>
1184             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1185             <!--#13382 Added all relevant subfields 4, e, are handled separately -->
1186             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1187                 <xsl:variable name="str">
1188                     <xsl:call-template name="subfieldSelect">
1189                         <xsl:with-param name="codes">abcdfghiklmnoprstux</xsl:with-param>
1190                     </xsl:call-template>
1191                 </xsl:variable>
1192                 <xsl:call-template name="chopPunctuation">
1193                     <xsl:with-param name="chopString">
1194                         <xsl:value-of select="$str"/>
1195                     </xsl:with-param>
1196                     <xsl:with-param name="punctuation">
1197                         <xsl:text>:,;/. </xsl:text>
1198                     </xsl:with-param>
1199                 </xsl:call-template>
1200             </xsl:when>
1201         </xsl:choose>
1202
1203         <!-- add relator code too between brackets-->
1204     <xsl:if test="marc:subfield[@code='4' or @code='e']">
1205       <span class="relatorcode">
1206       <xsl:text> [</xsl:text>
1207           <xsl:choose>
1208             <xsl:when test="marc:subfield[@code='e']">
1209                 <xsl:for-each select="marc:subfield[@code='e']">
1210                     <xsl:value-of select="."/>
1211                     <xsl:if test="position() != last()">, </xsl:if>
1212                 </xsl:for-each>
1213             </xsl:when>
1214             <xsl:otherwise>
1215                 <xsl:for-each select="marc:subfield[@code=4]">
1216                     <xsl:value-of select="."/>
1217                     <xsl:if test="position() != last()">, </xsl:if>
1218                 </xsl:for-each>
1219             </xsl:otherwise>
1220           </xsl:choose>
1221           <xsl:text>]</xsl:text>
1222       </span>
1223         </xsl:if>
1224         </a>
1225         <xsl:choose>
1226             <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1227         </xsl:choose>
1228         </xsl:for-each>
1229         </h5>
1230
1231         </xsl:if>
1232     </xsl:template>
1233
1234     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1235     <xsl:template name="subfieldSelectSubject">
1236         <xsl:param name="codes"/>
1237         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1238         <xsl:param name="subdivCodes"/>
1239         <xsl:param name="subdivDelimiter"/>
1240         <xsl:param name="prefix"/>
1241         <xsl:param name="suffix"/>
1242         <xsl:variable name="str">
1243             <xsl:for-each select="marc:subfield">
1244                 <xsl:if test="contains($codes, @code)">
1245                     <xsl:if test="contains($subdivCodes, @code)">
1246                         <xsl:value-of select="$subdivDelimiter"/>
1247                     </xsl:if>
1248                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1249                 </xsl:if>
1250             </xsl:for-each>
1251         </xsl:variable>
1252         <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1253     </xsl:template>
1254
1255 </xsl:stylesheet>