RSS2.0 xslt for supercat
[working/Evergreen.git] / Open-ILS / xsl / MARC21slim2RSS2.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
3         <xsl:import href="MARC21slimUtils.xsl"/>
4         <xsl:output method="xml" indent="yes"/>
5         
6         <!--Added ISBN and deleted attributes 6/04 jer-->
7         
8         <xsl:template match="/">
9                         <xsl:apply-templates/>
10         </xsl:template>
11
12         <xsl:template match="marc:record">
13                 <xsl:variable name="leader" select="marc:leader"/>
14                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
15                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
16                 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
17
18           <item>
19                         <xsl:for-each select="marc:datafield[@tag=245]">
20                                 <title>
21                                         <xsl:call-template name="subfieldSelect">
22                                                 <xsl:with-param name="codes">abfghk</xsl:with-param>
23                                         </xsl:call-template>
24                                 </title>
25                         </xsl:for-each>
26
27         
28                         <xsl:for-each select="marc:datafield[@tag=100]">
29                                 <author>
30                                         <xsl:value-of select="."/>
31                                 </author>
32                         </xsl:for-each>
33
34                         <xsl:for-each select="marc:datafield[@tag=110]|marc:datafield[@tag=111]|marc:datafield[@tag=700]|marc:datafield[@tag=710]|marc:datafield[@tag=711]|marc:datafield[@tag=720]">
35                                 <dc:creator>
36                                         <xsl:value-of select="."/>
37                                 </dc:creator>
38                         </xsl:for-each>
39
40                         <dc:type>               
41                                 <xsl:if test="$leader7='c'">
42                                 <xsl:text>collection</xsl:text>
43                                 <!--Removed attributes 6/04 jer-->
44                                         <!--<xsl:attribute name="collection">yes</xsl:attribute>-->
45                                 </xsl:if>
46
47                                 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
48                                         <!--Removed attributes 6/04 jer-->
49                                 
50                                         <!--<xsl:attribute name="manuscript">yes</xsl:attribute>-->
51                                         <xsl:text>manuscript</xsl:text>
52                                 </xsl:if>
53
54                                 <xsl:choose>
55                                         <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
56                                         <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
57                                         <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
58                                         <xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>
59                                         <xsl:when test="$leader6='k'">still image</xsl:when>
60                                         <xsl:when test="$leader6='g'">moving image</xsl:when>
61                                         <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
62                                         <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
63                                         <xsl:when test="$leader6='p'">mixed material</xsl:when>
64                                 </xsl:choose>
65                         </dc:type>
66
67                         <xsl:for-each select="marc:datafield[@tag=655]">
68                                 <category>
69                                         <xsl:value-of select="."/>
70                                 </category>
71                         </xsl:for-each>
72
73                         <xsl:for-each select="marc:datafield[@tag=260]">
74                                 <dc:publisher>
75                                         <xsl:call-template name="subfieldSelect">
76                                                 <xsl:with-param name="codes">ab</xsl:with-param>
77                                         </xsl:call-template>
78                                 </dc:publisher>
79                         </xsl:for-each>
80
81                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
82                                 <pubDate>
83                                         <xsl:value-of select="."/>
84                                 </pubDate>                              
85                         </xsl:for-each>
86
87                         <dc:language>
88                                 <xsl:value-of select="substring($controlField008,36,3)"/>
89                         </dc:language>
90
91                         <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
92                                 <dc:format>
93                                         <xsl:value-of select="."/>
94                                 </dc:format>
95                         </xsl:for-each>
96
97                         <xsl:for-each select="marc:datafield[@tag=520]">
98                                 <dc:description>
99                                         <xsl:value-of select="marc:subfield[@code='a']"/>
100                                 </dc:description>
101                         </xsl:for-each>
102
103                         <xsl:for-each select="marc:datafield[@tag=521]">
104                                 <dc:description>
105                                         <xsl:value-of select="marc:subfield[@code='a']"/>
106                                 </dc:description>
107                         </xsl:for-each>
108
109                         <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
110                                 <dc:description>
111                                         <xsl:value-of select="marc:subfield[@code='a']"/>
112                                 </dc:description>
113                         </xsl:for-each>
114
115                         <xsl:for-each select="marc:datafield[@tag=600]">
116                                 <dc:subject>
117                                         <xsl:call-template name="subfieldSelect">
118                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
119                                         </xsl:call-template>
120                                 </dc:subject>
121                         </xsl:for-each>
122
123                         <xsl:for-each select="marc:datafield[@tag=610]">
124                                 <dc:subject>
125                                         <xsl:call-template name="subfieldSelect">
126                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
127                                         </xsl:call-template>
128                                 </dc:subject>
129                         </xsl:for-each>
130
131                         <xsl:for-each select="marc:datafield[@tag=611]">
132                                 <dc:subject>
133                                         <xsl:call-template name="subfieldSelect">
134                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
135                                         </xsl:call-template>
136                                 </dc:subject>
137                         </xsl:for-each>
138                 
139                         <xsl:for-each select="marc:datafield[@tag=630]">
140                                 <dc:subject>
141                                         <xsl:call-template name="subfieldSelect">
142                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
143                                         </xsl:call-template>
144                                 </dc:subject>
145                         </xsl:for-each>
146
147                         <xsl:for-each select="marc:datafield[@tag=650]">
148                                 <dc:subject>
149                                         <xsl:call-template name="subfieldSelect">
150                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
151                                         </xsl:call-template>
152                                 </dc:subject>
153                         </xsl:for-each>
154
155                         <xsl:for-each select="marc:datafield[@tag=653]">
156                                 <dc:subject>
157                                         <xsl:call-template name="subfieldSelect">
158                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
159                                         </xsl:call-template>
160                                 </dc:subject>
161                         </xsl:for-each>
162
163                         <xsl:for-each select="marc:datafield[@tag=752]">
164                                 <dc:coverage>
165                                         <xsl:call-template name="subfieldSelect">
166                                                 <xsl:with-param name="codes">abcd</xsl:with-param>
167                                         </xsl:call-template>
168                                 </dc:coverage>
169                         </xsl:for-each>
170
171                         <xsl:for-each select="marc:datafield[@tag=530]">
172                                 <dc:relation type="original">
173                                         <xsl:call-template name="subfieldSelect">
174                                                 <xsl:with-param name="codes">abcdu</xsl:with-param>
175                                         </xsl:call-template>
176                                 </dc:relation>  
177                         </xsl:for-each>
178
179                         <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]|marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=770]|marc:datafield[@tag=772]|marc:datafield[@tag=773]|marc:datafield[@tag=774]|marc:datafield[@tag=775]|marc:datafield[@tag=776]|marc:datafield[@tag=777]|marc:datafield[@tag=780]|marc:datafield[@tag=785]|marc:datafield[@tag=786]|marc:datafield[@tag=787]">
180                                 <dc:relation>
181                                         <xsl:call-template name="subfieldSelect">
182                                                 <xsl:with-param name="codes">ot</xsl:with-param>
183                                         </xsl:call-template>
184                                 </dc:relation>  
185                         </xsl:for-each>
186
187                         <xsl:for-each select="marc:datafield[@tag=856]">
188                                 <dc:identifier>
189                                         <xsl:value-of select="marc:subfield[@code='u']"/>
190                                 </dc:identifier>
191                         </xsl:for-each>
192                         
193                         <xsl:for-each select="marc:datafield[@tag=020]">
194                         <dc:identifier>
195                                 <xsl:text>URN:ISBN:</xsl:text>
196                                 <xsl:value-of select="marc:subfield[@code='a']"/>
197                         </dc:identifier>
198                 </xsl:for-each>
199
200                         <xsl:for-each select="marc:datafield[@tag=506]">
201                                 <dc:rights>
202                                         <xsl:value-of select="marc:subfield[@code='a']"/>
203                                 </dc:rights>
204                         </xsl:for-each>
205
206                         <xsl:for-each select="marc:datafield[@tag=540]">
207                                 <dc:rights>
208                                         <xsl:value-of select="marc:subfield[@code='a']"/>
209                                 </dc:rights>
210                         </xsl:for-each>
211                 </item>
212         </xsl:template>
213 </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
214 <metaInformation>
215 <scenarios ><scenario default="yes" name="RDF" userelativepaths="yes" externalpreview="no" url="marcxmlfile.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
216 </metaInformation>
217 -->