2 <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
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"/>
18 <xsl:attribute name="ind1">
19 <xsl:value-of select="$ind1"/>
21 <xsl:attribute name="ind2">
22 <xsl:value-of select="$ind2"/>
24 <xsl:copy-of select="$subfields"/>
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"/>
42 <xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
47 <xsl:when test="$urlencode=1">
48 <xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/>
51 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
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:for-each select="marc:subfield">
64 <xsl:if test="contains($codes, @code)">
66 <xsl:attribute name="class"><xsl:value-of select="@code"/></xsl:attribute>
67 <xsl:if test="contains($subdivCodes, @code)">
68 <xsl:value-of select="$subdivDelimiter"/>
70 <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>
76 <xsl:template name="buildSpaces">
77 <xsl:param name="spaces"/>
78 <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
79 <xsl:if test="$spaces>0">
80 <xsl:value-of select="$char"/>
81 <xsl:call-template name="buildSpaces">
82 <xsl:with-param name="spaces" select="$spaces - 1"/>
83 <xsl:with-param name="char" select="$char"/>
88 <xsl:template name="buildBiblioDefaultViewURL">
89 <xsl:param name="BiblioDefaultView"/>
91 <xsl:when test="$BiblioDefaultView='normal'">
92 <xsl:text>/cgi-bin/koha/opac-detail.pl?biblionumber=</xsl:text>
94 <xsl:when test="$BiblioDefaultView='isbd'">
95 <xsl:text>/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=</xsl:text>
97 <xsl:when test="$BiblioDefaultView='marc'">
98 <xsl:text>/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=</xsl:text>
101 <xsl:text>/cgi-bin/koha/opac-detail.pl?biblionumber=</xsl:text>
106 <xsl:template name="chopPunctuation">
107 <xsl:param name="chopString"/>
108 <xsl:variable name="length" select="string-length($chopString)"/>
110 <xsl:when test="$length=0"/>
111 <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
112 <xsl:call-template name="chopPunctuation">
113 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
116 <xsl:when test="not($chopString)"/>
117 <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
121 <!-- Function extractControlNumber is used to extract the control number (record number) from MARC tags 773/80/85 [etc.] subfield $w.
122 Parameter: control number string.
123 Assumes LOC convention: (OrgCode)recordNumber.
124 If OrgCode is not present, return full string.
125 Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
126 Returns the value URI-encoded.
128 <xsl:template name="extractControlNumber">
129 <xsl:param name="subfieldW"/>
130 <xsl:variable name="tranW" select="translate($subfieldW,']})>','))))')"/>
132 <xsl:when test="contains($tranW,')')">
133 <xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), true())"/>
136 <xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/>
141 <!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags
142 - should be called immediately before the corresonding latin tags are processed
143 - tags in right-to-left languages are displayed floating right
145 + basetags: display these tags if found in linkage section ( subfield 6) of tag 880
146 + codes: display these subfields codes
148 - class: wrap output in <span class="$class">...</span>
149 - label: prefix each(!) tag with label $label
150 - bibno: link to biblionumber $bibno
151 - 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.
153 - displays every field on a separate line (to switch between rtl and ltr)
155 (!) output might be empty
157 <xsl:template name="m880Select">
158 <xsl:param name="basetags"/> <!-- e.g. 100,700,110,710 -->
159 <xsl:param name="codes"/> <!-- e.g. abc -->
160 <xsl:param name="class"/> <!-- e.g. results_summary -->
161 <xsl:param name="label"/> <!-- e.g. Edition -->
162 <xsl:param name="bibno"/>
163 <xsl:param name="index"/> <!-- e.g. au -->
165 <xsl:for-each select="marc:datafield[@tag=880]">
166 <xsl:variable name="code6" select="marc:subfield[@code=6]"/>
167 <xsl:if test="contains(string($basetags), substring($code6,1,3))">
170 <xsl:when test="boolean($class) and substring($code6,string-length($code6)-1,2) ='/r'">
171 <xsl:attribute name="class"><xsl:value-of select="$class"/> m880</xsl:attribute>
172 <xsl:attribute name="dir">rtl</xsl:attribute>
174 <xsl:when test="boolean($class)">
175 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
176 <xsl:attribute name="style">display:block; </xsl:attribute>
178 <xsl:when test="substring($code6,string-length($code6)-1,2) ='/r'">
179 <xsl:attribute name="class"><xsl:value-of select="$class"/> m880</xsl:attribute>
182 <xsl:if test="boolean($label)">
184 <xsl:value-of select="$label"/>
187 <xsl:variable name="str">
188 <xsl:for-each select="marc:subfield">
189 <xsl:if test="contains($codes, @code)">
190 <xsl:value-of select="text()"/>
191 <xsl:text> </xsl:text>
195 <xsl:if test="string-length($str) > 0">
197 <xsl:when test="boolean($bibno)">
199 <xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="str:encode-uri($bibno, true())"/></xsl:attribute>
200 <xsl:value-of select="$str"/>
203 <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
205 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
206 <xsl:value-of select="$str"/>
209 <xsl:when test="boolean($index)">
211 <xsl:attribute name="href">/cgi-bin/koha/opac-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>
212 <xsl:value-of select="$str"/>
216 <xsl:value-of select="$str"/>
225 <xsl:template name="showRDAtag264">
226 <!-- Function showRDAtag264 shows selected information from tag 264
227 on the Publisher line (used by OPAC Detail and Results)
228 Depending on how many tags you have, we will pick by preference
229 Publisher-latest or Publisher or 'Other'-latest or 'Other'
230 The preferred tag is saved in the fav variable and passed to a
231 helper named-template -->
232 <!-- Amended to show all 264 fields (filtered by ind1=3 if ind1=3 is present in the record) -->
233 <xsl:param name="show_url"/>
235 <xsl:when test="marc:datafield[@tag=264 and @ind1=3]">
236 <xsl:for-each select="marc:datafield[@tag=264 and @ind1=3]">
237 <xsl:call-template name="showRDAtag264helper">
238 <xsl:with-param name="field" select="."/>
239 <xsl:with-param name="url" select="$show_url"/>
244 <xsl:for-each select="marc:datafield[@tag=264]">
245 <xsl:call-template name="showRDAtag264helper">
246 <xsl:with-param name="field" select="."/>
247 <xsl:with-param name="url" select="$show_url"/>
253 <xsl:template name="showRDAtag264helper">
254 <xsl:param name="field"/>
255 <xsl:param name="url"/>
256 <xsl:variable name="ind2" select="$field/@ind2"/>
257 <span class="results_summary rda264">
259 <xsl:when test="$ind2='0'">
260 <span class="label">Producer: </span>
262 <xsl:when test="$ind2='1'">
263 <span class="label">Publisher: </span>
265 <xsl:when test="$ind2='2'">
266 <span class="label">Distributor: </span>
268 <xsl:when test="$ind2='3'">
269 <span class="label">Manufacturer: </span>
271 <xsl:when test="$ind2='4'">
272 <span class="label">Copyright date: </span>
276 <xsl:if test="$field/marc:subfield[@code='a']">
277 <xsl:call-template name="subfieldSelect">
278 <xsl:with-param name="codes">a</xsl:with-param>
281 <xsl:text> </xsl:text>
284 <xsl:when test="$url='1'">
285 <xsl:if test="$field/marc:subfield[@code='b']">
287 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri($field/marc:subfield[@code='b'], true())"/></xsl:attribute>
288 <xsl:call-template name="subfieldSelect">
289 <xsl:with-param name="codes">b</xsl:with-param>
295 <xsl:if test="$field/marc:subfield[@code='b']">
296 <xsl:call-template name="subfieldSelect">
297 <xsl:with-param name="codes">b</xsl:with-param>
302 <xsl:text> </xsl:text>
303 <xsl:call-template name="chopPunctuation">
304 <xsl:with-param name="chopString">
305 <xsl:call-template name="subfieldSelect">
306 <xsl:with-param name="codes">c</xsl:with-param>
313 <xsl:template name="show-lang-041">
314 <xsl:if test="marc:datafield[@tag=041]">
315 <xsl:for-each select="marc:datafield[@tag=041]">
316 <span class="results_summary languages">
317 <xsl:call-template name="show-lang-node">
318 <xsl:with-param name="langNode" select="marc:subfield[@code='a']"/>
319 <xsl:with-param name="langLabel">Language: </xsl:with-param>
321 <xsl:call-template name="show-lang-node">
322 <xsl:with-param name="langNode" select="marc:subfield[@code='b']"/>
323 <xsl:with-param name="langLabel">Summary language: </xsl:with-param>
325 <xsl:call-template name="show-lang-node">
326 <xsl:with-param name="langNode" select="marc:subfield[@code='d']"/>
327 <xsl:with-param name="langLabel">Spoken language: </xsl:with-param>
329 <xsl:call-template name="show-lang-node">
330 <xsl:with-param name="langNode" select="marc:subfield[@code='h']"/>
331 <xsl:with-param name="langLabel">Original language: </xsl:with-param>
333 <xsl:call-template name="show-lang-node">
334 <xsl:with-param name="langNode" select="marc:subfield[@code='j']"/>
335 <xsl:with-param name="langLabel">Subtitle language: </xsl:with-param>
342 <xsl:template name="show-lang-node">
343 <xsl:param name="langNode"/>
344 <xsl:param name="langLabel"/>
345 <xsl:if test="$langNode">
346 <span class="language">
347 <span class="label"><xsl:value-of select="$langLabel"/></span>
348 <xsl:for-each select="$langNode">
350 <xsl:attribute name="class">lang_code-<xsl:value-of select="translate(., ' .-;|#', '_')"/></xsl:attribute>
351 <xsl:call-template name="languageCodeText">
352 <xsl:with-param name="code" select="."/>
354 <xsl:if test="position() != last()">
355 <span class="separator"><xsl:text>, </xsl:text></span>
359 <span class="separator"><xsl:text> </xsl:text></span>
366 <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
368 <scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>