adding RSS item and DC variants to 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[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
98                                 <description>
99                                         <xsl:value-of select="marc:subfield[@code='a']"/>
100                                 </description>
101                         </xsl:for-each>
102
103                         <xsl:for-each select="marc:datafield[@tag=600]">
104                                 <dc:subject>
105                                         <xsl:call-template name="subfieldSelect">
106                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
107                                         </xsl:call-template>
108                                 </dc:subject>
109                         </xsl:for-each>
110
111                         <xsl:for-each select="marc:datafield[@tag=610]">
112                                 <dc:subject>
113                                         <xsl:call-template name="subfieldSelect">
114                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
115                                         </xsl:call-template>
116                                 </dc:subject>
117                         </xsl:for-each>
118
119                         <xsl:for-each select="marc:datafield[@tag=611]">
120                                 <dc:subject>
121                                         <xsl:call-template name="subfieldSelect">
122                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
123                                         </xsl:call-template>
124                                 </dc:subject>
125                         </xsl:for-each>
126                 
127                         <xsl:for-each select="marc:datafield[@tag=630]">
128                                 <dc:subject>
129                                         <xsl:call-template name="subfieldSelect">
130                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
131                                         </xsl:call-template>
132                                 </dc:subject>
133                         </xsl:for-each>
134
135                         <xsl:for-each select="marc:datafield[@tag=650]">
136                                 <dc:subject>
137                                         <xsl:call-template name="subfieldSelect">
138                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
139                                         </xsl:call-template>
140                                 </dc:subject>
141                         </xsl:for-each>
142
143                         <xsl:for-each select="marc:datafield[@tag=653]">
144                                 <dc:subject>
145                                         <xsl:call-template name="subfieldSelect">
146                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
147                                         </xsl:call-template>
148                                 </dc:subject>
149                         </xsl:for-each>
150
151                         <xsl:for-each select="marc:datafield[@tag=752]">
152                                 <dc:coverage>
153                                         <xsl:call-template name="subfieldSelect">
154                                                 <xsl:with-param name="codes">abcd</xsl:with-param>
155                                         </xsl:call-template>
156                                 </dc:coverage>
157                         </xsl:for-each>
158
159                         <xsl:for-each select="marc:datafield[@tag=530]">
160                                 <dc:relation type="original">
161                                         <xsl:call-template name="subfieldSelect">
162                                                 <xsl:with-param name="codes">abcdu</xsl:with-param>
163                                         </xsl:call-template>
164                                 </dc:relation>  
165                         </xsl:for-each>
166
167                         <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]">
168                                 <dc:relation>
169                                         <xsl:call-template name="subfieldSelect">
170                                                 <xsl:with-param name="codes">ot</xsl:with-param>
171                                         </xsl:call-template>
172                                 </dc:relation>  
173                         </xsl:for-each>
174
175                         <xsl:for-each select="marc:datafield[@tag=856]">
176                                 <dc:identifier>
177                                         <xsl:value-of select="marc:subfield[@code='u']"/>
178                                 </dc:identifier>
179                         </xsl:for-each>
180                         
181                         <xsl:for-each select="marc:datafield[@tag=020]">
182                         <dc:identifier>
183                                 <xsl:text>URN:ISBN:</xsl:text>
184                                 <xsl:value-of select="marc:subfield[@code='a']"/>
185                         </dc:identifier>
186                 </xsl:for-each>
187
188                         <xsl:for-each select="marc:datafield[@tag=506]">
189                                 <dc:rights>
190                                         <xsl:value-of select="marc:subfield[@code='a']"/>
191                                 </dc:rights>
192                         </xsl:for-each>
193
194                         <xsl:for-each select="marc:datafield[@tag=540]">
195                                 <dc:rights>
196                                         <xsl:value-of select="marc:subfield[@code='a']"/>
197                                 </dc:rights>
198                         </xsl:for-each>
199                 </item>
200         </xsl:template>
201 </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
202 <metaInformation>
203 <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"/>
204 </metaInformation>
205 -->