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