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