Bug 25381: XSLTs should not define entities
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / xslt / MARC21slimUtils.xsl
1 <?xml version='1.0'?>
2 <!DOCTYPE stylesheet>
3 <xsl:stylesheet version="1.0"
4   xmlns:marc="http://www.loc.gov/MARC21/slim"
5   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6   xmlns:str="http://exslt.org/strings"
7   exclude-result-prefixes="marc str">
8   <xsl:include href="MARC21Languages.xsl"/>
9         <xsl:template name="datafield">
10                 <xsl:param name="tag"/>
11                 <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
12                 <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
13                 <xsl:param name="subfields"/>
14                 <xsl:element name="datafield">
15                         <xsl:attribute name="tag">
16                                 <xsl:value-of select="$tag"/>
17                         </xsl:attribute>
18                         <xsl:attribute name="ind1">
19                                 <xsl:value-of select="$ind1"/>
20                         </xsl:attribute>
21                         <xsl:attribute name="ind2">
22                                 <xsl:value-of select="$ind2"/>
23                         </xsl:attribute>
24                         <xsl:copy-of select="$subfields"/>
25                 </xsl:element>
26         </xsl:template>
27
28         <xsl:template name="subfieldSelect">
29                 <xsl:param name="codes"/>
30                 <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
31                 <xsl:param name="subdivCodes"/>
32                 <xsl:param name="subdivDelimiter"/>
33         <xsl:param name="prefix"/>
34         <xsl:param name="suffix"/>
35         <xsl:param name="urlencode"/>
36                 <xsl:variable name="str">
37                         <xsl:for-each select="marc:subfield">
38                                 <xsl:if test="contains($codes, @code)">
39                     <xsl:if test="contains($subdivCodes, @code)">
40                         <xsl:value-of select="$subdivDelimiter"/>
41                     </xsl:if>
42                                         <xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
43                                 </xsl:if>
44                         </xsl:for-each>
45                 </xsl:variable>
46         <xsl:choose>
47             <xsl:when test="$urlencode=1">
48                 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
49             </xsl:when>
50             <xsl:otherwise>
51                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
52             </xsl:otherwise>
53         </xsl:choose>
54         </xsl:template>
55
56     <xsl:template name="subfieldSelectSpan">
57         <xsl:param name="codes"/>
58         <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
59         <xsl:param name="subdivCodes"/>
60         <xsl:param name="subdivDelimiter"/>
61         <xsl:param name="prefix"/>
62         <xsl:param name="suffix"/>
63         <xsl:param name="newline"/>
64             <xsl:for-each select="marc:subfield">
65                 <xsl:if test="contains($codes, @code)">
66                     <span>
67                         <xsl:attribute name="class">
68                             <xsl:value-of select="@code"/>
69                             <xsl:if test="$newline = 1 and contains(text(), '--')">
70                                 <xsl:text> newline</xsl:text>
71                             </xsl:if>
72                         </xsl:attribute>
73                         <xsl:if test="contains($subdivCodes, @code)">
74                             <xsl:value-of select="$subdivDelimiter"/>
75                         </xsl:if>
76                         <xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:if test="position()!=last()"><xsl:value-of select="$delimeter"/></xsl:if>
77                     </span>
78                 </xsl:if>
79             </xsl:for-each>
80     </xsl:template>
81
82         <xsl:template name="buildSpaces">
83                 <xsl:param name="spaces"/>
84                 <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
85                 <xsl:if test="$spaces>0">
86                         <xsl:value-of select="$char"/>
87                         <xsl:call-template name="buildSpaces">
88                                 <xsl:with-param name="spaces" select="$spaces - 1"/>
89                                 <xsl:with-param name="char" select="$char"/>
90                         </xsl:call-template>
91                 </xsl:if>
92         </xsl:template>
93
94     <xsl:template name="buildBiblioDefaultViewURL">
95         <xsl:param name="IntranetBiblioDefaultView"/>
96         <xsl:choose>
97             <xsl:when test="$IntranetBiblioDefaultView='normal'">
98                 <xsl:text>/cgi-bin/koha/catalogue/detail.pl?biblionumber=</xsl:text>
99             </xsl:when>
100             <xsl:when test="$IntranetBiblioDefaultView='isbd'">
101                 <xsl:text>/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=</xsl:text>
102             </xsl:when>
103             <xsl:when test="$IntranetBiblioDefaultView='labeled_marc'">
104                 <xsl:text>/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=</xsl:text>
105             </xsl:when>
106             <xsl:when test="$IntranetBiblioDefaultView='marc'">
107                 <xsl:text>/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=</xsl:text>
108             </xsl:when>
109             <xsl:otherwise>
110                 <xsl:text>/cgi-bin/koha/catalogue/detail.pl?biblionumber=</xsl:text>
111             </xsl:otherwise>
112         </xsl:choose>
113     </xsl:template>
114
115         <xsl:template name="chopPunctuation">
116                 <xsl:param name="chopString"/>
117                 <xsl:variable name="length" select="string-length($chopString)"/>
118                 <xsl:choose>
119                         <xsl:when test="$length=0"/>
120                         <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
121                                 <xsl:call-template name="chopPunctuation">
122                                         <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
123                                 </xsl:call-template>
124                         </xsl:when>
125                         <xsl:when test="not($chopString)"/>
126                         <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
127                 </xsl:choose>
128         </xsl:template>
129
130         <!-- Function extractControlNumber is used to extract the control number (record number) from MARC tags 773/80/85 [etc.] subfield $w.
131              Parameter: control number string.
132              Assumes LOC convention: (OrgCode)recordNumber.
133              If OrgCode is not present, return full string.
134              Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
135          Returns the value URI-encoded.
136         -->
137         <xsl:template name="extractControlNumber">
138             <xsl:param name="subfieldW"/>
139             <xsl:variable name="tranW" select="translate($subfieldW,']})&gt;','))))')"/>
140             <xsl:choose>
141               <xsl:when test="contains($tranW,')')">
142                 <xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()&lt;&gt;','')), true())"/>
143               </xsl:when>
144               <xsl:otherwise>
145                 <xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/>
146               </xsl:otherwise>
147             </xsl:choose>
148         </xsl:template>
149
150     <!-- Function m880Select:  Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags
151         - should be called immediately before the corresonding latin tags are processed 
152         - tags in right-to-left languages are displayed floating right
153         * Parameter:
154            + basetags: display these tags if found in linkage section ( subfield 6) of tag 880
155            + codes: display these subfields codes
156         * Options: 
157             - class: wrap output in <span class="$class">...</span>
158             - label: prefix each(!) tag with label $label
159             - bibno: link to biblionumber $bibno
160             - index: build a search link using index $index with subfield $a as key; if subfield $9 is present use index 'an' with key $9 instead.
161          * Limitations:
162             - displays every field on a separate line (to switch between rtl and ltr)
163          * Pitfalls:
164            (!) output might be empty
165     --> 
166     <xsl:template name="m880Select">
167          <xsl:param name="basetags"/> <!-- e.g.  100,700,110,710 -->
168         <xsl:param name="codes"/> <!-- e.g. abc  -->
169         <xsl:param name="class"/> <!-- e.g. results_summary -->
170         <xsl:param name="label"/> <!-- e.g.  Edition -->
171         <xsl:param name="bibno"/>
172         <xsl:param name="index"/> <!-- e.g.  au -->
173         <xsl:param name="UseAuthoritiesForTracings"/>
174
175         <xsl:for-each select="marc:datafield[@tag=880]">
176             <xsl:variable name="code6" select="marc:subfield[@code=6]"/>
177             <xsl:if test="contains(string($basetags), substring($code6,1,3))">
178                 <span>
179                     <xsl:choose>
180                     <xsl:when test="boolean($class) and substring($code6,string-length($code6)-1,2) ='/r'">
181                         <xsl:attribute name="class"><xsl:value-of select="$class"/> m880</xsl:attribute>
182                         <xsl:attribute name="dir">rtl</xsl:attribute>
183                     </xsl:when>
184                      <xsl:when test="boolean($class)">
185                         <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
186                         <xsl:attribute name="style">display:block; </xsl:attribute>
187                     </xsl:when>    
188                      <xsl:when test="substring($code6,string-length($code6)-1,2) ='/r'">
189                         <xsl:attribute name="class"><xsl:value-of select="$class"/> m880</xsl:attribute>
190                     </xsl:when>                                    
191                     </xsl:choose>
192                     <xsl:if test="boolean($label)">
193                         <span class="label">
194                             <xsl:value-of select="$label"/>
195                         </span>
196                     </xsl:if>
197                     <xsl:variable name="str">
198                         <xsl:for-each select="marc:subfield">
199                             <xsl:if test="contains($codes, @code)">
200                                 <xsl:value-of select="text()"/>
201                                 <xsl:text> </xsl:text>
202                             </xsl:if>
203                         </xsl:for-each>
204                     </xsl:variable>
205                     <xsl:choose>
206                         <xsl:when test="boolean($bibno)">
207                             <a>
208                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of  select="str:encode-uri($bibno, true())"/></xsl:attribute>
209                                 <xsl:value-of select="$str"/>
210                             </a>
211                         </xsl:when>
212                        <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9]) and $UseAuthoritiesForTracings='1'">
213                             <a>
214                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
215                                   <xsl:value-of select="$str"/>
216                             </a>
217                         </xsl:when>
218                         <xsl:when test="boolean($index)">
219                             <a>
220                                 <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($index, true())"/>:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
221                                 <xsl:value-of select="$str"/>
222                             </a>
223                         </xsl:when>
224                         <xsl:otherwise>
225                             <xsl:value-of select="$str"/>
226                         </xsl:otherwise>
227                     </xsl:choose>
228                 </span>
229             </xsl:if>
230         </xsl:for-each>
231     </xsl:template>
232
233     <xsl:template name="showRDAtag264">
234     <!-- Function showRDAtag264 shows selected information from tag 264
235          on the Publisher line (used by OPAC Detail and Results)
236          Depending on how many tags you have, we will pick by preference
237          Publisher-latest or Publisher or 'Other'-latest or 'Other'
238          The preferred tag is saved in the fav variable and passed to a
239          helper named-template -->
240     <!-- Amended  to show all 264 fields (filtered by ind1=3 if ind1=3 is present in the record)  -->
241         <xsl:param name="show_url"/>
242         <xsl:choose>
243             <xsl:when test="marc:datafield[@tag=264 and @ind1=3]">
244                 <xsl:for-each select="marc:datafield[@tag=264 and @ind1=3]">
245                     <xsl:call-template name="showRDAtag264helper">
246                         <xsl:with-param name="field" select="."/>
247                         <xsl:with-param name="url" select="$show_url"/>
248                     </xsl:call-template>
249                 </xsl:for-each>
250             </xsl:when>
251             <xsl:otherwise>
252                 <xsl:for-each select="marc:datafield[@tag=264]">
253                     <xsl:call-template name="showRDAtag264helper">
254                         <xsl:with-param name="field" select="."/>
255                         <xsl:with-param name="url" select="$show_url"/>
256                     </xsl:call-template>
257                 </xsl:for-each>
258             </xsl:otherwise>
259         </xsl:choose>
260     </xsl:template>
261     <xsl:template name="showRDAtag264helper">
262         <xsl:param name="field"/>
263         <xsl:param name="url"/>
264         <xsl:variable name="ind2" select="$field/@ind2"/>
265         <span class="results_summary rda264">
266             <xsl:choose>
267                 <xsl:when test="$ind2='0'">
268                     <span class="label">Producer: </span>
269                 </xsl:when>
270                 <xsl:when test="$ind2='1'">
271                     <span class="label">Publisher: </span>
272                 </xsl:when>
273                 <xsl:when test="$ind2='2'">
274                     <span class="label">Distributor: </span>
275                 </xsl:when>
276                 <xsl:when test="$ind2='3'">
277                     <span class="label">Manufacturer: </span>
278                 </xsl:when>
279                 <xsl:when test="$ind2='4'">
280                     <span class="label">Copyright date: </span>
281                 </xsl:when>
282             </xsl:choose>
283
284             <xsl:if test="$field/marc:subfield[@code='a']">
285                 <xsl:call-template name="subfieldSelect">
286                     <xsl:with-param name="codes">a</xsl:with-param>
287                 </xsl:call-template>
288             </xsl:if>
289             <xsl:text> </xsl:text>
290
291             <xsl:choose>
292                 <xsl:when test="$url='1'">
293                     <xsl:if test="$field/marc:subfield[@code='b']">
294                          <a>
295                          <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:<xsl:value-of select="str:encode-uri($field/marc:subfield[@code='b'], true())"/></xsl:attribute>
296                          <xsl:call-template name="subfieldSelect">
297                              <xsl:with-param name="codes">b</xsl:with-param>
298                          </xsl:call-template>
299                          </a>
300                     </xsl:if>
301                 </xsl:when>
302                 <xsl:otherwise>
303                     <xsl:if test="$field/marc:subfield[@code='b']">
304                         <xsl:call-template name="subfieldSelect">
305                             <xsl:with-param name="codes">b</xsl:with-param>
306                         </xsl:call-template>
307                     </xsl:if>
308                 </xsl:otherwise>
309             </xsl:choose>
310             <xsl:text> </xsl:text>
311             <xsl:call-template name="chopPunctuation">
312                 <xsl:with-param name="chopString">
313                     <xsl:call-template name="subfieldSelect">
314                         <xsl:with-param name="codes">c</xsl:with-param>
315                     </xsl:call-template>
316                 </xsl:with-param>
317             </xsl:call-template>
318
319         </span>
320     </xsl:template>
321
322     <xsl:template name="showISBNISSN">
323       <xsl:call-template name="showSingleSubfield">
324         <xsl:with-param name="tag">020</xsl:with-param>
325         <xsl:with-param name="code">a</xsl:with-param>
326         <xsl:with-param name="class">isbn</xsl:with-param>
327         <xsl:with-param name="label">ISBN: </xsl:with-param>
328       </xsl:call-template>
329       <xsl:call-template name="showSingleSubfield">
330         <xsl:with-param name="tag">022</xsl:with-param>
331         <xsl:with-param name="code">a</xsl:with-param>
332         <xsl:with-param name="class">issn</xsl:with-param>
333         <xsl:with-param name="label">ISSN: </xsl:with-param>
334       </xsl:call-template>
335     </xsl:template>
336
337     <xsl:template name="showSingleSubfield">
338       <xsl:param name="tag"/>
339       <xsl:param name="code"/>
340       <xsl:param name="class"/>
341       <xsl:param name="label"/>
342       <xsl:if test="marc:datafield[@tag=$tag]/marc:subfield[@code=$code]">
343         <span><xsl:attribute name="class"><xsl:value-of select="concat('results_summary ', $class)"/></xsl:attribute>
344         <span class="label"><xsl:value-of select="$label"/></span>
345             <xsl:for-each select="marc:datafield[@tag=$tag]/marc:subfield[@code=$code]">
346               <span><xsl:attribute name="property"><xsl:value-of select="$class"/></xsl:attribute>
347                 <xsl:value-of select="."/>
348                 <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
349               </span>
350             </xsl:for-each>
351           </span>
352       </xsl:if>
353     </xsl:template>
354
355     <xsl:template name="show-lang-041">
356       <xsl:if test="marc:datafield[@tag=041]">
357         <xsl:for-each select="marc:datafield[@tag=041]">
358           <span class="results_summary languages">
359             <xsl:call-template name="show-lang-node">
360               <xsl:with-param name="langNode" select="marc:subfield[@code='a']"/>
361               <xsl:with-param name="langLabel">Language: </xsl:with-param>
362             </xsl:call-template>
363             <xsl:call-template name="show-lang-node">
364               <xsl:with-param name="langNode" select="marc:subfield[@code='b']"/>
365               <xsl:with-param name="langLabel">Summary language: </xsl:with-param>
366             </xsl:call-template>
367             <xsl:call-template name="show-lang-node">
368               <xsl:with-param name="langNode" select="marc:subfield[@code='d']"/>
369               <xsl:with-param name="langLabel">Spoken language: </xsl:with-param>
370             </xsl:call-template>
371             <xsl:call-template name="show-lang-node">
372               <xsl:with-param name="langNode" select="marc:subfield[@code='h']"/>
373               <xsl:with-param name="langLabel">Original language: </xsl:with-param>
374             </xsl:call-template>
375             <xsl:call-template name="show-lang-node">
376               <xsl:with-param name="langNode" select="marc:subfield[@code='j']"/>
377               <xsl:with-param name="langLabel">Subtitle language: </xsl:with-param>
378             </xsl:call-template>
379           </span>
380         </xsl:for-each>
381       </xsl:if>
382     </xsl:template>
383
384     <xsl:template name="show-lang-node">
385       <xsl:param name="langNode"/>
386       <xsl:param name="langLabel"/>
387       <xsl:if test="$langNode">
388         <span class="language">
389           <span class="label"><xsl:value-of select="$langLabel"/></span>
390           <xsl:for-each select="$langNode">
391             <span>
392               <xsl:attribute name="class">lang_code-<xsl:value-of select="translate(., ' .-;|#', '_')"/></xsl:attribute>
393               <xsl:call-template name="languageCodeText">
394                 <xsl:with-param name="code" select="."/>
395               </xsl:call-template>
396               <xsl:if test="position() != last()">
397                 <span class="sep"><xsl:text>, </xsl:text></span>
398               </xsl:if>
399             </span>
400           </xsl:for-each>
401           <span class="sep"><xsl:text>. </xsl:text></span>
402         </span>
403       </xsl:if>
404     </xsl:template>
405
406     <xsl:template name="show-series">
407         <xsl:param name="searchurl"/>
408         <xsl:param name="UseControlNumber"/>
409         <xsl:param name="UseAuthoritiesForTracings"/>
410         <!-- Series -->
411         <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
412         <span class="results_summary series"><span class="label">Series: </span>
413         <!-- 440 -->
414         <xsl:for-each select="marc:datafield[@tag=440]">
415             <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
416             <xsl:call-template name="chopPunctuation">
417                             <xsl:with-param name="chopString">
418                                 <xsl:call-template name="subfieldSelect">
419                                     <xsl:with-param name="codes">a</xsl:with-param>
420                                 </xsl:call-template>
421                             </xsl:with-param>
422                         </xsl:call-template>
423             </a>
424             <xsl:call-template name="part"/>
425             <xsl:if test="marc:subfield[@code='v']">
426                 <xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='v']" />
427             </xsl:if>
428             <xsl:choose>
429                 <xsl:when test="position()=last()">
430                     <xsl:if test="../marc:datafield[@tag=490][@ind1!=1]">
431                         <span class="separator"> | </span>
432                     </xsl:if>
433                 </xsl:when>
434                 <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
435             </xsl:choose>
436         </xsl:for-each>
437
438         <!-- 490 Series not traced, Ind1 = 0 -->
439         <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]">
440             <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
441                         <xsl:call-template name="chopPunctuation">
442                             <xsl:with-param name="chopString">
443                                 <xsl:call-template name="subfieldSelect">
444                                     <xsl:with-param name="codes">a</xsl:with-param>
445                                 </xsl:call-template>
446                             </xsl:with-param>
447                         </xsl:call-template>
448             </a>
449             <xsl:call-template name="part"/>
450             <xsl:if test="marc:subfield[@code='v']">
451                 <xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='v']" />
452             </xsl:if>
453             <xsl:choose>
454                 <xsl:when test="position()=last()">
455                     <xsl:if test="../marc:datafield[@tag=490][@ind1=1]">
456                         <span class="separator"> | </span>
457                     </xsl:if>
458                 </xsl:when>
459                 <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
460             </xsl:choose>
461         </xsl:for-each>
462         <!-- 490 Series traced, Ind1 = 1 -->
463         <xsl:if test="marc:datafield[@tag=490][@ind1=1]">
464             <xsl:for-each select="marc:datafield[@tag=800 or @tag=810 or @tag=811]">
465                 <xsl:choose>
466                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
467                         <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=rcn:<xsl:value-of select="str:encode-uri(marc:subfield[@code='w'], true())"/></xsl:attribute>
468                             <xsl:call-template name="chopPunctuation">
469                                 <xsl:with-param name="chopString">
470                                     <xsl:call-template name="subfieldSelect">
471                                         <xsl:with-param name="codes">a_t</xsl:with-param>
472                                     </xsl:call-template>
473                                 </xsl:with-param>
474                             </xsl:call-template>
475                         </a>
476                     </xsl:when>
477                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
478                         <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
479                             <xsl:call-template name="chopPunctuation">
480                                 <xsl:with-param name="chopString">
481                                     <xsl:call-template name="subfieldSelect">
482                                         <xsl:with-param name="codes">a_t</xsl:with-param>
483                                     </xsl:call-template>
484                                 </xsl:with-param>
485                             </xsl:call-template>
486                         </a>
487                     </xsl:when>
488                     <xsl:otherwise>
489                         <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?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>
490                             <xsl:call-template name="chopPunctuation">
491                                 <xsl:with-param name="chopString">
492                                     <xsl:call-template name="subfieldSelect">
493                                         <xsl:with-param name="codes">a_t</xsl:with-param>
494                                     </xsl:call-template>
495                                 </xsl:with-param>
496                             </xsl:call-template>
497                         </a>
498                         <xsl:call-template name="part"/>
499                     </xsl:otherwise>
500                 </xsl:choose>
501                 <xsl:text> ; </xsl:text>
502                 <xsl:value-of  select="marc:subfield[@code='v']" />
503             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"> | </span></xsl:otherwise></xsl:choose>
504             </xsl:for-each>
505
506             <xsl:for-each select="marc:datafield[@tag=830]">
507                 <xsl:choose>
508                     <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
509                         <a href="/cgi-bin/koha/catalogue/search.pl?q=rcn:{marc:subfield[@code='w']}">
510                             <xsl:call-template name="chopPunctuation">
511                                 <xsl:with-param name="chopString">
512                                     <xsl:call-template name="subfieldSelect">
513                                         <xsl:with-param name="codes">a_t</xsl:with-param>
514                                     </xsl:call-template>
515                                 </xsl:with-param>
516                             </xsl:call-template>
517                         </a>
518                     </xsl:when>
519                     <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
520                         <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
521                             <xsl:call-template name="chopPunctuation">
522                                 <xsl:with-param name="chopString">
523                                     <xsl:call-template name="subfieldSelect">
524                                         <xsl:with-param name="codes">a_t</xsl:with-param>
525                                     </xsl:call-template>
526                                 </xsl:with-param>
527                             </xsl:call-template>
528                         </a>
529                     </xsl:when>
530                     <xsl:otherwise>
531                         <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
532                             <xsl:call-template name="chopPunctuation">
533                                 <xsl:with-param name="chopString">
534                                     <xsl:call-template name="subfieldSelect">
535                                         <xsl:with-param name="codes">a_t</xsl:with-param>
536                                     </xsl:call-template>
537                                 </xsl:with-param>
538                             </xsl:call-template>
539                         </a>
540                         <xsl:call-template name="part"/>
541                     </xsl:otherwise>
542                 </xsl:choose>
543                 <xsl:if test="marc:subfield[@code='v']">
544                     <xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='v']" />
545                 </xsl:if>
546             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"> | </span></xsl:otherwise></xsl:choose>
547             </xsl:for-each>
548         </xsl:if>
549
550         </span>
551         </xsl:if>
552     </xsl:template>
553
554     <xsl:template name="part">
555         <xsl:variable name="partNumber">
556             <xsl:call-template name="specialSubfieldSelect">
557                 <xsl:with-param name="axis">n</xsl:with-param>
558                 <xsl:with-param name="anyCodes">n</xsl:with-param>
559                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
560             </xsl:call-template>
561         </xsl:variable>
562         <xsl:variable name="partName">
563             <xsl:call-template name="specialSubfieldSelect">
564                 <xsl:with-param name="axis">p</xsl:with-param>
565                 <xsl:with-param name="anyCodes">p</xsl:with-param>
566                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
567             </xsl:call-template>
568         </xsl:variable>
569         <xsl:if test="string-length(normalize-space($partNumber))">
570                 <xsl:call-template name="chopPunctuation">
571                     <xsl:with-param name="chopString" select="$partNumber"/>
572                 </xsl:call-template>
573         </xsl:if>
574         <xsl:if test="string-length(normalize-space($partName))">
575                 <xsl:call-template name="chopPunctuation">
576                     <xsl:with-param name="chopString" select="$partName"/>
577                 </xsl:call-template>
578         </xsl:if>
579     </xsl:template>
580
581 </xsl:stylesheet>
582
583 <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
584 <metaInformation>
585 <scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
586 </metaInformation>
587 -->