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