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