]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xsl/MARC21slim2HTMLCard-holdings.xsl
Fix typo in Makefile.ubuntu-precise.
[working/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:holdings/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:uris/hold:uri) &gt; 0">
75         <u>Links</u>
76         <ul>
77           <xsl:apply-templates select="hold:volume/hold:uris/hold:uri"/>
78         </ul>
79     </xsl:if>
80     <xsl:if test="count(hold:volume[@deleted='f']/hold:copies/hold:copy[@deleted='f']) &gt; 0">
81         <u>Holdings</u>
82         <ul>
83           <xsl:apply-templates select="hold:volume[@deleted='f']">
84             <xsl:sort select="@lib"/>
85           </xsl:apply-templates>
86         </ul>
87     </xsl:if>
88   </xsl:template>
89
90   <xsl:template match="hold:volume[@deleted='f']">
91       <li>
92        <b>
93         <a>
94          <xsl:attribute name="href">
95           <xsl:value-of select="concat('/opac/extras/browse/html/call_number/',@lib,'/',@label)"/>
96          </xsl:attribute>
97          <xsl:value-of select="./@label"/>
98         </a>
99        </b>
100             <abbr class="unapi-id"><xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute></abbr>
101         <xsl:apply-templates select="hold:copies"/>
102       </li>
103   </xsl:template>
104
105   <xsl:template match="hold:uri">
106         <li>
107             <a>
108                  <xsl:attribute name="href">
109                           <xsl:value-of select="@href"/>
110                  </xsl:attribute>
111                  <xsl:value-of select="@label"/>
112                 </a>
113             <xsl:if test="@use_restriction != ''">
114                 <span> (Use Restriction: </span>
115                 <xsl:value-of select="@use_restriction"/>
116                 <span>)</span>
117             </xsl:if>
118             <abbr class="unapi-id"><xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute></abbr>
119         </li>
120   </xsl:template>
121
122   <xsl:template match="hold:copies">
123     <ul>
124     <xsl:apply-templates select="hold:copy[@deleted='f']">
125       <xsl:sort select="hold:location"/>
126     </xsl:apply-templates>
127     </ul>
128   </xsl:template>
129
130   <xsl:template match="hold:copy[@deleted='f']">
131       <li> <xsl:value-of select="@barcode"/> <abbr class="unapi-id"><xsl:attribute name="title"><xsl:value-of select="@id"/></xsl:attribute></abbr>
132         <ul>
133           <li>Circulating from <b><xsl:value-of select="hold:circlib"/></b></li>
134               <li>Located at <b><xsl:value-of select="hold:location"/></b></li>
135           <li>Status is <b><xsl:value-of select="hold:status"/></b></li>
136               <xsl:apply-templates select="hold:statcats"/>
137         </ul>
138       </li>
139   </xsl:template>
140
141   <xsl:template match="hold:statcats">
142     <xsl:if test="count(hold:statcat) &gt; 0">
143       <li>Statistical Catagories
144         <ul>
145         <xsl:apply-templates select="hold:statcat">
146           <xsl:sort select="@name"/>
147         </xsl:apply-templates>
148         </ul>
149       </li>
150     </xsl:if>
151   </xsl:template>
152
153   <xsl:template match="hold:statcat">
154       <li> <b><xsl:value-of select="@name"/></b>: <xsl:value-of select="."/> </li>
155   </xsl:template>
156
157   <xsl:template match="marc:controlfield">
158       <span class="oclc">#<xsl:value-of select="substring(.,4)"/></span>
159   </xsl:template>
160       
161   <xsl:template match="marc:datafield">
162     <xsl:if test="starts-with(@tag, '1')">
163       <p class="mainheading">
164        <a>
165         <xsl:attribute name="href">
166          <xsl:value-of select="concat('/opac/extras/opensearch/1.1/-/html-full/author?searchTerms=',.)"/>
167         </xsl:attribute>
168         <xsl:value-of select="."/>
169        </a>
170       </p>
171     </xsl:if>
172
173     <xsl:if test="starts-with(@tag, '24') and /marc:record/marc:datafield[@tag='100']">
174       <span class="title"><xsl:value-of select="."/></span>
175     </xsl:if>
176
177     <xsl:if test="starts-with(@tag, '24') and not(/marc:record/marc:datafield[@tag='100'])">
178       <span class="titlemain"><xsl:value-of select="."/></span><br/>
179     </xsl:if>
180
181     <xsl:if test="@tag='260'">
182       <xsl:value-of select="."/>
183     </xsl:if>
184
185     <xsl:if test="@tag='300'">
186       <p class="extent"><xsl:value-of select="."/></p>
187      </xsl:if>
188
189     <xsl:if test="starts-with(@tag, '5')">
190       <p class="note"><xsl:value-of select="."/></p>
191     </xsl:if>
192
193     <xsl:if test="@tag='600'">
194       <span class='counter'><xsl:number count="marc:datafield[@tag='600']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
195     </xsl:if>
196
197     <xsl:if test="@tag='650'">
198       <span class='counter'><xsl:number count="marc:datafield[@tag='650']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
199     </xsl:if>
200
201     <xsl:if test="@tag='653'">
202       <span class="counter"><xsl:number format="i" count="marc:datafield[@tag='653']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
203     </xsl:if>
204
205     <xsl:if test="@tag='010'">
206       <xsl:variable name="LCCN.nospace" select="translate(., ' ', '')"/>
207       <xsl:variable name="LCCN.length" select="string-length($LCCN.nospace)"/>
208       <xsl:variable name="LCCN.display" select="concat(substring($LCCN.nospace, 1, $LCCN.length - 6), '-', format-number(substring($LCCN.nospace, $LCCN.length - 5),'#'))"/>
209       <span class="LCCN">LCCN:<xsl:value-of select="$LCCN.display"/></span>
210     </xsl:if>
211
212     <xsl:if test="@tag='082' or @tag='092'">
213       <span class="DDC"><xsl:value-of select="marc:subfield[@code='a']"/></span>
214     </xsl:if>
215
216     <xsl:if test="@tag='856' and not(marc:subfield[@code='9'])">
217      <br/><xsl:apply-templates mode="link" select="marc:subfield" />
218     </xsl:if>
219
220   </xsl:template>
221
222   <xsl:template match="marc:subfield" mode="link">
223     <xsl:if test="@code='u'">
224       <span class="link">
225         <a class="url" href="{.}">
226                 <xsl:choose>
227                         <xsl:when test="../marc:subfield[@code='y']">
228                                 <xsl:value-of select="../marc:subfield[@code='y']"/>
229                         </xsl:when>
230                         <xsl:when test="../marc:subfield[@code='3']">
231                                 <xsl:value-of select="../marc:subfield[@code='3']"/>
232                         </xsl:when>
233                         <xsl:otherwise>
234                                 <xsl:value-of select="."/>
235                         </xsl:otherwise>
236                 </xsl:choose>
237         </a>
238       </span>
239     </xsl:if>
240   </xsl:template>
241   
242   <xsl:template match="marc:subfield">
243     <xsl:if test="@code!='2'">    
244      <xsl:if test="@code!='a'">--</xsl:if>
245      <xsl:choose>
246       <xsl:when test="./@code!='v' and ./parent::*[starts-with(@tag,'6')]">
247        <a>
248         <xsl:attribute name="href">
249          <xsl:value-of select="concat('/opac/extras/opensearch/1.1/-/html-full/subject?searchTerms=',.)"/>
250         </xsl:attribute>
251         <xsl:value-of select="."/>
252        </a>
253       </xsl:when>
254       <xsl:otherwise>
255         <xsl:value-of select="."/>
256       </xsl:otherwise>
257      </xsl:choose>
258     </xsl:if>
259   </xsl:template>
260
261 </xsl:stylesheet>