Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac
[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                         <!-- this is supposed to be RFC-822 compliant -->
82                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
83                                 <pubDate>
84                                         <xsl:value-of select="."/>
85                                 </pubDate>                              
86                         </xsl:for-each>
87
88                         <dc:language>
89                                 <xsl:value-of select="substring($controlField008,36,3)"/>
90                         </dc:language>
91
92                         <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
93                                 <dc:format>
94                                         <xsl:value-of select="."/>
95                                 </dc:format>
96                         </xsl:for-each>
97
98                         <!-- specification only allows one description element per item -->
99                         <description>
100                                 <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
101                                                 <xsl:value-of select="marc:subfield[@code='a']"/>
102                                 </xsl:for-each>
103                         </description>
104
105                         <xsl:for-each select="marc:datafield[@tag=600]">
106                                 <dc:subject>
107                                         <xsl:call-template name="subfieldSelect">
108                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
109                                         </xsl:call-template>
110                                 </dc:subject>
111                         </xsl:for-each>
112
113                         <xsl:for-each select="marc:datafield[@tag=610]">
114                                 <dc:subject>
115                                         <xsl:call-template name="subfieldSelect">
116                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
117                                         </xsl:call-template>
118                                 </dc:subject>
119                         </xsl:for-each>
120
121                         <xsl:for-each select="marc:datafield[@tag=611]">
122                                 <dc:subject>
123                                         <xsl:call-template name="subfieldSelect">
124                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
125                                         </xsl:call-template>
126                                 </dc:subject>
127                         </xsl:for-each>
128                 
129                         <xsl:for-each select="marc:datafield[@tag=630]">
130                                 <dc:subject>
131                                         <xsl:call-template name="subfieldSelect">
132                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
133                                         </xsl:call-template>
134                                 </dc:subject>
135                         </xsl:for-each>
136
137                         <xsl:for-each select="marc:datafield[@tag=650]">
138                                 <dc:subject>
139                                         <xsl:call-template name="subfieldSelect">
140                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
141                                         </xsl:call-template>
142                                 </dc:subject>
143                         </xsl:for-each>
144
145                         <xsl:for-each select="marc:datafield[@tag=653]">
146                                 <dc:subject>
147                                         <xsl:call-template name="subfieldSelect">
148                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
149                                         </xsl:call-template>
150                                 </dc:subject>
151                         </xsl:for-each>
152
153                         <xsl:for-each select="marc:datafield[@tag=752]">
154                                 <dc:coverage>
155                                         <xsl:call-template name="subfieldSelect">
156                                                 <xsl:with-param name="codes">abcd</xsl:with-param>
157                                         </xsl:call-template>
158                                 </dc:coverage>
159                         </xsl:for-each>
160
161                         <xsl:for-each select="marc:datafield[@tag=530]">
162                                 <dc:relation type="original">
163                                         <xsl:call-template name="subfieldSelect">
164                                                 <xsl:with-param name="codes">abcdu</xsl:with-param>
165                                         </xsl:call-template>
166                                 </dc:relation>  
167                         </xsl:for-each>
168
169                         <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]">
170                                 <dc:relation>
171                                         <xsl:call-template name="subfieldSelect">
172                                                 <xsl:with-param name="codes">ot</xsl:with-param>
173                                         </xsl:call-template>
174                                 </dc:relation>  
175                         </xsl:for-each>
176
177                         <xsl:for-each select="marc:datafield[@tag=856]">
178                                 <dc:identifier>
179                                         <xsl:value-of select="marc:subfield[@code='u']"/>
180                                 </dc:identifier>
181                         </xsl:for-each>
182                         
183                         <xsl:for-each select="marc:datafield[@tag=020]">
184                         <dc:identifier>
185                                 <xsl:text>URN:ISBN:</xsl:text>
186                                 <xsl:value-of select="marc:subfield[@code='a']"/>
187                         </dc:identifier>
188                 </xsl:for-each>
189
190                         <xsl:for-each select="marc:datafield[@tag=506]">
191                                 <dc:rights>
192                                         <xsl:value-of select="marc:subfield[@code='a']"/>
193                                 </dc:rights>
194                         </xsl:for-each>
195
196                         <xsl:for-each select="marc:datafield[@tag=540]">
197                                 <dc:rights>
198                                         <xsl:value-of select="marc:subfield[@code='a']"/>
199                                 </dc:rights>
200                         </xsl:for-each>
201                 </item>
202         </xsl:template>
203 </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
204 <metaInformation>
205 <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"/>
206 </metaInformation>
207 -->