Add pretty printing to yaz-json-parse
[yaz-moved-to-github.git] / etc / MARC21slim2RDFDC.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 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         <xsl:template match="/">
7                         <xsl:apply-templates/>
8         </xsl:template>
9
10         <xsl:template match="marc:record">
11                 <xsl:variable name="leader" select="marc:leader"/>
12                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
13                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
14                 <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
15
16           <rdf:Description>
17                         <xsl:for-each select="marc:datafield[@tag=245]">
18                                 <dc:title>
19                                         <xsl:call-template name="subfieldSelect">
20                                                 <xsl:with-param name="codes">abfghk</xsl:with-param>
21                                         </xsl:call-template>
22                                 </dc:title>
23                         </xsl:for-each>
24
25         
26                         <xsl:for-each select="marc:datafield[@tag=100]|marc:datafield[@tag=110]|marc:datafield[@tag=111]|marc:datafield[@tag=700]|marc:datafield[@tag=710]|marc:datafield[@tag=711]|marc:datafield[@tag=720]">
27                                 <dc:creator>
28                                         <xsl:value-of select="."/>
29                                 </dc:creator>
30                         </xsl:for-each>
31
32                         <dc:type>               
33                                 <xsl:if test="$leader7='c'">
34                                         <xsl:attribute name="collection">yes</xsl:attribute>
35                                 </xsl:if>
36
37                                 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
38                                         <xsl:attribute name="manuscript">yes</xsl:attribute>
39                                 </xsl:if>
40
41                                 <xsl:choose>
42                                         <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
43                                         <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
44                                         <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
45                                         <xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>
46                                         <xsl:when test="$leader6='k'">still image</xsl:when>
47                                         <xsl:when test="$leader6='g'">moving image</xsl:when>
48                                         <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
49                                         <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
50                                         <xsl:when test="$leader6='p'">mixed material</xsl:when>
51                                 </xsl:choose>
52                         </dc:type>
53
54                         <xsl:for-each select="marc:datafield[@tag=655]">
55                                 <dc:type>
56                                         <xsl:value-of select="."/>
57                                 </dc:type>
58                         </xsl:for-each>
59
60                         <xsl:for-each select="marc:datafield[@tag=260]">
61                                 <dc:publisher>
62                                         <xsl:call-template name="subfieldSelect">
63                                                 <xsl:with-param name="codes">ab</xsl:with-param>
64                                         </xsl:call-template>
65                                 </dc:publisher>
66                         </xsl:for-each>
67
68                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='c']">
69                                 <dc:date>
70                                         <xsl:value-of select="."/>
71                                 </dc:date>                              
72                         </xsl:for-each>
73
74                         <dc:language>
75                                 <xsl:value-of select="substring($controlField008,36,3)"/>
76                         </dc:language>
77
78                         <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q']">
79                                 <dc:format>
80                                         <xsl:value-of select="."/>
81                                 </dc:format>
82                         </xsl:for-each>
83
84                         <xsl:for-each select="marc:datafield[@tag=520]">
85                                 <dc:description>
86                                         <xsl:value-of select="marc:subfield[@code='a']"/>
87                                 </dc:description>
88                         </xsl:for-each>
89
90                         <xsl:for-each select="marc:datafield[@tag=521]">
91                                 <dc:description>
92                                         <xsl:value-of select="marc:subfield[@code='a']"/>
93                                 </dc:description>
94                         </xsl:for-each>
95
96                         <xsl:for-each select="marc:datafield[500&lt;@tag][@tag&lt;=599][not(@tag=506 or @tag=530 or @tag=540 or @tag=546)]">
97                                 <dc:description>
98                                         <xsl:value-of select="marc:subfield[@code='a']"/>
99                                 </dc:description>
100                         </xsl:for-each>
101
102                         <xsl:for-each select="marc:datafield[@tag=600]">
103                                 <dc:subject>
104                                         <xsl:call-template name="subfieldSelect">
105                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
106                                         </xsl:call-template>
107                                 </dc:subject>
108                         </xsl:for-each>
109
110                         <xsl:for-each select="marc:datafield[@tag=610]">
111                                 <dc:subject>
112                                         <xsl:call-template name="subfieldSelect">
113                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
114                                         </xsl:call-template>
115                                 </dc:subject>
116                         </xsl:for-each>
117
118                         <xsl:for-each select="marc:datafield[@tag=611]">
119                                 <dc:subject>
120                                         <xsl:call-template name="subfieldSelect">
121                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
122                                         </xsl:call-template>
123                                 </dc:subject>
124                         </xsl:for-each>
125                 
126                         <xsl:for-each select="marc:datafield[@tag=630]">
127                                 <dc:subject>
128                                         <xsl:call-template name="subfieldSelect">
129                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
130                                         </xsl:call-template>
131                                 </dc:subject>
132                         </xsl:for-each>
133
134                         <xsl:for-each select="marc:datafield[@tag=650]">
135                                 <dc:subject>
136                                         <xsl:call-template name="subfieldSelect">
137                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
138                                         </xsl:call-template>
139                                 </dc:subject>
140                         </xsl:for-each>
141
142                         <xsl:for-each select="marc:datafield[@tag=653]">
143                                 <dc:subject>
144                                         <xsl:call-template name="subfieldSelect">
145                                                 <xsl:with-param name="codes">abcdq</xsl:with-param>
146                                         </xsl:call-template>
147                                 </dc:subject>
148                         </xsl:for-each>
149
150                         <xsl:for-each select="marc:datafield[@tag=752]">
151                                 <dc:coverage>
152                                         <xsl:call-template name="subfieldSelect">
153                                                 <xsl:with-param name="codes">abcd</xsl:with-param>
154                                         </xsl:call-template>
155                                 </dc:coverage>
156                         </xsl:for-each>
157
158                         <xsl:for-each select="marc:datafield[@tag=530]">
159                                 <dc:relation type="original">
160                                         <xsl:call-template name="subfieldSelect">
161                                                 <xsl:with-param name="codes">abcdu</xsl:with-param>
162                                         </xsl:call-template>
163                                 </dc:relation>  
164                         </xsl:for-each>
165
166                         <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]">
167                                 <dc:relation>
168                                         <xsl:call-template name="subfieldSelect">
169                                                 <xsl:with-param name="codes">ot</xsl:with-param>
170                                         </xsl:call-template>
171                                 </dc:relation>  
172                         </xsl:for-each>
173
174                         <xsl:for-each select="marc:datafield[@tag=856]">
175                                 <dc:identifier>
176                                         <xsl:value-of select="marc:subfield[@code='u']"/>
177                                 </dc:identifier>
178                         </xsl:for-each>
179
180                         <xsl:for-each select="marc:datafield[@tag=506]">
181                                 <dc:rights>
182                                         <xsl:value-of select="marc:subfield[@code='a']"/>
183                                 </dc:rights>
184                         </xsl:for-each>
185
186                         <xsl:for-each select="marc:datafield[@tag=540]">
187                                 <dc:rights>
188                                         <xsl:value-of select="marc:subfield[@code='a']"/>
189                                 </dc:rights>
190                         </xsl:for-each>
191                 </rdf:Description>
192         </xsl:template>
193 </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
194 <metaInformation>
195 <scenarios ><scenario default="no" name="MODS Website Samples" userelativepaths="yes" externalpreview="no" url="..\xml\MARC21slim\modswebsitesamples.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="Ray Charles" userelativepaths="yes" externalpreview="no" url="..\xml\MARC21slim\raycharles.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="s6" userelativepaths="yes" externalpreview="no" url="..\ifla\sally6.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="s7" userelativepaths="yes" externalpreview="no" url="..\ifla\sally7.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="s12" userelativepaths="yes" externalpreview="no" url="..\ifla\sally12.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
196 </metaInformation>
197 -->