adding set_curcfg() call to tsearch2 configuration script for 8.2 and 8.1; fixing...
[Evergreen.git] / Open-ILS / xsl / MARC21slim2HTMLCard-holdings.xsl
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2   
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4   xmlns="http://www.w3.org/1999/xhtml"
5   xmlns:xhtml="http://www.w3.org/1999/xhtml"
6   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7   xmlns:marc="http://www.loc.gov/MARC21/slim"
8   xmlns:hold="http://open-ils.org/spec/holdings/v1"
9   version="1.0">
10   <xsl:output method="html" doctype-public="-//W3C/DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" />    
11   <xsl:template match="/">
12      <html>
13        <head>
14          <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
15          <link href="{$base_dir}/htmlcard.css" rel="stylesheet" type="text/css" />
16          <xsl:apply-templates select="/marc:collection/xhtml:link"/>
17          <title><xsl:value-of select="//marc:datafield[@tag='245']/marc:subfield[@code='a']"/></title>
18        </head>
19        <body>
20         <xsl:apply-templates select="//marc:record"/>
21        </body>
22      </html>
23   </xsl:template>
24       
25   <xsl:template match="marc:record">
26     <div class="cardimage">
27      <xsl:apply-templates select="marc:datafield[@tag!='082' and @tag!='092' and @tag!='010']"/>
28      <span class="bottom">
29       <xsl:apply-templates select="xhtml:link[@rel='otherFormat' and contains(@href,'format=')]"/>
30       <xsl:apply-templates select="marc:controlfield[@tag='001']"/>
31       <xsl:apply-templates select="marc:datafield[@tag='082' or @tag='092' or @tag='010']"/>
32      </span>
33      <xsl:apply-templates select="xhtml:abbr[@class='unapi-id']"/>
34     </div>
35     <br/>
36     <xsl:apply-templates select="hold:volumes"/>
37     <br/>
38   </xsl:template>
39
40   <xsl:template match="xhtml:abbr">
41     <abbr>
42       <xsl:attribute name="title">
43         <xsl:value-of select="@title"/>
44       </xsl:attribute>
45       <xsl:attribute name="class">
46         <xsl:value-of select="@class"/>
47       </xsl:attribute>
48       <xsl:value-of select="."/>
49     </abbr>
50   </xsl:template>
51
52   <xsl:template match="xhtml:link">
53     <xsl:choose>
54       <xsl:when test="@title='unapi'">
55         <link rel="unapi-server" title="unAPI" type="application/xml">
56           <xsl:attribute name="href">
57             <xsl:value-of select="@href"/>
58           </xsl:attribute>
59         </link>
60       </xsl:when>
61       <xsl:when test="@rel='otherFormat' and contains(@href,'format=')">
62         <a>
63           <xsl:attribute name="href">
64             <xsl:value-of select="@href"/>
65           </xsl:attribute>
66           <xsl:value-of select="@title"/>
67         </a>
68         <br/>
69       </xsl:when>
70     </xsl:choose>
71   </xsl:template>
72
73   <xsl:template match="hold:volumes">
74     <xsl:if test="count(hold:volume/hold:copies/hold:copy) &gt; 0">
75         <u>Holdings</u>
76     </xsl:if>
77     <ul>
78     <xsl:apply-templates select="hold:volume">
79       <xsl:sort select="@lib"/>
80     </xsl:apply-templates>
81     </ul>
82   </xsl:template>
83
84   <xsl:template match="hold:volume">
85       <li>
86        <b>
87         <a>
88          <xsl:attribute name="href">
89           <xsl:value-of select="concat('/opac/extras/browse/html/call_number/',@lib,'/',@label)"/>
90          </xsl:attribute>
91          <xsl:value-of select="./@label"/>
92         </a>
93        </b>
94         <xsl:apply-templates select="hold:copies"/>
95       </li>
96   </xsl:template>
97
98   <xsl:template match="hold:copies">
99     <ul>
100     <xsl:apply-templates select="hold:copy">
101       <xsl:sort select="hold:location"/>
102     </xsl:apply-templates>
103     </ul>
104   </xsl:template>
105
106   <xsl:template match="hold:copy">
107       <li> <xsl:value-of select="@barcode"/>
108         <ul>
109           <li>Circulating from <b><xsl:value-of select="hold:circlib"/></b></li>
110           <li>Located at <b><xsl:value-of select="hold:location"/></b></li>
111           <li>Status is <b><xsl:value-of select="hold:status"/></b></li>
112           <xsl:apply-templates select="hold:statcats"/>
113         </ul>
114       </li>
115   </xsl:template>
116
117   <xsl:template match="hold:statcats">
118     <xsl:if test="count(hold:statcat) &gt; 0">
119       <li>Statistical Catagories
120         <ul>
121         <xsl:apply-templates select="hold:statcat">
122           <xsl:sort select="@name"/>
123         </xsl:apply-templates>
124         </ul>
125       </li>
126     </xsl:if>
127   </xsl:template>
128
129   <xsl:template match="hold:statcat">
130       <li> <b><xsl:value-of select="@name"/></b>: <xsl:value-of select="."/> </li>
131   </xsl:template>
132
133   <xsl:template match="marc:controlfield">
134       <span class="oclc">#<xsl:value-of select="substring(.,4)"/></span>
135   </xsl:template>
136       
137   <xsl:template match="marc:datafield">
138     <xsl:if test="starts-with(@tag, '1')">
139       <p class="mainheading">
140        <a>
141         <xsl:attribute name="href">
142          <xsl:value-of select="concat('/opac/extras/opensearch/1.1/-/html-full/author?searchTerms=',.)"/>
143         </xsl:attribute>
144         <xsl:value-of select="."/>
145        </a>
146       </p>
147     </xsl:if>
148
149     <xsl:if test="starts-with(@tag, '24') and /marc:record/marc:datafield[@tag='100']">
150       <span class="title"><xsl:value-of select="."/></span>
151     </xsl:if>
152
153     <xsl:if test="starts-with(@tag, '24') and not(/marc:record/marc:datafield[@tag='100'])">
154       <span class="titlemain"><xsl:value-of select="."/></span><br/>
155     </xsl:if>
156
157     <xsl:if test="@tag='260'">
158       <xsl:value-of select="."/>
159     </xsl:if>
160
161     <xsl:if test="@tag='300'">
162       <p class="extent"><xsl:value-of select="."/></p>
163      </xsl:if>
164
165     <xsl:if test="starts-with(@tag, '5')">
166       <p class="note"><xsl:value-of select="."/></p>
167     </xsl:if>
168
169     <xsl:if test="@tag='600'">
170       <span class='counter'><xsl:number count="marc:datafield[@tag='600']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
171     </xsl:if>
172
173     <xsl:if test="@tag='650'">
174       <span class='counter'><xsl:number count="marc:datafield[@tag='650']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
175     </xsl:if>
176
177     <xsl:if test="@tag='653'">
178       <span class="counter"><xsl:number format="i" count="marc:datafield[@tag='653']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
179     </xsl:if>
180
181     <xsl:if test="@tag='010'">
182       <xsl:variable name="LCCN.nospace" select="translate(., ' ', '')"/>
183       <xsl:variable name="LCCN.length" select="string-length($LCCN.nospace)"/>
184       <xsl:variable name="LCCN.display" select="concat(substring($LCCN.nospace, 1, $LCCN.length - 6), '-', format-number(substring($LCCN.nospace, $LCCN.length - 5),'#'))"/>
185       <span class="LCCN">LCCN:<xsl:value-of select="$LCCN.display"/></span>
186     </xsl:if>
187
188     <xsl:if test="@tag='082' or @tag='092'">
189       <span class="DDC"><xsl:value-of select="marc:subfield[@code='a']"/></span>
190     </xsl:if>
191
192     <xsl:if test="@tag='856'">
193      <br/><xsl:apply-templates mode="link" select="marc:subfield" />
194     </xsl:if>
195   </xsl:template>
196
197   <xsl:template match="marc:subfield" mode="link">
198     <xsl:if test="@code='u'">
199       <span class="link">
200         <a class="url" href="{.}">
201                 <xsl:choose>
202                         <xsl:when test="../marc:subfield[@code='y']">
203                                 <xsl:value-of select="../marc:subfield[@code='y']"/>
204                         </xsl:when>
205                         <xsl:when test="../marc:subfield[@code='3']">
206                                 <xsl:value-of select="../marc:subfield[@code='3']"/>
207                         </xsl:when>
208                         <xsl:otherwise>
209                                 <xsl:value-of select="."/>
210                         </xsl:otherwise>
211                 </xsl:choose>
212         </a>
213       </span>
214     </xsl:if>
215   </xsl:template>
216   
217   <xsl:template match="marc:subfield">
218     <xsl:if test="@code!='2'">    
219      <xsl:if test="@code!='a'">--</xsl:if>
220      <xsl:choose>
221       <xsl:when test="./@code!='v' and ./parent::*[starts-with(@tag,'6')]">
222        <a>
223         <xsl:attribute name="href">
224          <xsl:value-of select="concat('/opac/extras/opensearch/1.1/-/html-full/subject?searchTerms=',.)"/>
225         </xsl:attribute>
226         <xsl:value-of select="."/>
227        </a>
228       </xsl:when>
229       <xsl:otherwise>
230         <xsl:value-of select="."/>
231       </xsl:otherwise>
232      </xsl:choose>
233     </xsl:if>
234   </xsl:template>
235
236 </xsl:stylesheet>