Bug 11175: Display components in own tab
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slim2intranetDetail.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet>
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:xsl="http://www.w3.org/1999/XSL/Transform"
10   xmlns:str="http://exslt.org/strings"
11   exclude-result-prefixes="marc str">
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="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
31         <xsl:variable name="TracingQuotesLeft">
32            <xsl:choose>
33              <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICUStyleQuotes']='1'">{</xsl:when>
34              <xsl:otherwise>"</xsl:otherwise>
35            </xsl:choose>
36         </xsl:variable>
37         <xsl:variable name="TracingQuotesRight">
38           <xsl:choose>
39             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICUStyleQuotes']='1'">}</xsl:when>
40             <xsl:otherwise>"</xsl:otherwise>
41           </xsl:choose>
42         </xsl:variable>
43
44         <xsl:variable name="leader" select="marc:leader"/>
45         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
46         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
47         <xsl:variable name="leader19" select="substring($leader,20,1)"/>
48         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
49         <xsl:variable name="materialTypeCode">
50             <xsl:choose>
51                 <xsl:when test="$leader19='a'">ST</xsl:when>
52                 <xsl:when test="$leader6='a'">
53                     <xsl:choose>
54                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
55                         <xsl:when test="$leader7='i' or $leader7='s'">SE</xsl:when>
56                         <xsl:when test="$leader7='a' or $leader7='b'">AR</xsl:when>
57                     </xsl:choose>
58                 </xsl:when>
59                 <xsl:when test="$leader6='t'">BK</xsl:when>
60                 <xsl:when test="$leader6='o' or $leader6='p'">MX</xsl:when>
61                 <xsl:when test="$leader6='m'">CF</xsl:when>
62                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
63                 <xsl:when test="$leader6='g'">VM</xsl:when>
64                 <xsl:when test="$leader6='k'">PK</xsl:when>
65                 <xsl:when test="$leader6='r'">OB</xsl:when>
66                 <xsl:when test="$leader6='i'">MU</xsl:when>
67                 <xsl:when test="$leader6='j'">MU</xsl:when>
68                 <xsl:when test="$leader6='c' or $leader6='d'">PR</xsl:when>
69             </xsl:choose>
70         </xsl:variable>
71         <xsl:variable name="materialTypeLabel">
72             <xsl:choose>
73                 <xsl:when test="$leader19='a'">Set</xsl:when>
74                 <xsl:when test="$leader6='a'">
75                     <xsl:choose>
76                         <xsl:when test="$leader7='c' or $leader7='d' or $leader7='m'">Text</xsl:when>
77                         <xsl:when test="$leader7='i' or $leader7='s'">
78                             <xsl:choose>
79                                 <xsl:when test="substring($controlField008,22,1)!='m'">Continuing resource</xsl:when>
80                                 <xsl:otherwise>Series</xsl:otherwise>
81                             </xsl:choose>
82                         </xsl:when>
83                         <xsl:when test="$leader7='a' or $leader7='b'">Article</xsl:when>
84                     </xsl:choose>
85                 </xsl:when>
86                 <xsl:when test="$leader6='t'">Text</xsl:when>
87                 <xsl:when test="$leader6='o'">Kit</xsl:when>
88                 <xsl:when test="$leader6='p'">Mixed materials</xsl:when>
89                 <xsl:when test="$leader6='m'">Computer file</xsl:when>
90                 <xsl:when test="$leader6='e' or $leader6='f'">Map</xsl:when>
91                 <xsl:when test="$leader6='g'">Film</xsl:when>
92                 <xsl:when test="$leader6='k'">Picture</xsl:when>
93                 <xsl:when test="$leader6='r'">Object</xsl:when>
94                 <xsl:when test="$leader6='j'">Music</xsl:when>
95                 <xsl:when test="$leader6='i'">Sound</xsl:when>
96                 <xsl:when test="$leader6='c' or $leader6='d'">Score</xsl:when>
97             </xsl:choose>
98         </xsl:variable>
99
100         <!-- Indicate if record is suppressed in OPAC -->
101         <xsl:if test="$OpacSuppression = 1">
102             <xsl:if test="marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']">
103                 <span class="results_summary suppressed_opac">Suppressed in OPAC</span>
104             </xsl:if>
105         </xsl:if>
106
107         <!-- Title Statement -->
108         <!-- Alternate Graphic Representation (MARC 880) -->
109         <xsl:if test="$display880">
110             <h1 class="title">
111                 <xsl:call-template name="m880Select">
112                     <xsl:with-param name="basetags">245</xsl:with-param>
113                     <xsl:with-param name="codes">abhfgknps</xsl:with-param>
114                 </xsl:call-template>
115             </h1>
116         </xsl:if>
117
118         <!--Bug 13381 -->
119         <xsl:if test="marc:datafield[@tag=245]">
120             <h1 class="title" property="name">
121                 <xsl:for-each select="marc:datafield[@tag=245]">
122                     <xsl:call-template name="subfieldSelect">
123                         <xsl:with-param name="codes">a</xsl:with-param>
124                     </xsl:call-template>
125                     <xsl:text> </xsl:text>
126                     <!-- 13381 add additional subfields-->
127                     <!-- bz 17625 adding subfields f and g -->
128                     <xsl:for-each select="marc:subfield[contains('bcfghknps', @code)]">
129                         <xsl:choose>
130                             <xsl:when test="@code='h'">
131                                 <!--  13381 Span class around subfield h so it can be suppressed via css -->
132                                 <span class="title_medium"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
133                             </xsl:when>
134                             <xsl:when test="@code='c'">
135                                 <!--  13381 Span class around subfield c so it can be suppressed via css -->
136                                 <span class="title_resp_stmt"><xsl:apply-templates/> <xsl:text> </xsl:text> </span>
137                             </xsl:when>
138                             <xsl:otherwise>
139                                 <xsl:apply-templates/>
140                                 <xsl:text> </xsl:text>
141                             </xsl:otherwise>
142                         </xsl:choose>
143                     </xsl:for-each>
144                 </xsl:for-each>
145             </h1>
146         </xsl:if>
147
148         <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
149         <xsl:if test="$display880">
150             <h5 class="author">
151                 <xsl:call-template name="m880Select">
152                     <xsl:with-param name="basetags">100,110,111,700,710,711</xsl:with-param>
153                     <xsl:with-param name="codes">abc</xsl:with-param>
154                     <xsl:with-param name="index">au</xsl:with-param>
155                     <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
156                     <!-- do not use label 'by ' here, it would be repeated for every occurrence of 100,110,111,700,710,711 -->
157                 </xsl:call-template>
158             </h5>
159         </xsl:if>
160
161         <!-- Author Statement -->
162         <xsl:call-template name="showAuthor">
163             <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
164             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
165         </xsl:call-template>
166
167         <!-- #13382 Suppress 700$i and 7xx/@ind2=2 -->
168         <xsl:call-template name="showAuthor">
169             <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'])]"/>
170             <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
171         </xsl:call-template>
172
173     <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
174         <span class="results_summary type"><span class="label">Material type: </span>
175     <xsl:element name="img"><xsl:attribute name="class">materialtype mt_icon_<xsl:value-of select="$materialTypeCode"/></xsl:attribute><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>
176         <xsl:text> </xsl:text>
177         <xsl:value-of select="$materialTypeLabel"/>
178         </span>
179     </xsl:if>
180
181     <xsl:call-template name="show-lang-041"/>
182
183         <!--Series: Alternate Graphic Representation (MARC 880) -->
184         <xsl:if test="$display880">
185             <xsl:call-template name="m880Select">
186                 <xsl:with-param name="basetags">440,490</xsl:with-param>
187                 <xsl:with-param name="codes">av</xsl:with-param>
188                 <xsl:with-param name="class">results_summary series</xsl:with-param>
189                 <xsl:with-param name="label">Series: </xsl:with-param>
190                 <xsl:with-param name="index">se</xsl:with-param>
191             </xsl:call-template>
192         </xsl:if>
193
194     <xsl:call-template name="show-series">
195         <xsl:with-param name="searchurl">/cgi-bin/koha/catalogue/search.pl</xsl:with-param>
196         <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
197         <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
198     </xsl:call-template>
199
200         <!-- Analytics information -->
201         <xsl:variable name="leader7_class">
202             <xsl:choose>
203                 <!--xsl:when test="$leader7='a'">analytic_mcp</xsl:when-->
204                 <!--xsl:when test="$leader7='b'">analytic_scp</xsl:when-->
205                 <xsl:when test="$leader7='c'">analytic_collection</xsl:when>
206                 <xsl:when test="$leader7='d'">analytic_subunit</xsl:when>
207                 <xsl:when test="$leader7='i'">analytic_ires</xsl:when>
208                 <xsl:when test="$leader7='m'">analytic_monograph</xsl:when>
209                 <xsl:when test="$leader7='s'">analytic_serial</xsl:when>
210                 <xsl:otherwise>analytic_undefined</xsl:otherwise>
211             </xsl:choose>
212         </xsl:variable>
213
214         <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
215         <xsl:if test="$show_analytics_link='1'">
216             <xsl:element name="span">
217                 <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
218                 <span class="label">Analytics: </span>
219                 <a>
220                 <xsl:choose>
221                     <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
222                         <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute>
223                     </xsl:when>
224                     <xsl:otherwise>
225                         <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:(<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/>)</xsl:attribute>
226                     </xsl:otherwise>
227                 </xsl:choose>
228                 <xsl:text>Show analytics</xsl:text>
229                 </a>
230             </xsl:element>
231         </xsl:if>
232
233         <!-- Volumes of sets and traced series -->
234         <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
235         <span class="results_summary volumes"><span class="label">Volumes: </span>
236             <a>
237             <xsl:choose>
238             <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
239                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+NOT+(bib-level:a+OR+bib-level:b)</xsl:attribute>
240             </xsl:when>
241             <xsl:otherwise>
242                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
243             </xsl:otherwise>
244             </xsl:choose>
245             <xsl:text>Show volumes</xsl:text>
246             </a>
247         </span>
248         </xsl:if>
249
250         <!-- Set -->
251         <xsl:if test="$leader19='c'">
252         <span class="results_summary set"><span class="label">Set: </span>
253         <xsl:for-each select="marc:datafield[@tag=773]">
254             <a>
255             <xsl:choose>
256             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
257                 <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>
258             </xsl:when>
259             <xsl:otherwise>
260                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', ''), true())"/></xsl:attribute>
261             </xsl:otherwise>
262             </xsl:choose>
263             <xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
264             </a>
265             <xsl:choose>
266                 <xsl:when test="position()=last()"></xsl:when>
267                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
268             </xsl:choose>
269         </xsl:for-each>
270         </span>
271         </xsl:if>
272
273         <!-- Publisher Statement: Alternate Graphic Representation (MARC 880) -->
274         <xsl:if test="$display880">
275             <xsl:call-template name="m880Select">
276                 <xsl:with-param name="basetags">260</xsl:with-param>
277                 <xsl:with-param name="codes">abcg</xsl:with-param>
278                 <xsl:with-param name="class">results_summary publisher</xsl:with-param>
279                 <xsl:with-param name="label">Publication details: </xsl:with-param>
280             </xsl:call-template>
281         </xsl:if>
282
283         <!-- Publisher info and RDA related info from tags 260, 264 -->
284         <xsl:choose>
285             <xsl:when test="marc:datafield[@tag=264]">
286                 <xsl:call-template name="showRDAtag264">
287                    <xsl:with-param name="show_url">1</xsl:with-param>
288                 </xsl:call-template>
289             </xsl:when>
290             <xsl:when test="marc:datafield[@tag=260]">
291                 <span class="results_summary publisher"><span class="label">Publication details: </span>
292                     <xsl:for-each select="marc:datafield[@tag=260]">
293                         <xsl:for-each select="marc:subfield[@code='a']">
294                             <a>
295                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=pl:"<xsl:value-of select="str:encode-uri(., true())"/>"</xsl:attribute>
296                                 <xsl:value-of select="."/>
297                             </a>
298                             <xsl:if test="position() != last()">
299                                 <xsl:text> </xsl:text>
300                             </xsl:if>
301                         </xsl:for-each>
302                         <xsl:text> </xsl:text>
303                         <xsl:if test="marc:subfield[@code='b']">
304                         <a>
305                             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/>"</xsl:attribute>
306                             <xsl:call-template name="subfieldSelect">
307                                 <xsl:with-param name="codes">b</xsl:with-param>
308                             </xsl:call-template>
309                         </a>
310                         </xsl:if>
311                         <xsl:text> </xsl:text>
312                         <xsl:for-each select="marc:subfield[@code='c']">
313                             <a>
314                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=copydate:"<xsl:value-of select="str:encode-uri(., true())"/>"</xsl:attribute>
315                                 <xsl:value-of select="."/>
316                             </a>
317                             <xsl:if test="position() != last()">
318                                 <xsl:text> </xsl:text>
319                             </xsl:if>
320                         </xsl:for-each>
321                         <xsl:text> </xsl:text>
322                         <xsl:call-template name="chopPunctuation">
323                           <xsl:with-param name="chopString">
324                             <xsl:call-template name="subfieldSelect">
325                                 <xsl:with-param name="codes">g</xsl:with-param>
326                             </xsl:call-template>
327                            </xsl:with-param>
328                        </xsl:call-template>
329                             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
330                     </xsl:for-each>
331                 </span>
332             </xsl:when>
333         </xsl:choose>
334
335         <!-- Edition Statement: Alternate Graphic Representation (MARC 880) -->
336         <xsl:if test="$display880">
337             <xsl:call-template name="m880Select">
338                 <xsl:with-param name="basetags">250</xsl:with-param>
339                 <xsl:with-param name="codes">ab</xsl:with-param>
340                 <xsl:with-param name="class">results_summary edition</xsl:with-param>
341                 <xsl:with-param name="label">Edition: </xsl:with-param>
342             </xsl:call-template>
343         </xsl:if>
344         
345         <xsl:if test="marc:datafield[@tag=250]">
346         <span class="results_summary edition"><span class="label">Edition: </span>
347             <xsl:for-each select="marc:datafield[@tag=250]">
348                 <xsl:call-template name="chopPunctuation">
349                   <xsl:with-param name="chopString">
350                     <xsl:call-template name="subfieldSelect">
351                         <xsl:with-param name="codes">ab</xsl:with-param>
352                     </xsl:call-template>
353                    </xsl:with-param>
354                </xsl:call-template>
355                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
356             </xsl:for-each>
357         </span>
358         </xsl:if>
359
360         <!-- Description: Alternate Graphic Representation (MARC 880) -->
361         <xsl:if test="$display880">
362             <xsl:call-template name="m880Select">
363                 <xsl:with-param name="basetags">300</xsl:with-param>
364                 <xsl:with-param name="codes">abceg</xsl:with-param>
365                 <xsl:with-param name="class">results_summary description</xsl:with-param>
366                 <xsl:with-param name="label">Description: </xsl:with-param>
367             </xsl:call-template>
368         </xsl:if>
369         
370         <xsl:if test="marc:datafield[@tag=300]">
371         <span class="results_summary description"><span class="label">Description: </span>
372             <xsl:for-each select="marc:datafield[@tag=300]">
373                 <xsl:call-template name="chopPunctuation">
374                   <xsl:with-param name="chopString">
375                     <xsl:call-template name="subfieldSelect">
376                         <xsl:with-param name="codes">abcefg</xsl:with-param>
377                     </xsl:call-template>
378                    </xsl:with-param>
379                </xsl:call-template>
380                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
381             </xsl:for-each>
382         </span>
383        </xsl:if>
384
385         <!-- Content Type -->
386         <xsl:if test="marc:datafield[@tag=336] or marc:datafield[@tag=337] or marc:datafield[@tag=338]">
387             <span class="results_summary" id="content_type">
388                 <xsl:if test="marc:datafield[@tag=336]">
389                     <span class="label">Content type: </span>
390                     <xsl:for-each select="marc:datafield[@tag=336]">
391                         <xsl:call-template name="subfieldSelect">
392                             <xsl:with-param name="codes">a</xsl:with-param>
393                             <xsl:with-param name="delimeter">, </xsl:with-param>
394                         </xsl:call-template>
395                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
396                     </xsl:for-each>
397                 </xsl:if>
398                 <xsl:text> </xsl:text>
399                 <!-- Media Type -->
400                 <xsl:if test="marc:datafield[@tag=337]">
401                     <span class="label">Media type: </span>
402                     <xsl:for-each select="marc:datafield[@tag=337]">
403                         <xsl:call-template name="subfieldSelect">
404                             <xsl:with-param name="codes">a</xsl:with-param>
405                             <xsl:with-param name="delimeter">, </xsl:with-param>
406                         </xsl:call-template>
407                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
408                     </xsl:for-each>
409                 </xsl:if>
410                 <xsl:text> </xsl:text>
411                 <!-- Media Type -->
412                 <xsl:if test="marc:datafield[@tag=338]">
413                     <span class="label">Carrier type: </span>
414                     <xsl:for-each select="marc:datafield[@tag=338]">
415                         <xsl:call-template name="subfieldSelect">
416                             <xsl:with-param name="codes">a</xsl:with-param>
417                             <xsl:with-param name="delimeter">, </xsl:with-param>
418                         </xsl:call-template>
419                         <xsl:if test="position() != last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
420                     </xsl:for-each>
421                 </xsl:if>
422             </span>
423         </xsl:if>
424
425         <!-- 385 - Audience -->
426         <xsl:if test="marc:datafield[@tag=385]">
427             <span class="results_summary audience">
428                 <span class="label">Audience: </span>
429                 <xsl:for-each select="marc:datafield[@tag=385]">
430                     <xsl:if test="marc:subfield[@code='m']">
431                         <xsl:call-template name="chopPunctuation">
432                             <xsl:with-param name="chopString">
433                                 <xsl:call-template name="subfieldSelect">
434                                     <xsl:with-param name="codes">m</xsl:with-param>
435                                 </xsl:call-template>
436                             </xsl:with-param>
437                         </xsl:call-template>
438                         <xsl:text>: </xsl:text>
439                     </xsl:if>
440                         <xsl:call-template name="chopPunctuation">
441                             <xsl:with-param name="chopString">
442                                 <xsl:call-template name="subfieldSelect">
443                                     <xsl:with-param name="codes">a</xsl:with-param>
444                                     <xsl:with-param name="delimeter">, </xsl:with-param>
445                                 </xsl:call-template>
446                             </xsl:with-param>
447                         </xsl:call-template>
448                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise></xsl:choose>
449                 </xsl:for-each>
450             </span>
451         </xsl:if>
452
453         <xsl:call-template name="showISBNISSN"/>
454
455         <xsl:if test="marc:datafield[@tag=013]">
456             <span class="results_summary patent_info">
457                 <span class="label">Patent information: </span>
458                 <xsl:for-each select="marc:datafield[@tag=013]">
459                     <xsl:call-template name="subfieldSelect">
460                         <xsl:with-param name="codes">acdef</xsl:with-param>
461                         <xsl:with-param name="delimeter">, </xsl:with-param>
462                     </xsl:call-template>
463                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
464                 </xsl:for-each>
465             </span>
466         </xsl:if>
467
468         <xsl:if test="marc:datafield[@tag=088]">
469             <span class="results_summary report_number">
470                 <span class="label">Report number: </span>
471                 <xsl:for-each select="marc:datafield[@tag=088]">
472                     <xsl:call-template name="subfieldSelect">
473                         <xsl:with-param name="codes">a</xsl:with-param>
474                     </xsl:call-template>
475                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
476                 </xsl:for-each>
477             </span>
478         </xsl:if>
479
480         <!-- Other Title  Statement: Alternate Graphic Representation (MARC 880) -->
481         <xsl:if test="$display880">
482             <xsl:call-template name="m880Select">
483                 <xsl:with-param name="basetags">246</xsl:with-param>
484                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
485                 <xsl:with-param name="class">results_summary other_title</xsl:with-param>
486                 <xsl:with-param name="label">Other title: </xsl:with-param>
487             </xsl:call-template>
488         </xsl:if>
489
490         <xsl:if test="marc:datafield[@tag=246]">
491             <span class="results_summary other_title"><span class="label">Other title: </span>
492                 <xsl:for-each select="marc:datafield[@tag=246]">
493                     <xsl:if test="marc:subfield[@code='i']">
494                             <xsl:call-template name="subfieldSelect">
495                                     <xsl:with-param name="codes">i</xsl:with-param>
496                             </xsl:call-template>
497                     </xsl:if>
498                        <xsl:text> </xsl:text>
499                     <xsl:call-template name="chopPunctuation">
500                         <xsl:with-param name="chopString">
501                             <xsl:call-template name="subfieldSelect">
502                                 <xsl:with-param name="codes">abhfgnp</xsl:with-param>
503                             </xsl:call-template>
504                         </xsl:with-param>
505                     </xsl:call-template>
506                     <xsl:if test="@ind1=1 and not(marc:subfield[@code='i'])">
507                         <xsl:choose>
508                             <xsl:when test="@ind2=0"> [Portion of title]</xsl:when>
509                             <xsl:when test="@ind2=1"> [Parallel title]</xsl:when>
510                             <xsl:when test="@ind2=2"> [Distinctive title]</xsl:when>
511                             <xsl:when test="@ind2=3"> [Other title]</xsl:when>
512                             <xsl:when test="@ind2=4"> [Cover title]</xsl:when>
513                             <xsl:when test="@ind2=5"> [Added title page title]</xsl:when>
514                             <xsl:when test="@ind2=6"> [Caption title]</xsl:when>
515                             <xsl:when test="@ind2=7"> [Running title]</xsl:when>
516                             <xsl:when test="@ind2=8"> [Spine title]</xsl:when>
517                         </xsl:choose>
518                     </xsl:if>
519                     <!-- #13386 added separator | -->
520                     <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>
521                 </xsl:for-each>
522             </span>
523         </xsl:if>
524
525         <xsl:if test="marc:datafield[@tag=242]">
526         <span class="results_summary translated_title"><span class="label">Title translated: </span>
527             <xsl:for-each select="marc:datafield[@tag=242]">
528                 <xsl:call-template name="chopPunctuation">
529                   <xsl:with-param name="chopString">
530                     <xsl:call-template name="subfieldSelect">
531                         <xsl:with-param name="codes">abchnp</xsl:with-param>
532                     </xsl:call-template>
533                    </xsl:with-param>
534                </xsl:call-template>
535                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
536             </xsl:for-each>
537         </span>
538        </xsl:if>
539
540         <!-- Uniform Title  Statement: Alternate Graphic Representation (MARC 880) -->
541         <xsl:if test="$display880">
542             <xsl:call-template name="m880Select">
543                 <xsl:with-param name="basetags">130,240</xsl:with-param>
544                 <xsl:with-param name="codes">adfklmor</xsl:with-param>
545                 <xsl:with-param name="class">results_summary uniform_title</xsl:with-param>
546                 <xsl:with-param name="label">Uniform title: </xsl:with-param>
547             </xsl:call-template>
548         </xsl:if>
549
550         <xsl:if test="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
551             <span class="results_summary uniform_title"><span class="label">Uniform titles: </span>
552                 <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
553                     <xsl:if test="marc:subfield[@code='i']">
554                             <xsl:call-template name="subfieldSelect">
555                                     <xsl:with-param name="codes">i</xsl:with-param>
556                             </xsl:call-template>
557                     </xsl:if>
558                     <xsl:text> </xsl:text>
559                     <xsl:for-each select="marc:subfield">
560                         <xsl:if test="contains('adfghklmnoprst',@code)">
561                             <xsl:value-of select="text()"/>
562                             <xsl:text> </xsl:text>
563                         </xsl:if>
564                     </xsl:for-each>
565                     <xsl:if test="position() != last()">
566                         <span class="separator"><xsl:text> | </xsl:text></span>
567                     </xsl:if>
568                 </xsl:for-each>
569             </span>
570         </xsl:if>
571
572         <!-- #13382 Added Related works 700$i -->
573         <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']]">
574             <span class="results_summary related_works"><span class="label">Related works: </span>
575                 <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']]">
576                     <xsl:variable name="str">
577                         <xsl:call-template name="subfieldSelect">
578                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
579                         </xsl:call-template>
580                     </xsl:variable>
581                     <xsl:call-template name="chopPunctuation">
582                         <xsl:with-param name="chopString">
583                             <xsl:value-of select="$str"/>
584                         </xsl:with-param>
585                     </xsl:call-template>
586                     <!-- add relator code too between brackets-->
587                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
588                         <span class="relatorcode">
589                             <xsl:text> [</xsl:text>
590                             <xsl:choose>
591                                 <xsl:when test="marc:subfield[@code='e']">
592                                     <xsl:for-each select="marc:subfield[@code='e']">
593                                         <xsl:value-of select="."/>
594                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
595                                     </xsl:for-each>
596                                 </xsl:when>
597                                 <xsl:otherwise>
598                                     <xsl:for-each select="marc:subfield[@code='4']">
599                                         <xsl:value-of select="."/>
600                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
601                                     </xsl:for-each>
602                                 </xsl:otherwise>
603                             </xsl:choose>
604                             <xsl:text>]</xsl:text>
605                         </span>
606                     </xsl:if>
607                     <xsl:choose>
608                         <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
609                     </xsl:choose>
610                 </xsl:for-each>
611             </span>
612         </xsl:if>
613
614         <!-- #13382 Added Contained Works 7xx@ind2=2 -->
615         <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'])]">
616             <span class="results_summary contained_works"><span class="label">Contained works: </span>
617                 <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'])]">
618                     <xsl:variable name="str">
619                         <xsl:call-template name="subfieldSelect">
620                             <xsl:with-param name="codes">abcdfghiklmnporstux</xsl:with-param>
621                         </xsl:call-template>
622                     </xsl:variable>
623                     <xsl:call-template name="chopPunctuation">
624                         <xsl:with-param name="chopString">
625                             <xsl:value-of select="$str"/>
626                         </xsl:with-param>
627                     </xsl:call-template>
628                     <!-- add relator code too between brackets-->
629                     <xsl:if test="marc:subfield[@code='4' or @code='e']">
630                         <span class="relatorcode">
631                             <xsl:text> [</xsl:text>
632                             <xsl:choose>
633                                 <xsl:when test="marc:subfield[@code='e']">
634                                     <xsl:for-each select="marc:subfield[@code='e']">
635                                         <xsl:value-of select="."/>
636                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
637                                     </xsl:for-each>
638                                 </xsl:when>
639                                 <xsl:otherwise>
640                                     <xsl:for-each select="marc:subfield[@code='4']">
641                                         <xsl:value-of select="."/>
642                                         <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
643                                     </xsl:for-each>
644                                 </xsl:otherwise>
645                             </xsl:choose>
646                             <xsl:text>]</xsl:text>
647                         </span>
648                     </xsl:if>
649                     <xsl:choose>
650                         <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
651                     </xsl:choose>
652                 </xsl:for-each>
653             </span>
654         </xsl:if>
655
656
657         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6' and not(@tag=655)]">
658             <span class="results_summary subjects"><span class="label">Subject(s): </span>
659             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6'][not(@tag=655)]">
660             <a>
661             <xsl:choose>
662             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
663             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
664                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
665             </xsl:when>
666             <xsl:when test="$TraceSubjectSubdivisions='1'">
667                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
668                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
669                         <xsl:with-param name="delimeter"> AND </xsl:with-param>
670                         <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
671                         <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
672                         <xsl:with-param name="urlencode">1</xsl:with-param>
673                     </xsl:call-template>
674                 </xsl:attribute>
675             </xsl:when>
676
677             <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
678             <xsl:otherwise>
679                 <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="str:encode-uri(translate(marc:subfield[@code='a'],'()',''), true())"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
680             </xsl:otherwise>
681             </xsl:choose>
682
683             <xsl:call-template name="chopPunctuation">
684                 <xsl:with-param name="chopString">
685                     <xsl:call-template name="subfieldSelect">
686                         <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
687                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
688                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
689                     </xsl:call-template>
690                 </xsl:with-param>
691             </xsl:call-template>
692             </a>
693
694             <xsl:if test="marc:subfield[@code=9]">
695                 <xsl:text> </xsl:text>
696                 <a class='authlink'>
697                     <xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
698                     <xsl:element name="img">
699                         <xsl:attribute name="src">/intranet-tmpl/prog/img/filefind.png</xsl:attribute>
700                         <xsl:attribute name="alt"></xsl:attribute>
701                         <xsl:attribute name="height">15</xsl:attribute>
702                         <xsl:attribute name="width">15</xsl:attribute>
703                     </xsl:element>
704                 </a>
705             </xsl:if>
706
707             <xsl:choose>
708             <xsl:when test="position()=last()"></xsl:when>
709             <xsl:otherwise> | </xsl:otherwise>
710             </xsl:choose>
711
712             </xsl:for-each>
713             </span>
714         </xsl:if>
715
716         <!-- Genre/Form -->
717         <xsl:if test="marc:datafield[@tag=655]">
718             <span class="results_summary genre"><span class="label">Genre/Form: </span>
719                 <xsl:for-each select="marc:datafield[@tag=655]">
720                     <a>
721                         <xsl:choose>
722                             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
723                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
724                             </xsl:when>
725                             <xsl:when test="$TraceSubjectSubdivisions='1'">
726                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
727                                     <xsl:with-param name="codes">avxyz</xsl:with-param>
728                                     <xsl:with-param name="delimeter"> AND </xsl:with-param>
729                                     <xsl:with-param name="prefix">(index-term-genre<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
730                                     <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
731                                     <xsl:with-param name="urlencode">1</xsl:with-param>
732                                 </xsl:call-template>
733                                 </xsl:attribute>
734                             </xsl:when>
735                             <xsl:otherwise>
736                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=index-term-genre<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>
737                             </xsl:otherwise>
738                         </xsl:choose>
739                     <xsl:call-template name="subfieldSelect">
740                         <xsl:with-param name="codes">avxyz</xsl:with-param>
741                         <xsl:with-param name="subdivCodes">vxyz</xsl:with-param>
742                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
743                     </xsl:call-template>
744                     </a>
745
746                     <xsl:if test="marc:subfield[@code=9]">
747                         <xsl:text> </xsl:text>
748                         <a class='authlink'>
749                             <xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
750                             <xsl:element name="img">
751                                 <xsl:attribute name="src">/intranet-tmpl/prog/img/filefind.png</xsl:attribute>
752                                 <xsl:attribute name="alt"></xsl:attribute>
753                                 <xsl:attribute name="height">15</xsl:attribute>
754                                 <xsl:attribute name="width">15</xsl:attribute>
755                             </xsl:element>
756                         </a>
757                     </xsl:if>
758                     <xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
759                 </xsl:for-each>
760             </span>
761         </xsl:if>
762
763 <!-- MARC21 776 Additional Physical Form Entry -->
764     <xsl:if test="marc:datafield[@tag=776]">
765         <span class="results_summary add_physical_form">
766             <span class="label">Additional physical formats: </span>
767             <xsl:for-each select="marc:datafield[@tag=776]">
768                 <xsl:variable name="linktext">
769                     <xsl:choose>
770                     <xsl:when test="marc:subfield[@code='t']">
771                         <xsl:value-of select="marc:subfield[@code='t']"/>
772                     </xsl:when>
773                     <xsl:when test="marc:subfield[@code='a']">
774                         <xsl:value-of select="marc:subfield[@code='a']"/>
775                     </xsl:when>
776                     <xsl:otherwise>
777                         <xsl:text>No title</xsl:text>
778                     </xsl:otherwise>
779                     </xsl:choose>
780                 </xsl:variable>
781                 <xsl:if test="@ind2=8 and marc:subfield[@code='i']">
782                     <xsl:call-template name="subfieldSelect">
783                         <xsl:with-param name="codes">i</xsl:with-param>
784                     </xsl:call-template>
785                     <xsl:text>: </xsl:text>
786                 </xsl:if>
787                 <xsl:choose>
788                 <xsl:when test="marc:subfield[@code='w']">
789                     <a>
790                     <xsl:attribute name="href">
791                         <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=control-number:</xsl:text>
792                         <xsl:call-template name="extractControlNumber">
793                             <xsl:with-param name="subfieldW">
794                                 <xsl:value-of select="marc:subfield[@code='w']"/>
795                             </xsl:with-param>
796                         </xsl:call-template>
797                     </xsl:attribute>
798                     <xsl:value-of select="$linktext"/>
799                     </a>
800                 </xsl:when>
801                 <xsl:otherwise>
802                     <xsl:value-of select="$linktext"/>
803                 </xsl:otherwise>
804                 </xsl:choose>
805                 <xsl:if test="position() != last()">
806                     <xsl:text>; </xsl:text>
807                 </xsl:if>
808             </xsl:for-each>
809         </span>
810     </xsl:if>
811
812 <!-- MARC21 777 - Issued With Entry -->
813     <xsl:if test="marc:datafield[@tag=777]">
814         <xsl:for-each select="marc:datafield[@tag=777]">
815             <xsl:if test="@ind1 != 1">
816                 <span class="results_summary issued_with">
817                     <span class="label">
818                         <xsl:choose>
819                             <xsl:when test="@ind2=8 and marc:subfield[@code='i']">
820                                 <xsl:value-of select="marc:subfield[@code='i']"/>
821                             </xsl:when>
822                             <xsl:otherwise>
823                                 <xsl:text>Issued with:</xsl:text>
824                             </xsl:otherwise>
825                         </xsl:choose>
826                         <xsl:text> </xsl:text>
827                     </span>
828                     <xsl:variable name="f777">
829                         <xsl:call-template name="chopPunctuation">
830                             <xsl:with-param name="chopString">
831                                 <xsl:call-template name="subfieldSelect">
832                                     <xsl:with-param name="codes">a_t</xsl:with-param>
833                                 </xsl:call-template>
834                             </xsl:with-param>
835                         </xsl:call-template>
836                     </xsl:variable>
837                     <xsl:choose>
838                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
839                             <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>
840                             <xsl:value-of select="translate($f777, '()', '')"/>
841                             </a>
842                         </xsl:when>
843                         <xsl:otherwise>
844                             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(marc:subfield[@code='t'], true())"/></xsl:attribute>
845                             <xsl:value-of select="$f777"/>
846                             </a>
847                         </xsl:otherwise>
848                     </xsl:choose>
849                     <xsl:if test="marc:subfield[@code='g']">
850                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
851                     </xsl:if>
852                 </span>
853                 <xsl:if test="marc:subfield[@code='n']">
854                     <xsl:text> </xsl:text><span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
855                 </xsl:if>
856             </xsl:if>
857         </xsl:for-each>
858     </xsl:if>
859
860 <!-- Publisher or Distributor Number -->
861     <xsl:if test="marc:datafield[@tag=028]">
862         <span class="results_summary publisher_number ">
863             <span class="label">Publisher number: </span>
864             <xsl:for-each select="marc:datafield[@tag=028]">
865                 <xsl:call-template name="subfieldSelect">
866                     <xsl:with-param name="codes">abq</xsl:with-param>
867                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
868                 </xsl:call-template>
869             </xsl:for-each>
870         </span>
871     </xsl:if>
872
873 <!-- DDC classification -->
874     <xsl:if test="marc:datafield[@tag=082]">
875         <span class="results_summary ddc">
876             <span class="label">DDC classification: </span>
877             <xsl:for-each select="marc:datafield[@tag=082]">
878                 <xsl:call-template name="subfieldSelect">
879                     <xsl:with-param name="codes">a</xsl:with-param>
880                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
881                 </xsl:call-template>
882                 <xsl:choose>
883                     <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
884                     <xsl:otherwise> | </xsl:otherwise>
885                 </xsl:choose>
886             </xsl:for-each>
887         </span>
888     </xsl:if>
889
890 <!-- LOC classification -->
891     <xsl:if test="marc:datafield[@tag=050]">
892         <span class="results_summary loc">
893             <span class="label">LOC classification: </span>
894             <xsl:for-each select="marc:datafield[@tag=050]">
895                 <xsl:call-template name="subfieldSelect">
896                     <xsl:with-param name="codes">ab</xsl:with-param>
897                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
898                 </xsl:call-template>
899             </xsl:for-each>
900         </span>
901     </xsl:if>
902
903 <!-- NLM classification -->
904     <xsl:if test="marc:datafield[@tag=060]">
905         <span class="results_summary nlm">
906             <span class="label">NLM classification: </span>
907             <xsl:for-each select="marc:datafield[@tag=060]">
908                 <xsl:call-template name="subfieldSelect">
909                     <xsl:with-param name="codes">a</xsl:with-param>
910                     <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
911                 </xsl:call-template>
912                 <xsl:if test="not(position()=last())"><xsl:text> | </xsl:text></xsl:if>
913             </xsl:for-each>
914         </span>
915     </xsl:if>
916
917 <!-- Other classification -->
918     <xsl:if test="marc:datafield[@tag=084]">
919        <span class="results_summary oc">
920            <span class="label">Other classification: </span>
921           <xsl:for-each select="marc:datafield[@tag=084]">
922                 <xsl:call-template name="subfieldSelect">
923                    <xsl:with-param name="codes">a</xsl:with-param>
924                    <xsl:with-param name="delimeter"><xsl:text> | </xsl:text></xsl:with-param>
925                 </xsl:call-template>
926                 <xsl:choose>
927                    <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
928                    <xsl:otherwise> | </xsl:otherwise>
929                 </xsl:choose>
930           </xsl:for-each>
931        </span>
932     </xsl:if>
933
934     <xsl:if test="marc:datafield[@tag=856]">
935         <span class="results_summary online_resources"><span class="label">Online resources: </span>
936         <xsl:for-each select="marc:datafield[@tag=856]">
937             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
938             <a>
939                 <xsl:attribute name="href">
940                     <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
941                         <xsl:choose>
942                             <xsl:when test="@ind1=7">
943                                 <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
944                             </xsl:when>
945                             <xsl:when test="@ind1=1">
946                                 <xsl:text>ftp://</xsl:text>
947                             </xsl:when>
948                             <xsl:otherwise>
949                                 <xsl:text>http://</xsl:text>
950                             </xsl:otherwise>
951                         </xsl:choose>
952                     </xsl:if>
953                     <xsl:value-of select="marc:subfield[@code='u']"/>
954                 </xsl:attribute>
955                 <xsl:choose>
956                     <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')">
957                         <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>
958                     </xsl:when>
959                     <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
960                         <xsl:call-template name="subfieldSelect">
961                             <xsl:with-param name="codes">y3z</xsl:with-param>
962                         </xsl:call-template>
963                     </xsl:when>
964                     <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
965                         <xsl:choose>
966                             <xsl:when test="$URLLinkText!=''">
967                                 <xsl:value-of select="$URLLinkText"/>
968                             </xsl:when>
969                             <xsl:otherwise>
970                                 <xsl:text>Click here to access online</xsl:text>
971                             </xsl:otherwise>
972                         </xsl:choose>
973                     </xsl:when>
974                 </xsl:choose>
975             </a>
976             <xsl:choose>
977                 <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
978                 <xsl:otherwise> | </xsl:otherwise>
979             </xsl:choose>
980
981         </xsl:for-each>
982         </span>
983     </xsl:if>
984
985         <!-- 505 - Formatted contents note -->
986         <xsl:if test="marc:datafield[@tag=505]">
987             <div class="results_summary contents">
988             <xsl:choose>
989                 <xsl:when test="marc:datafield[@tag=505]/@ind1=0">
990                     <span class="label">Contents:</span>
991                 </xsl:when>
992                 <xsl:when test="marc:datafield[@tag=505]/@ind1=1">
993                     <span class="label">Incomplete contents:</span>
994                 </xsl:when>
995                 <xsl:when test="marc:datafield[@tag=505]/@ind1=2">
996                     <span class="label">Partial contents:</span>
997                 </xsl:when>
998             </xsl:choose>
999                 <xsl:for-each select="marc:datafield[@tag=505]">
1000                     <div class='contentblock'>
1001                         <xsl:choose>
1002                         <xsl:when test="@ind2=0">
1003                             <xsl:call-template name="subfieldSelectSpan">
1004                                 <xsl:with-param name="newline">1</xsl:with-param>
1005                                 <xsl:with-param name="codes">trug</xsl:with-param>
1006                             </xsl:call-template>
1007                         </xsl:when>
1008                         <xsl:otherwise>
1009                             <xsl:call-template name="subfieldSelectSpan">
1010                                 <xsl:with-param name="newline">1</xsl:with-param>
1011                                 <xsl:with-param name="codes">atrug</xsl:with-param>
1012                             </xsl:call-template>
1013                         </xsl:otherwise>
1014                         </xsl:choose>
1015                     </div>
1016                 </xsl:for-each>
1017             </div>
1018         </xsl:if>
1019
1020         <!-- 586 -->
1021         <xsl:if test="marc:datafield[@tag=586]">
1022             <span class="results_summary awardsnote">
1023                 <xsl:if test="marc:datafield[@tag=586]/@ind1=' '">
1024                     <span class="label">Awards: </span>
1025                 </xsl:if>
1026                 <xsl:for-each select="marc:datafield[@tag=586]">
1027                     <xsl:value-of select="marc:subfield[@code='a']"/>
1028                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1029                 </xsl:for-each>
1030             </span>
1031         </xsl:if>
1032
1033         <!-- 508 -->
1034         <xsl:if test="marc:datafield[@tag=508]">
1035             <span class="results_summary prod_credits">
1036                 <span class="label">Production credits: </span>
1037                 <xsl:for-each select="marc:datafield[@tag=508]">
1038                     <xsl:call-template name="subfieldSelectSpan">
1039                         <xsl:with-param name="codes">a</xsl:with-param>
1040                     </xsl:call-template>
1041                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1042                 </xsl:for-each>
1043             </span>
1044         </xsl:if>
1045
1046          <!-- 583 -->
1047          <xsl:if test="marc:datafield[@tag=583]">
1048             <span class="results_summary actionnote">
1049                 <span class="label">Action note: </span>
1050                 <xsl:for-each select="marc:datafield[@tag=583]">
1051                     <xsl:choose>
1052                         <xsl:when test="marc:subfield[@code='z']">
1053                             <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text>
1054                         </xsl:when>
1055                         <xsl:otherwise>
1056                             <xsl:call-template name="subfieldSelect">
1057                                 <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param>
1058                             </xsl:call-template>
1059                         </xsl:otherwise>
1060                     </xsl:choose>
1061                     <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if>
1062                 </xsl:for-each>
1063             </span>
1064          </xsl:if>
1065
1066         <!-- 773 -->
1067         <xsl:if test="marc:datafield[@tag=773]">
1068             <xsl:for-each select="marc:datafield[@tag=773]">
1069                 <xsl:if test="@ind1 !=1">
1070                     <span class="results_summary in"><span class="label">
1071                     <xsl:choose>
1072                         <xsl:when test="@ind2=' '">
1073                             In:
1074                         </xsl:when>
1075                         <xsl:when test="@ind2=8">
1076                             <xsl:if test="marc:subfield[@code='i']">
1077                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1078                             </xsl:if>
1079                         </xsl:when>
1080                     </xsl:choose>
1081                     </span>
1082                     <xsl:variable name="f773">
1083                         <xsl:call-template name="chopPunctuation">
1084                             <xsl:with-param name="chopString">
1085                                 <xsl:call-template name="subfieldSelect">
1086                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1087                                 </xsl:call-template>
1088                             </xsl:with-param>
1089                         </xsl:call-template>
1090                     </xsl:variable>
1091                     <xsl:choose>
1092                         <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1093                             <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>
1094                             <xsl:value-of select="translate($f773, '()', '')"/>
1095                             </a>
1096                         </xsl:when>
1097                         <xsl:when test="marc:subfield[@code='0']">
1098                             <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:subfield[@code='0'], true())"/></xsl:attribute>
1099                             <xsl:value-of select="$f773"/>
1100                             </a>
1101                         </xsl:when>
1102                         <xsl:otherwise>
1103                             <a>
1104                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''), true())"/><xsl:if test="marc:subfield[@code='a']">+AND+au:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='a'], '()', ''), true())"/></xsl:if></xsl:attribute>
1105                                 <xsl:value-of select="$f773"/>
1106                             </a>
1107                         </xsl:otherwise>
1108                     </xsl:choose>
1109                     <xsl:if test="marc:subfield[@code='g']">
1110                         <xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/>
1111                     </xsl:if>
1112                     </span>
1113
1114                     <xsl:if test="marc:subfield[@code='n']">
1115                         <span class="results_summary in_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1116                     </xsl:if>
1117
1118                 </xsl:if>
1119             </xsl:for-each>
1120         </xsl:if>
1121
1122         <xsl:if test="marc:datafield[@tag=502]">
1123             <span class="results_summary diss_note">
1124                 <span class="label">Dissertation note: </span>
1125                 <xsl:for-each select="marc:datafield[@tag=502]">
1126                     <xsl:call-template name="subfieldSelect">
1127                         <xsl:with-param name="codes">abcdgo</xsl:with-param>
1128                     </xsl:call-template>
1129                 </xsl:for-each>
1130                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise></xsl:choose>
1131             </span>
1132         </xsl:if>
1133
1134         <!-- 866 textual holdings -->
1135         <xsl:if test="marc:datafield[@tag=866]">
1136             <span class="results_summary holdings_note basic_bibliographic_unit"><span class="label">Holdings: </span>
1137                 <xsl:for-each select="marc:datafield[@tag=866]">
1138                     <span class="holdings_note_data">
1139                         <xsl:call-template name="subfieldSelect">
1140                             <xsl:with-param name="codes">axz</xsl:with-param>
1141                         </xsl:call-template>
1142                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1143                     </span>
1144                 </xsl:for-each>
1145             </span>
1146         </xsl:if>
1147
1148         <!-- 867 textual holdings -->
1149         <xsl:if test="marc:datafield[@tag=867]">
1150             <span class="results_summary holdings_note supplementary_material"><span class="label">Supplements: </span>
1151                 <xsl:for-each select="marc:datafield[@tag=867]">
1152                     <span class="holdings_note_data">
1153                         <xsl:call-template name="subfieldSelect">
1154                             <xsl:with-param name="codes">axz</xsl:with-param>
1155                         </xsl:call-template>
1156                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
1157                     </span>
1158                 </xsl:for-each>
1159             </span>
1160         </xsl:if>
1161
1162         <!-- 868 textual holdings -->
1163         <xsl:if test="marc:datafield[@tag=868]">
1164             <span class="results_summary holdings_note indexes"><span class="label">Indexes: </span>
1165                 <xsl:for-each select="marc:datafield[@tag=868]">
1166                     <span class="holdings_note_data">
1167                         <xsl:call-template name="subfieldSelect">
1168                             <xsl:with-param name="codes">axz</xsl:with-param>
1169                         </xsl:call-template>
1170                         <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text><br /></xsl:otherwise></xsl:choose>
1171                     </span>
1172                 </xsl:for-each>
1173             </span>
1174         </xsl:if>
1175
1176         <!-- 770 - Supplement/Special issue entry -->
1177         <xsl:if test="marc:datafield[@tag=770]">
1178             <span class="results_summary supplement"><span class="label">Supplement: </span>
1179                 <xsl:for-each select="marc:datafield[@tag=770]">
1180                     <xsl:if test="marc:subfield[@code='i']">
1181                         <span class="770_rel_info">
1182                             <xsl:call-template name="subfieldSelect">
1183                                 <xsl:with-param name="codes">i</xsl:with-param>
1184                             </xsl:call-template>
1185                             <xsl:text> </xsl:text>
1186                         </span>
1187                     </xsl:if>
1188                     <a>
1189                         <xsl:choose>
1190                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1191                                 <xsl:attribute name="href">
1192                                     /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>
1193                                 </xsl:attribute>
1194                             </xsl:when>
1195                             <xsl:otherwise>
1196                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
1197                             </xsl:otherwise>
1198                         </xsl:choose>
1199                         <xsl:choose>
1200                             <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1201                                 <xsl:call-template name="subfieldSelect">
1202                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1203                                 </xsl:call-template>
1204                             </xsl:when>
1205                         </xsl:choose>
1206                     </a>
1207                     <xsl:text> </xsl:text>
1208                     <xsl:call-template name="subfieldSelect">
1209                         <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1210                     </xsl:call-template>
1211                     <xsl:choose>
1212                         <xsl:when test="position()=last()"></xsl:when>
1213                         <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
1214                     </xsl:choose>
1215                 </xsl:for-each>
1216             </span>
1217         </xsl:if>
1218
1219         <!-- 772 - Supplement parent entry -->
1220         <xsl:if test="marc:datafield[@tag=772]">
1221             <span class="results_summary supplement_parent"><span class="label">Supplement to: </span>
1222                 <xsl:for-each select="marc:datafield[@tag=772]">
1223                     <xsl:if test="marc:subfield[@code='i']">
1224                         <span class="772_rel_info">
1225                             <xsl:call-template name="subfieldSelect">
1226                                 <xsl:with-param name="codes">i</xsl:with-param>
1227                             </xsl:call-template>
1228                             <xsl:text> </xsl:text>
1229                         </span>
1230                     </xsl:if>
1231                     <a>
1232                         <xsl:choose>
1233                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1234                                 <xsl:attribute name="href">
1235                                     /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>
1236                                 </xsl:attribute>
1237                             </xsl:when>
1238                             <xsl:otherwise>
1239                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
1240                             </xsl:otherwise>
1241                         </xsl:choose>
1242                         <xsl:choose>
1243                             <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
1244                                 <xsl:call-template name="subfieldSelect">
1245                                     <xsl:with-param name="codes">a_t</xsl:with-param>
1246                                 </xsl:call-template>
1247                             </xsl:when>
1248                         </xsl:choose>
1249                     </a>
1250                     <xsl:call-template name="subfieldSelect">
1251                         <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
1252                     </xsl:call-template>
1253                     <xsl:choose>
1254                         <xsl:when test="position()=last()"></xsl:when>
1255                         <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
1256                     </xsl:choose>
1257                 </xsl:for-each>
1258             </span>
1259         </xsl:if>
1260
1261         <!--  775 Other Edition  -->
1262         <xsl:if test="marc:datafield[@tag=775]">
1263         <span class="results_summary other_editions"><span class="label">Other editions: </span>
1264         <xsl:for-each select="marc:datafield[@tag=775]">
1265             <xsl:variable name="f775">
1266                 <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect">
1267                 <xsl:with-param name="codes">a_t</xsl:with-param>
1268                 </xsl:call-template></xsl:with-param></xsl:call-template>
1269             </xsl:variable>
1270             <xsl:if test="marc:subfield[@code='i']">
1271                 <xsl:call-template name="subfieldSelect">
1272                     <xsl:with-param name="codes">i</xsl:with-param>
1273                 </xsl:call-template>
1274                 <xsl:text>: </xsl:text>
1275             </xsl:if>
1276             <a>
1277             <xsl:choose>
1278             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1279                 <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>
1280             </xsl:when>
1281             <xsl:otherwise>
1282                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f775, '()', ''), true())"/></xsl:attribute>
1283             </xsl:otherwise>
1284             </xsl:choose>
1285             <xsl:call-template name="subfieldSelect">
1286                 <xsl:with-param name="codes">a_t</xsl:with-param>
1287             </xsl:call-template>
1288             </a>
1289             <xsl:choose>
1290                 <xsl:when test="position()=last()"></xsl:when>
1291                 <xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
1292             </xsl:choose>
1293         </xsl:for-each>
1294         </span>
1295         </xsl:if>
1296
1297         <!-- 780 -->
1298         <xsl:if test="marc:datafield[@tag=780]">
1299             <xsl:for-each select="marc:datafield[@tag=780]">
1300                 <xsl:if test="@ind1=0">
1301                     <span class="results_summary preceeding_entry">
1302                         <xsl:choose>
1303                             <xsl:when test="@ind2=0">
1304                                <span class="label">Continues:</span>
1305                             </xsl:when>
1306                             <xsl:when test="@ind2=1">
1307                                <span class="label">Continues in part:</span>
1308                             </xsl:when>
1309                             <xsl:when test="@ind2=2">
1310                                <span class="label">Supersedes:</span>
1311                             </xsl:when>
1312                             <xsl:when test="@ind2=3">
1313                                <span class="label">Supersedes in part:</span>
1314                             </xsl:when>
1315                             <xsl:when test="@ind2=4">
1316                                <span class="label">Formed by the union: ... and: ...</span>
1317                             </xsl:when>
1318                             <xsl:when test="@ind2=5">
1319                                <span class="label">Absorbed:</span>
1320                             </xsl:when>
1321                             <xsl:when test="@ind2=6">
1322                                <span class="label">Absorbed in part:</span>
1323                             </xsl:when>
1324                             <xsl:when test="@ind2=7">
1325                                <span class="label">Separated from:</span>
1326                             </xsl:when>
1327                         </xsl:choose>
1328                         <xsl:text> </xsl:text>
1329
1330                         <xsl:if test="marc:subfield[@code='i']">
1331                             <span class="780_rel_info">
1332                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1333                                 <xsl:text> </xsl:text>
1334                             </span>
1335                         </xsl:if>
1336
1337                         <xsl:variable name="f780">
1338                             <xsl:call-template name="subfieldSelect">
1339                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1340                             </xsl:call-template>
1341                         </xsl:variable>
1342                         <xsl:choose>
1343                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1344                                 <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>
1345                                     <xsl:value-of select="$f780"/>
1346                                 </a>
1347                             </xsl:when>
1348                             <xsl:otherwise>
1349                                 <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute>
1350                                     <xsl:value-of select="$f780"/>
1351                                 </a>
1352                             </xsl:otherwise>
1353                         </xsl:choose>
1354                     </span>
1355
1356                     <xsl:if test="marc:subfield[@code='n']">
1357                         <span class="results_summary preceeding_entry_note"><xsl:value-of select="marc:subfield[@code='n']"/></span>
1358                     </xsl:if>
1359
1360                 </xsl:if>
1361             </xsl:for-each>
1362         </xsl:if>
1363
1364         <!-- 785 -->
1365         <xsl:if test="marc:datafield[@tag=785]">
1366             <xsl:for-each select="marc:datafield[@tag=785]">
1367                 <xsl:if test="@ind1=0">
1368                     <span class="results_summary succeeding_entry">
1369                         <xsl:choose>
1370                             <xsl:when test="@ind2=0">
1371                                 <span class="label">Continued by:</span>
1372                             </xsl:when>
1373                             <xsl:when test="@ind2=1">
1374                                 <span class="label">Continued in part by:</span>
1375                             </xsl:when>
1376                             <xsl:when test="@ind2=2">
1377                                 <span class="label">Superseded by:</span>
1378                             </xsl:when>
1379                             <xsl:when test="@ind2=3">
1380                                 <span class="label">Superseded in part by:</span>
1381                             </xsl:when>
1382                             <xsl:when test="@ind2=4">
1383                                 <span class="label">Absorbed by:</span>
1384                             </xsl:when>
1385                             <xsl:when test="@ind2=5">
1386                                 <span class="label">Absorbed in part by:</span>
1387                             </xsl:when>
1388                             <xsl:when test="@ind2=6">
1389                                 <span class="label">Split into .. and ...:</span>
1390                             </xsl:when>
1391                             <xsl:when test="@ind2=7">
1392                                 <span class="label">Merged with ... to form ...</span>
1393                             </xsl:when>
1394                             <xsl:when test="@ind2=8">
1395                                 <span class="label">Changed back to:</span>
1396                             </xsl:when>
1397                         </xsl:choose>
1398                         <xsl:text> </xsl:text>
1399
1400                         <xsl:if test="marc:subfield[@code='i']">
1401                             <span class="785_rel_info">
1402                                 <xsl:value-of select="marc:subfield[@code='i']"/>
1403                                 <xsl:text> </xsl:text>
1404                             </span>
1405                         </xsl:if>
1406
1407                         <xsl:variable name="f785">
1408                             <xsl:call-template name="subfieldSelect">
1409                                 <xsl:with-param name="codes">a_t</xsl:with-param>
1410                             </xsl:call-template>
1411                         </xsl:variable>
1412
1413                         <xsl:choose>
1414                             <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
1415                                 <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>
1416                                     <xsl:value-of select="$f785"/>
1417                                 </a>
1418                             </xsl:when>
1419                             <xsl:otherwise>
1420                                 <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute>
1421                                     <xsl:value-of select="$f785"/>
1422                                 </a>
1423                             </xsl:otherwise>
1424                         </xsl:choose>
1425
1426                     </span>
1427                 </xsl:if>
1428             </xsl:for-each>
1429         </xsl:if>
1430
1431         <xsl:if test="$OPACBaseURL!=''">
1432         <span class="results_summary opac_view"><span class="label">OPAC view: </span>
1433             <a><xsl:attribute name="href"><xsl:value-of select="$OPACBaseURL"/>/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri(marc:datafield[@tag=999]/marc:subfield[@code='c'], true())"/></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>Open in new window</a>.
1434         </span>
1435         </xsl:if>
1436
1437     </xsl:template>
1438
1439     <xsl:template name="nameABCQ">
1440             <xsl:call-template name="chopPunctuation">
1441                 <xsl:with-param name="chopString">
1442                     <xsl:call-template name="subfieldSelect">
1443                         <xsl:with-param name="codes">abcq</xsl:with-param>
1444                     </xsl:call-template>
1445                 </xsl:with-param>
1446                 <xsl:with-param name="punctuation">
1447                     <xsl:text>:,;/ </xsl:text>
1448                 </xsl:with-param>
1449             </xsl:call-template>
1450     </xsl:template>
1451
1452     <xsl:template name="nameABCDN">
1453             <xsl:call-template name="chopPunctuation">
1454                 <xsl:with-param name="chopString">
1455                     <xsl:call-template name="subfieldSelect">
1456                         <xsl:with-param name="codes">abcdn</xsl:with-param>
1457                     </xsl:call-template>
1458                 </xsl:with-param>
1459                 <xsl:with-param name="punctuation">
1460                     <xsl:text>:,;/ </xsl:text>
1461                 </xsl:with-param>
1462             </xsl:call-template>
1463     </xsl:template>
1464
1465     <xsl:template name="nameACDEQ">
1466             <xsl:call-template name="subfieldSelect">
1467                 <xsl:with-param name="codes">acdeq</xsl:with-param>
1468             </xsl:call-template>
1469     </xsl:template>
1470
1471     <xsl:template name="specialSubfieldSelect">
1472         <xsl:param name="anyCodes"/>
1473         <xsl:param name="axis"/>
1474         <xsl:param name="beforeCodes"/>
1475         <xsl:param name="afterCodes"/>
1476         <xsl:variable name="str">
1477             <xsl:for-each select="marc:subfield">
1478                 <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])">
1479                     <xsl:value-of select="text()"/>
1480                     <xsl:text> </xsl:text>
1481                 </xsl:if>
1482             </xsl:for-each>
1483         </xsl:variable>
1484         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1485     </xsl:template>
1486
1487     <xsl:template name="showAuthor">
1488         <xsl:param name="authorfield"/>
1489     <xsl:param name="UseAuthoritiesForTracings"/>
1490         <xsl:if test="count($authorfield)&gt;0">
1491         <h5 class="author">
1492         <xsl:for-each select="$authorfield">
1493         <xsl:choose>
1494           <xsl:when test="position()&gt;1"/>
1495           <!-- #13383 -->
1496           <xsl:when test="@tag&lt;700"><span class="byAuthor">By: </span></xsl:when>
1497           <!--#13382 Changed Additional author to contributor -->
1498           <xsl:otherwise>Contributor(s): </xsl:otherwise>
1499         </xsl:choose>
1500         <a>
1501         <xsl:choose>
1502             <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1503                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
1504             </xsl:when>
1505             <xsl:otherwise>
1506             <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
1507             </xsl:otherwise>
1508         </xsl:choose>
1509         <xsl:choose>
1510             <xsl:when test="@tag=100 or @tag=110 or @tag=111">
1511                 <!-- #13383 -->
1512                 <xsl:call-template name="chopPunctuation">
1513                     <xsl:with-param name="chopString">
1514                         <xsl:call-template name="subfieldSelect">
1515                             <xsl:with-param name="codes">
1516                                 <xsl:choose>
1517                                     <!-- #13383 include subfield e for field 111, Display only name portion in 1XX -->
1518                                     <xsl:when test="@tag=111">aeq</xsl:when>
1519                                     <xsl:when test="@tag=110">ab</xsl:when>
1520                                     <xsl:otherwise>abcjq</xsl:otherwise>
1521                                 </xsl:choose>
1522                             </xsl:with-param>
1523                         </xsl:call-template>
1524                     </xsl:with-param>
1525                     <xsl:with-param name="punctuation">
1526                         <xsl:text>:,;/ </xsl:text>
1527                     </xsl:with-param>
1528                 </xsl:call-template>
1529                     <!-- Display only name and title portion in 110 field -->
1530                     <xsl:if test="@tag=110 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1531                     <span class="titleportion">
1532                     <xsl:choose>
1533                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1534                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1535                     </xsl:choose>
1536                     <xsl:call-template name="chopPunctuation">
1537                         <xsl:with-param name="chopString">
1538                         <xsl:call-template name="subfieldSelect">
1539                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1540                         </xsl:call-template>
1541                         </xsl:with-param>
1542                     </xsl:call-template>
1543                     </span>
1544                     </xsl:if>
1545                     <!-- Display only name and title portion in 111 field -->
1546             <xsl:if test="@tag=111 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1547                     <span class="titleportion">
1548                     <xsl:choose>
1549                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1550                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1551                     </xsl:choose>
1552
1553                     <xsl:call-template name="chopPunctuation">
1554                         <xsl:with-param name="chopString">
1555                         <xsl:call-template name="subfieldSelect">
1556                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1557                         </xsl:call-template>
1558                         </xsl:with-param>
1559                     </xsl:call-template>
1560                     </span>
1561             </xsl:if>
1562             <!-- Display only dates in 100 field -->
1563             <xsl:if test="@tag=100 and marc:subfield[@code='d']">
1564                 <span class="authordates">
1565                 <xsl:text>, </xsl:text>
1566                 <xsl:call-template name="chopPunctuation">
1567                     <xsl:with-param name="chopString">
1568                         <xsl:call-template name="subfieldSelect">
1569                            <xsl:with-param name="codes">d</xsl:with-param>
1570                         </xsl:call-template>
1571                         </xsl:with-param>
1572                     </xsl:call-template>
1573                     </span>
1574             </xsl:if>
1575
1576             </xsl:when>
1577             <!-- #13382 excludes 700$i and ind2=2, displayed as Related Works -->
1578             <!--#13382 Added all relevant subfields 4, e, and d are handled separately -->
1579             <xsl:when test="@tag=700 or @tag=710 or @tag=711">
1580                     <!-- Includes major changes for 7XX fields; display name portion in 710 and 711 fields -->
1581                     <xsl:if test="@tag=710 or @tag=711">
1582                     <xsl:call-template name="chopPunctuation">
1583                         <xsl:with-param name="chopString">
1584                             <xsl:call-template name="subfieldSelect">
1585                             <xsl:with-param name="codes">
1586                             <xsl:choose>
1587                                 <xsl:when test="@tag=711">aeq</xsl:when>
1588                                 <xsl:otherwise>ab</xsl:otherwise>
1589                             </xsl:choose>
1590                             </xsl:with-param>
1591                             </xsl:call-template>
1592                         </xsl:with-param>
1593                         <xsl:with-param name="punctuation">
1594                             <xsl:text>:,;/ </xsl:text>
1595                         </xsl:with-param>
1596                     </xsl:call-template>
1597                     <!-- Display only name and title portion in 711 field -->
1598                     <xsl:if test="@tag=711 and boolean(marc:subfield[@code='c' or @code='d' or @code='g' or @code='n' or @code='t'])">
1599                     <span class="titleportion">
1600                     <xsl:choose>
1601                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='g' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1602                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1603                     </xsl:choose>
1604
1605                     <xsl:call-template name="chopPunctuation">
1606                         <xsl:with-param name="chopString">
1607                         <xsl:call-template name="subfieldSelect">
1608                             <xsl:with-param name="codes">cdgnt</xsl:with-param>
1609                         </xsl:call-template>
1610                         </xsl:with-param>
1611                     </xsl:call-template>
1612                     </span>
1613                     </xsl:if>
1614                     <!-- Display only name and title portion in 710 field -->
1615                     <xsl:if test="@tag=710 and boolean(marc:subfield[@code='c' or @code='d' or @code='n' or @code='t'])">
1616                     <span class="titleportion">
1617                     <xsl:choose>
1618                         <xsl:when test="marc:subfield[@code='c' or @code='d' or @code='n'][not(marc:subfield[@code='t'])]"><xsl:text> </xsl:text></xsl:when>
1619                         <xsl:otherwise><xsl:text>. </xsl:text></xsl:otherwise>
1620                     </xsl:choose>
1621                     <xsl:call-template name="chopPunctuation">
1622                         <xsl:with-param name="chopString">
1623                         <xsl:call-template name="subfieldSelect">
1624                             <xsl:with-param name="codes">cdnt</xsl:with-param>
1625                         </xsl:call-template>
1626                         </xsl:with-param>
1627                     </xsl:call-template>
1628                     </span>
1629                     </xsl:if>
1630
1631                     </xsl:if>
1632                         <!-- Display only name portion in 700 field -->
1633                         <xsl:if test="@tag=700">
1634                            <xsl:call-template name="chopPunctuation">
1635                                <xsl:with-param name="chopString">
1636                                <xsl:call-template name="subfieldSelect">
1637                                   <xsl:with-param name="codes">abcq</xsl:with-param>
1638                                </xsl:call-template>
1639                                </xsl:with-param>
1640                         </xsl:call-template>
1641                         </xsl:if>
1642                         <!-- Display class "authordates" in 700 field -->
1643                         <xsl:if test="@tag=700 and marc:subfield[@code='d']">
1644                         <span class="authordates">
1645                         <xsl:text>, </xsl:text>
1646                         <xsl:call-template name="chopPunctuation">
1647                             <xsl:with-param name="chopString">
1648                             <xsl:call-template name="subfieldSelect">
1649                                <xsl:with-param name="codes">d</xsl:with-param>
1650                             </xsl:call-template>
1651                             </xsl:with-param>
1652                         </xsl:call-template>
1653                         </span>
1654                         </xsl:if>
1655                         <!-- Display class "titleportion" in 700 field -->
1656                         <xsl:variable name="titleportionfields" select="boolean(marc:subfield[@code='t' or @code='j' or @code='k' or @code='u'])"/>
1657                         <xsl:if test="@tag=700 and $titleportionfields">
1658                         <span class="titleportion">
1659                         <xsl:text>. </xsl:text>
1660                         <xsl:call-template name="chopPunctuation">
1661                             <xsl:with-param name="chopString">
1662                             <xsl:call-template name="subfieldSelect">
1663                                 <xsl:with-param name="codes">fghjklmnoprstux</xsl:with-param>
1664                             </xsl:call-template>
1665                             </xsl:with-param>
1666                         </xsl:call-template>
1667                         </span>
1668                         </xsl:if>
1669
1670         </xsl:when>
1671         </xsl:choose>
1672
1673     <!-- add relator code too between brackets-->
1674     <!-- #13383 include relator code j for field 111 -->
1675             <xsl:if test="(@tag!=111 and @tag!=711 and marc:subfield[@code='4' or @code='e']) or ((@tag=111 or @tag=711) and marc:subfield[@code='4' or @code='j'])">
1676                 <span class="relatorcode">
1677                     <xsl:text> [</xsl:text>
1678                     <xsl:choose>
1679                         <xsl:when test="@tag=111 or @tag=711">
1680                             <xsl:choose>
1681                                 <!-- Prefer j over 4 for fields 111 and 711-->
1682                                 <xsl:when test="marc:subfield[@code='j']">
1683                                     <xsl:for-each select="marc:subfield[@code='j']">
1684                                         <xsl:value-of select="."/>
1685                                         <xsl:if test="position() != last()">, </xsl:if>
1686                                     </xsl:for-each>
1687                                 </xsl:when>
1688                                 <xsl:otherwise>
1689                                     <xsl:for-each select="marc:subfield[@code=4]">
1690                                         <xsl:value-of select="."/>
1691                                         <xsl:if test="position() != last()">, </xsl:if>
1692                                     </xsl:for-each>
1693                                 </xsl:otherwise>
1694                             </xsl:choose>
1695                         </xsl:when>
1696                         <!-- Prefer e over 4 for fields 111 and 711-->
1697                         <xsl:when test="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
1698                             <xsl:for-each select="marc:subfield[@code='e']">
1699                                 <xsl:value-of select="."/>
1700                                 <xsl:if test="position() != last()">, </xsl:if>
1701                             </xsl:for-each>
1702                         </xsl:when>
1703                         <xsl:otherwise>
1704                             <xsl:for-each select="marc:subfield[@code=4]">
1705                                 <xsl:value-of select="."/>
1706                                 <xsl:if test="position() != last()">, </xsl:if>
1707                             </xsl:for-each>
1708                         </xsl:otherwise>
1709                     </xsl:choose>
1710                     <xsl:text>]</xsl:text>
1711                 </span>
1712             </xsl:if>
1713         </a>
1714         <xsl:choose>
1715             <xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
1716         </xsl:choose>
1717         </xsl:for-each>
1718         </h5>
1719
1720         </xsl:if>
1721     </xsl:template>
1722
1723     <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
1724     <xsl:template name="subfieldSelectSubject">
1725         <xsl:param name="codes"/>
1726         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
1727         <xsl:param name="subdivCodes"/>
1728         <xsl:param name="subdivDelimiter"/>
1729         <xsl:param name="prefix"/>
1730         <xsl:param name="suffix"/>
1731         <xsl:param name="urlencode"/>
1732         <xsl:variable name="str">
1733             <xsl:for-each select="marc:subfield">
1734                 <xsl:if test="contains($codes, @code)">
1735                     <xsl:if test="contains($subdivCodes, @code)">
1736                         <xsl:value-of select="$subdivDelimiter"/>
1737                     </xsl:if>
1738                     <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
1739                 </xsl:if>
1740             </xsl:for-each>
1741         </xsl:variable>
1742         <xsl:choose>
1743             <xsl:when test="$urlencode=1">
1744                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
1745             </xsl:when>
1746             <xsl:otherwise>
1747                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
1748             </xsl:otherwise>
1749         </xsl:choose>
1750     </xsl:template>
1751
1752 </xsl:stylesheet>