2 <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
3 <xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
4 <xsl:template name="datafield">
5 <xsl:param name="tag"/>
6 <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
7 <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
8 <xsl:param name="subfields"/>
9 <xsl:element name="datafield">
10 <xsl:attribute name="tag">
11 <xsl:value-of select="$tag"/>
13 <xsl:attribute name="ind1">
14 <xsl:value-of select="$ind1"/>
16 <xsl:attribute name="ind2">
17 <xsl:value-of select="$ind2"/>
19 <xsl:copy-of select="$subfields"/>
23 <xsl:template name="subfieldSelect">
24 <xsl:param name="codes"/>
25 <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
26 <xsl:param name="subdivCodes"/>
27 <xsl:param name="subdivDelimiter"/>
28 <xsl:param name="prefix"/>
29 <xsl:param name="suffix"/>
30 <xsl:variable name="str">
31 <xsl:for-each select="marc:subfield">
32 <xsl:if test="contains($codes, @code)">
33 <xsl:if test="contains($subdivCodes, @code)">
34 <xsl:value-of select="$subdivDelimiter"/>
36 <xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
40 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
43 <xsl:template name="subfieldSelectSpan">
44 <xsl:param name="codes"/>
45 <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
46 <xsl:param name="subdivCodes"/>
47 <xsl:param name="subdivDelimiter"/>
48 <xsl:param name="prefix"/>
49 <xsl:param name="suffix"/>
50 <xsl:for-each select="marc:subfield">
51 <xsl:if test="contains($codes, @code)">
53 <xsl:attribute name="class"><xsl:value-of select="@code"/></xsl:attribute>
54 <xsl:if test="contains($subdivCodes, @code)">
55 <xsl:value-of select="$subdivDelimiter"/>
57 <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>
63 <xsl:template name="buildSpaces">
64 <xsl:param name="spaces"/>
65 <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
66 <xsl:if test="$spaces>0">
67 <xsl:value-of select="$char"/>
68 <xsl:call-template name="buildSpaces">
69 <xsl:with-param name="spaces" select="$spaces - 1"/>
70 <xsl:with-param name="char" select="$char"/>
75 <xsl:template name="buildBiblioDefaultViewURL">
76 <xsl:param name="BiblioDefaultView"/>
78 <xsl:when test="$BiblioDefaultView='normal'">
79 <xsl:text>/cgi-bin/koha/opac-detail.pl?biblionumber=</xsl:text>
81 <xsl:when test="$BiblioDefaultView='isbd'">
82 <xsl:text>/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=</xsl:text>
84 <xsl:when test="$BiblioDefaultView='marc'">
85 <xsl:text>/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=</xsl:text>
88 <xsl:text>/cgi-bin/koha/opac-detail.pl?biblionumber=</xsl:text>
93 <xsl:template name="chopPunctuation">
94 <xsl:param name="chopString"/>
95 <xsl:variable name="length" select="string-length($chopString)"/>
97 <xsl:when test="$length=0"/>
98 <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
99 <xsl:call-template name="chopPunctuation">
100 <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
103 <xsl:when test="not($chopString)"/>
104 <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
108 <!-- Function extractControlNumber is used to extract the control number (record number) from MARC tags 773/80/85 [etc.] subfield $w.
109 Parameter: control number string.
110 Assumes LOC convention: (OrgCode)recordNumber.
111 If OrgCode is not present, return full string.
112 Additionally, handle various brackets/parentheses. Chop leading and trailing spaces.
114 <xsl:template name="extractControlNumber">
115 <xsl:param name="subfieldW"/>
116 <xsl:variable name="tranW" select="translate($subfieldW,']})>','))))')"/>
118 <xsl:when test="contains($tranW,')')">
119 <xsl:value-of select="normalize-space(translate(substring-after($tranW,')'),'[]{}()<>',''))"/>
122 <xsl:value-of select="normalize-space($subfieldW)"/>
127 <!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags
128 - should be called immediately before the corresonding latin tags are processed
129 - tags in right-to-left languages are displayed floating right
131 + basetags: display these tags if found in linkage section ( subfield 6) of tag 880
132 + codes: display these subfields codes
134 - class: wrap output in <span class="$class">...</span>
135 - label: prefix each(!) tag with label $label
136 - bibno: link to biblionumber $bibno
137 - 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.
139 - displays every field on a separate line (to switch between rtl and ltr)
141 (!) output might be empty
143 <xsl:template name="m880Select">
144 <xsl:param name="basetags"/> <!-- e.g. 100,700,110,710 -->
145 <xsl:param name="codes"/> <!-- e.g. abc -->
146 <xsl:param name="class"/> <!-- e.g. results_summary -->
147 <xsl:param name="label"/> <!-- e.g. Edition -->
148 <xsl:param name="bibno"/>
149 <xsl:param name="index"/> <!-- e.g. au -->
151 <xsl:for-each select="marc:datafield[@tag=880]">
152 <xsl:variable name="code6" select="marc:subfield[@code=6]"/>
153 <xsl:if test="contains(string($basetags), substring($code6,1,3))">
156 <xsl:when test="boolean($class) and substring($code6,string-length($code6)-1,2) ='/r'">
157 <xsl:attribute name="class"><xsl:value-of select="$class"/> m880</xsl:attribute>
158 <xsl:attribute name="dir">rtl</xsl:attribute>
160 <xsl:when test="boolean($class)">
161 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
162 <xsl:attribute name="style">display:block; </xsl:attribute>
164 <xsl:when test="substring($code6,string-length($code6)-1,2) ='/r'">
165 <xsl:attribute name="class"><xsl:value-of select="$class"/> m880</xsl:attribute>
168 <xsl:if test="boolean($label)">
170 <xsl:value-of select="$label"/>
173 <xsl:variable name="str">
174 <xsl:for-each select="marc:subfield">
175 <xsl:if test="contains($codes, @code)">
176 <xsl:value-of select="text()"/>
177 <xsl:text> </xsl:text>
181 <xsl:if test="string-length($str) > 0">
183 <xsl:when test="boolean($bibno)">
185 <xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$bibno"/></xsl:attribute>
186 <xsl:value-of select="$str"/>
189 <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
191 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
192 <xsl:value-of select="$str"/>
195 <xsl:when test="boolean($index)">
197 <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="$index"/>:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
198 <xsl:value-of select="$str"/>
202 <xsl:value-of select="$str"/>
211 <xsl:template name="showRDAtag264">
212 <!-- Function showRDAtag264 shows selected information from tag 264
213 on the Publisher line (used by OPAC Detail and Results)
214 Depending on how many tags you have, we will pick by preference
215 Publisher-latest or Publisher or 'Other'-latest or 'Other'
216 The preferred tag is saved in the fav variable and passed to a
217 helper named-template -->
218 <!-- Amended to show all 264 fields (filtered by ind1=3 if ind1=3 is present in the record) -->
219 <xsl:param name="show_url"/>
221 <xsl:when test="marc:datafield[@tag=264 and @ind1=3]">
222 <xsl:for-each select="marc:datafield[@tag=264 and @ind1=3]">
223 <xsl:call-template name="showRDAtag264helper">
224 <xsl:with-param name="field" select="."/>
225 <xsl:with-param name="url" select="$show_url"/>
230 <xsl:for-each select="marc:datafield[@tag=264]">
231 <xsl:call-template name="showRDAtag264helper">
232 <xsl:with-param name="field" select="."/>
233 <xsl:with-param name="url" select="$show_url"/>
239 <xsl:template name="showRDAtag264helper">
240 <xsl:param name="field"/>
241 <xsl:param name="url"/>
242 <xsl:variable name="ind2" select="$field/@ind2"/>
243 <span class="results_summary">
245 <xsl:when test="$ind2='0'">
246 <span class="label">Producer: </span>
248 <xsl:when test="$ind2='1'">
249 <span class="label">Publisher: </span>
251 <xsl:when test="$ind2='2'">
252 <span class="label">Distributor: </span>
254 <xsl:when test="$ind2='3'">
255 <span class="label">Manufacturer: </span>
257 <xsl:when test="$ind2='4'">
258 <span class="label">Copyright date: </span>
262 <xsl:if test="$field/marc:subfield[@code='a']">
263 <xsl:call-template name="subfieldSelect">
264 <xsl:with-param name="codes">a</xsl:with-param>
267 <xsl:text> </xsl:text>
270 <xsl:when test="$url='1'">
271 <xsl:if test="$field/marc:subfield[@code='b']">
272 <a href="/cgi-bin/koha/opac-search.pl?q=Provider:{$field/marc:subfield[@code='b']}">
273 <xsl:call-template name="subfieldSelect">
274 <xsl:with-param name="codes">b</xsl:with-param>
280 <xsl:if test="$field/marc:subfield[@code='b']">
281 <xsl:call-template name="subfieldSelect">
282 <xsl:with-param name="codes">b</xsl:with-param>
287 <xsl:text> </xsl:text>
288 <xsl:call-template name="chopPunctuation">
289 <xsl:with-param name="chopString">
290 <xsl:call-template name="subfieldSelect">
291 <xsl:with-param name="codes">c</xsl:with-param>
300 <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
302 <scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>