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