]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xsl/MARC21slim2HTMLCard-holdings.xsl
updating copyright on ATOM xslt
[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        </head>
18        <body>
19         <xsl:apply-templates select="//marc:record"/>
20        </body>
21      </html>
22   </xsl:template>
23       
24   <xsl:template match="marc:record">
25     <div class="cardimage">
26      <xsl:apply-templates select="marc:datafield[@tag!='082' and @tag!='092' and @tag!='010']"/>
27      <span class="bottom">
28       <xsl:apply-templates select="xhtml:link[@rel='otherFormat' and contains(@href,'format=')]"/>
29       <xsl:apply-templates select="xhtml:abbr[@class='unapi-id']"/>
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     </div>
34     <br/>
35     <xsl:apply-templates select="hold:volumes"/>
36     <br/>
37   </xsl:template>
38
39   <xsl:template match="xhtml:abbr">
40     <abbr>
41       <xsl:attribute name="title">
42         <xsl:value-of select="@title"/>
43       </xsl:attribute>
44       <xsl:attribute name="class">
45         <xsl:value-of select="@class"/>
46       </xsl:attribute>
47       <xsl:value-of select="."/>
48     </abbr>
49   </xsl:template>
50
51   <xsl:template match="xhtml:link">
52     <xsl:choose>
53       <xsl:when test="@title='unapi'">
54         <link rel="unapi-server" title="unAPI" type="application/xml">
55           <xsl:attribute name="href">
56             <xsl:value-of select="@href"/>
57           </xsl:attribute>
58         </link>
59       </xsl:when>
60       <xsl:when test="@rel='otherFormat' and contains(@href,'format=')">
61         <a>
62           <xsl:attribute name="href">
63             <xsl:value-of select="@href"/>
64           </xsl:attribute>
65           <xsl:value-of select="@title"/>
66         </a>
67         <br/>
68       </xsl:when>
69     </xsl:choose>
70   </xsl:template>
71
72   <xsl:template match="hold:volumes">
73     <xsl:if test="count(hold:volume/hold:copies/hold:copy) &gt; 0">
74         <u>Holdings</u>
75     </xsl:if>
76     <ul>
77     <xsl:apply-templates select="hold:volume">
78       <xsl:sort select="@lib"/>
79     </xsl:apply-templates>
80     </ul>
81   </xsl:template>
82
83   <xsl:template match="hold:volume">
84       <li> <b><xsl:value-of select="./@label"/></b>
85         <xsl:apply-templates select="hold:copies"/>
86       </li>
87   </xsl:template>
88
89   <xsl:template match="hold:copies">
90     <ul>
91     <xsl:apply-templates select="hold:copy">
92       <xsl:sort select="hold:location"/>
93     </xsl:apply-templates>
94     </ul>
95   </xsl:template>
96
97   <xsl:template match="hold:copy">
98       <li> <xsl:value-of select="@barcode"/>
99         <ul>
100           <li>Circulating from <b><xsl:value-of select="hold:circlib"/></b></li>
101           <li>Located at <b><xsl:value-of select="hold:location"/></b></li>
102           <li>Status is <b><xsl:value-of select="hold:status"/></b></li>
103           <xsl:apply-templates select="hold:statcats"/>
104         </ul>
105       </li>
106   </xsl:template>
107
108   <xsl:template match="hold:statcats">
109     <xsl:if test="count(hold:statcat) &gt; 0">
110       <li>Statistical Catagories
111         <ul>
112         <xsl:apply-templates select="hold:statcat">
113           <xsl:sort select="@name"/>
114         </xsl:apply-templates>
115         </ul>
116       </li>
117     </xsl:if>
118   </xsl:template>
119
120   <xsl:template match="hold:statcat">
121       <li> <b><xsl:value-of select="@name"/></b>: <xsl:value-of select="."/> </li>
122   </xsl:template>
123
124   <xsl:template match="marc:controlfield">
125       <span class="oclc">#<xsl:value-of select="substring(.,4)"/></span>
126   </xsl:template>
127       
128   <xsl:template match="marc:datafield">
129     <xsl:if test="starts-with(@tag, '1')">
130       <p class="mainheading"><xsl:value-of select="."/></p>
131     </xsl:if>
132
133     <xsl:if test="starts-with(@tag, '24') and /marc:record/marc:datafield[@tag='100']">
134       <span class="title"><xsl:value-of select="."/></span>
135     </xsl:if>
136
137     <xsl:if test="starts-with(@tag, '24') and not(/marc:record/marc:datafield[@tag='100'])">
138       <span class="titlemain"><xsl:value-of select="."/></span><br/>
139     </xsl:if>
140
141     <xsl:if test="@tag='260'">
142       <xsl:value-of select="."/>
143     </xsl:if>
144
145     <xsl:if test="@tag='300'">
146       <p class="extent"><xsl:value-of select="."/></p>
147      </xsl:if>
148
149     <xsl:if test="starts-with(@tag, '5')">
150       <p class="note"><xsl:value-of select="."/></p>
151     </xsl:if>
152
153     <xsl:if test="@tag='650'">
154       <span class='counter'><xsl:number count="marc:datafield[@tag='650']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
155     </xsl:if>
156
157     <xsl:if test="@tag='653'">
158       <span class="counter"><xsl:number format="i" count="marc:datafield[@tag='653']"/>.</span> <xsl:apply-templates select="marc:subfield"/>
159     </xsl:if>
160
161     <xsl:if test="@tag='010'">
162       <xsl:variable name="LCCN.nospace" select="translate(., ' ', '')"/>
163       <xsl:variable name="LCCN.length" select="string-length($LCCN.nospace)"/>
164       <xsl:variable name="LCCN.display" select="concat(substring($LCCN.nospace, 1, $LCCN.length - 6), '-', format-number(substring($LCCN.nospace, $LCCN.length - 5),'#'))"/>
165       <span class="LCCN">LCCN:<xsl:value-of select="$LCCN.display"/></span>
166     </xsl:if>
167
168     <xsl:if test="@tag='082' or @tag='092'">
169       <span class="DDC"><xsl:value-of select="marc:subfield[@code='a']"/></span>
170     </xsl:if>
171
172     <xsl:if test="@tag='856'">
173      <br/><xsl:apply-templates mode="link" select="marc:subfield" />
174     </xsl:if>
175   </xsl:template>
176
177   <xsl:template match="marc:subfield" mode="link">
178     <xsl:if test="@code='u'">
179       <span class="link">
180         <a class="url" href="{.}">
181                 <xsl:choose>
182                         <xsl:when test="../marc:subfield[@code='y']">
183                                 <xsl:value-of select="../marc:subfield[@code='y']"/>
184                         </xsl:when>
185                         <xsl:when test="../marc:subfield[@code='3']">
186                                 <xsl:value-of select="../marc:subfield[@code='3']"/>
187                         </xsl:when>
188                         <xsl:otherwise>
189                                 <xsl:value-of select="."/>
190                         </xsl:otherwise>
191                 </xsl:choose>
192         </a>
193       </span>
194     </xsl:if>
195   </xsl:template>
196   
197   <xsl:template match="marc:subfield">
198     <xsl:if test="@code!='2'">    
199      <xsl:if test="@code!='a'">--</xsl:if>
200      <xsl:value-of select="."/>
201     </xsl:if>
202   </xsl:template>
203
204 </xsl:stylesheet>