bibframe_ruby 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -2
  3. data/docs/superpowers/plans/2026-09-09-marc-conversion.md +537 -0
  4. data/docs/superpowers/specs/2026-09-09-marc-conversion-design.md +110 -0
  5. data/lib/bibframe_ruby/marc_converter.rb +67 -0
  6. data/lib/bibframe_ruby/parser.rb +4 -2
  7. data/lib/bibframe_ruby/version.rb +1 -1
  8. data/lib/bibframe_ruby.rb +7 -0
  9. data/vendor/marc2bibframe2/xsl/ConvSpec-001-007.xsl +2276 -0
  10. data/vendor/marc2bibframe2/xsl/ConvSpec-006,008.xsl +1295 -0
  11. data/vendor/marc2bibframe2/xsl/ConvSpec-010-048.xsl +1712 -0
  12. data/vendor/marc2bibframe2/xsl/ConvSpec-050-088.xsl +713 -0
  13. data/vendor/marc2bibframe2/xsl/ConvSpec-1XX,7XX,8XX-names.xsl +1141 -0
  14. data/vendor/marc2bibframe2/xsl/ConvSpec-200-247not240-Titles.xsl +771 -0
  15. data/vendor/marc2bibframe2/xsl/ConvSpec-240andX30-UnifTitle.xsl +535 -0
  16. data/vendor/marc2bibframe2/xsl/ConvSpec-250-270.xsl +283 -0
  17. data/vendor/marc2bibframe2/xsl/ConvSpec-3XX.xsl +2245 -0
  18. data/vendor/marc2bibframe2/xsl/ConvSpec-460-468-SeriesTreat.xsl +135 -0
  19. data/vendor/marc2bibframe2/xsl/ConvSpec-490-510-Links.xsl +145 -0
  20. data/vendor/marc2bibframe2/xsl/ConvSpec-5XX.xsl +1448 -0
  21. data/vendor/marc2bibframe2/xsl/ConvSpec-600-662.xsl +1417 -0
  22. data/vendor/marc2bibframe2/xsl/ConvSpec-720+740to755.xsl +333 -0
  23. data/vendor/marc2bibframe2/xsl/ConvSpec-758.xsl +102 -0
  24. data/vendor/marc2bibframe2/xsl/ConvSpec-760-788-Links.xsl +771 -0
  25. data/vendor/marc2bibframe2/xsl/ConvSpec-841-887.xsl +328 -0
  26. data/vendor/marc2bibframe2/xsl/ConvSpec-880.xsl +119 -0
  27. data/vendor/marc2bibframe2/xsl/ConvSpec-ControlSubfields.xsl +495 -0
  28. data/vendor/marc2bibframe2/xsl/ConvSpec-LDR.xsl +183 -0
  29. data/vendor/marc2bibframe2/xsl/ConvSpec-Preprocess0-Splitting.xsl +765 -0
  30. data/vendor/marc2bibframe2/xsl/ConvSpec-Process6-Series.xsl +627 -0
  31. data/vendor/marc2bibframe2/xsl/ConvSpec-Process8-ProvAct.xsl +1021 -0
  32. data/vendor/marc2bibframe2/xsl/conf/abbreviations.xml +13 -0
  33. data/vendor/marc2bibframe2/xsl/conf/code-to-script.xml +399 -0
  34. data/vendor/marc2bibframe2/xsl/conf/codeMaps.xml +723 -0
  35. data/vendor/marc2bibframe2/xsl/conf/exclusions.xml +4 -0
  36. data/vendor/marc2bibframe2/xsl/conf/iso6392-to-1.xml +615 -0
  37. data/vendor/marc2bibframe2/xsl/conf/languageCrosswalk.xml +1503 -0
  38. data/vendor/marc2bibframe2/xsl/conf/map880.xml +175 -0
  39. data/vendor/marc2bibframe2/xsl/conf/scriptCrosswalk.xml +210 -0
  40. data/vendor/marc2bibframe2/xsl/conf/subjectThesaurus.xml +29 -0
  41. data/vendor/marc2bibframe2/xsl/marc2bibframe2.xsl +610 -0
  42. data/vendor/marc2bibframe2/xsl/naco-normalize.xsl +205 -0
  43. data/vendor/marc2bibframe2/xsl/utils.xsl +963 -0
  44. data/vendor/marc2bibframe2/xsl/variables.xsl +108 -0
  45. metadata +68 -1
@@ -0,0 +1,495 @@
1
+ <?xml version='1.0'?>
2
+ <xsl:stylesheet version="1.0"
3
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
5
+ xmlns:marc="http://www.loc.gov/MARC21/slim"
6
+ xmlns:bf="http://id.loc.gov/ontologies/bibframe/"
7
+ xmlns:bflc="http://id.loc.gov/ontologies/bflc/"
8
+ xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#"
9
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10
+ exclude-result-prefixes="xsl marc">
11
+
12
+ <!-- Templates for processing MARC control subfields -->
13
+
14
+ <!--
15
+ generate agent or work URI from 1XX, 6XX, 7XX, or 8XX, taking $0 or $w into account
16
+ generated URI will come from the first URI in a $0 or $w
17
+ -->
18
+ <xsl:template match="marc:datafield" mode="generateUri">
19
+ <xsl:param name="pDefaultUri"/>
20
+ <xsl:param name="pEntity"/>
21
+ <xsl:variable name="vGeneratedUri">
22
+ <xsl:choose>
23
+ <xsl:when test="marc:subfield[@code='t']">
24
+ <xsl:variable name="vIdentifier">
25
+ <xsl:choose>
26
+ <xsl:when test="$pEntity='bf:Agent'">
27
+ <xsl:value-of select="marc:subfield[@code='t']/preceding-sibling::marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')][1]"/>
28
+ </xsl:when>
29
+ <xsl:when test="$pEntity='bf:Work' or $pEntity = 'bf:Hub'">
30
+ <xsl:value-of select="marc:subfield[@code='t']/following-sibling::marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')][1]"/>
31
+ </xsl:when>
32
+ </xsl:choose>
33
+ </xsl:variable>
34
+ <xsl:choose>
35
+ <xsl:when test="starts-with($vIdentifier,'(uri)')">
36
+ <xsl:value-of select="substring-after($vIdentifier,'(uri)')"/>
37
+ </xsl:when>
38
+ <xsl:when test="starts-with($vIdentifier,'http')">
39
+ <xsl:value-of select="$vIdentifier"/>
40
+ </xsl:when>
41
+ </xsl:choose>
42
+ </xsl:when>
43
+ <xsl:when test="marc:subfield[@code='1'][starts-with(text(),'http')]">
44
+ <xsl:value-of select="marc:subfield[@code='1'][starts-with(text(),'http')][1]" />
45
+ </xsl:when>
46
+ <xsl:when test="marc:subfield[@code='0'][starts-with(text(),'(OCoLC)fst')]">
47
+ <!-- http://id.worldcat.org/fast/1919741 -->
48
+ <xsl:variable name="vIdentifier" select="marc:subfield[@code='0'][starts-with(text(),'(OCoLC)fst')]" />
49
+ <xsl:value-of select="concat('http://id.worldcat.org/fast/', substring-after($vIdentifier,'(OCoLC)fst'))" />
50
+ </xsl:when>
51
+ <xsl:otherwise>
52
+ <xsl:variable name="vIdentifier">
53
+ <xsl:value-of select="marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')][1]"/>
54
+ </xsl:variable>
55
+ <xsl:choose>
56
+ <xsl:when test="starts-with($vIdentifier,'(uri)')">
57
+ <xsl:value-of select="substring-after($vIdentifier,'(uri)')"/>
58
+ </xsl:when>
59
+ <xsl:when test="starts-with($vIdentifier,'http')">
60
+ <xsl:value-of select="$vIdentifier"/>
61
+ </xsl:when>
62
+ </xsl:choose>
63
+ </xsl:otherwise>
64
+ </xsl:choose>
65
+ </xsl:variable>
66
+ <xsl:choose>
67
+ <xsl:when test="$vGeneratedUri != ''"><xsl:value-of select="$vGeneratedUri"/></xsl:when>
68
+ <xsl:otherwise><xsl:value-of select="$pDefaultUri"/></xsl:otherwise>
69
+ </xsl:choose>
70
+ </xsl:template>
71
+
72
+ <!--
73
+ generate URI from Dollar 0
74
+ -->
75
+ <xsl:template match="marc:datafield" mode="generateUriFrom0">
76
+ <xsl:param name="pDefaultUri"/>
77
+ <xsl:variable name="vGeneratedUri">
78
+ <xsl:choose>
79
+ <xsl:when test="marc:subfield[@code='0'][contains(text(),'id.loc.gov/authorities/')]">
80
+ <xsl:variable name="vIdentifier">
81
+ <xsl:value-of select="marc:subfield[@code='0'][contains(text(),'id.loc.gov/authorities/')][1]"/>
82
+ </xsl:variable>
83
+ <xsl:choose>
84
+ <xsl:when test="starts-with($vIdentifier,'(uri)https://')">
85
+ <xsl:value-of select="concat('http://', substring-after($vIdentifier,'(uri)https://'))"/>
86
+ </xsl:when>
87
+ <xsl:when test="starts-with($vIdentifier,'(uri) ')">
88
+ <xsl:value-of select="substring-after($vIdentifier,'(uri) ')"/>
89
+ </xsl:when>
90
+ <xsl:when test="starts-with($vIdentifier,'(uri)')">
91
+ <xsl:value-of select="substring-after($vIdentifier,'(uri)')"/>
92
+ </xsl:when>
93
+ <xsl:when test="starts-with($vIdentifier,'https://')">
94
+ <xsl:value-of select="concat('http://', substring-after($vIdentifier,'https://'))"/>
95
+ </xsl:when>
96
+ <xsl:when test="starts-with($vIdentifier,'http')">
97
+ <xsl:value-of select="$vIdentifier"/>
98
+ </xsl:when>
99
+ </xsl:choose>
100
+ </xsl:when>
101
+ <xsl:when test="marc:subfield[@code='1'][contains(text(),'id.loc.gov/rwo/agents/')]">
102
+ <xsl:variable name="sf1" select="marc:subfield[@code='1']"/>
103
+ <xsl:variable name="v1Identifier">
104
+ <xsl:value-of select="concat(substring-before($sf1,'rwo/agents'), 'authorities/names/', substring-after($sf1,'rwo/agents/'))"/>
105
+ </xsl:variable>
106
+ <xsl:choose>
107
+ <xsl:when test="starts-with($v1Identifier,'https://')">
108
+ <xsl:value-of select="concat('http://', substring-after($v1Identifier,'https://'))"/>
109
+ </xsl:when>
110
+ <xsl:when test="starts-with($v1Identifier,'http')">
111
+ <xsl:value-of select="$v1Identifier"/>
112
+ </xsl:when>
113
+ </xsl:choose>
114
+ </xsl:when>
115
+ <xsl:when test="marc:subfield[@code='0'][starts-with(text(),'(OCoLC)fst')]">
116
+ <!-- http://id.worldcat.org/fast/1919741 -->
117
+ <xsl:variable name="vIdentifier" select="marc:subfield[@code='0'][starts-with(text(),'(OCoLC)fst')]" />
118
+ <xsl:value-of select="concat('http://id.worldcat.org/fast/', substring-after($vIdentifier,'(OCoLC)fst'))" />
119
+ </xsl:when>
120
+ <xsl:when test="marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')][1]">
121
+ <xsl:variable name="vIdentifier">
122
+ <xsl:value-of select="marc:subfield[@code='0' or @code='w'][starts-with(text(),'(uri)') or starts-with(text(),'http')][1]"/>
123
+ </xsl:variable>
124
+ <xsl:choose>
125
+ <xsl:when test="starts-with($vIdentifier,'(uri)')">
126
+ <xsl:value-of select="substring-after($vIdentifier,'(uri)')"/>
127
+ </xsl:when>
128
+ <xsl:when test="starts-with($vIdentifier,'http')">
129
+ <xsl:value-of select="$vIdentifier"/>
130
+ </xsl:when>
131
+ </xsl:choose>
132
+ </xsl:when>
133
+ <xsl:when test="marc:subfield[@code='0'][starts-with(text(),'(DE-588)')]">
134
+ <xsl:variable name="vIdentifier">
135
+ <xsl:value-of select="marc:subfield[@code='0'][starts-with(text(),'(DE-588)')][1]"/>
136
+ </xsl:variable>
137
+ <xsl:choose>
138
+ <xsl:when test="substring($vIdentifier, string-length($vIdentifier)) != '.'">
139
+ <xsl:value-of select="concat('https://d-nb.info/gnd/', substring-after($vIdentifier,'(DE-588)'))"/>
140
+ </xsl:when>
141
+ <xsl:otherwise>
142
+ <xsl:value-of select="concat('https://d-nb.info/gnd/', substring-after(substring($vIdentifier, 1, string-length($vIdentifier) - 1),'(DE-588)'))"/>
143
+ </xsl:otherwise>
144
+ </xsl:choose>
145
+ </xsl:when>
146
+ <xsl:when test="marc:subfield[@code='1'][contains(text(),'homosaurus.org/v')]">
147
+ <xsl:value-of select="marc:subfield[@code='1'][contains(text(),'homosaurus.org/v')]"/>
148
+ </xsl:when>
149
+ </xsl:choose>
150
+ </xsl:variable>
151
+ <xsl:choose>
152
+ <xsl:when test="$vGeneratedUri != ''"><xsl:value-of select="$vGeneratedUri"/></xsl:when>
153
+ <xsl:otherwise><xsl:value-of select="$pDefaultUri"/></xsl:otherwise>
154
+ </xsl:choose>
155
+ </xsl:template>
156
+
157
+ <!--
158
+ generate URI from Dollar 1
159
+ -->
160
+ <xsl:template match="marc:datafield" mode="generateUriFrom1">
161
+ <xsl:param name="pDefaultUri"/>
162
+ <xsl:variable name="vGeneratedUri">
163
+ <xsl:choose>
164
+ <xsl:when test="marc:subfield[@code='1'][contains(text(),'id.loc.gov/rwo/agents/')]">
165
+ <xsl:variable name="v1Identifier" select="marc:subfield[@code='1'][contains(text(),'id.loc.gov/rwo/agents/')]"/>
166
+ <xsl:choose>
167
+ <xsl:when test="starts-with($v1Identifier,'https://')">
168
+ <xsl:value-of select="concat('http://', substring-after($v1Identifier,'https://'))"/>
169
+ </xsl:when>
170
+ <xsl:otherwise>
171
+ <xsl:value-of select="$v1Identifier"/>
172
+ </xsl:otherwise>
173
+ </xsl:choose>
174
+ </xsl:when>
175
+ <xsl:when test="marc:subfield[@code='0'][contains(text(),'id.loc.gov/authorities/names/')]">
176
+ <xsl:variable name="sf0" select="marc:subfield[@code='0'][contains(text(),'id.loc.gov/authorities/names/')]"/>
177
+ <xsl:variable name="v0Identifier">
178
+ <xsl:value-of select="concat(substring-before($sf0,'authorities/names'), 'rwo/agents/', substring-after($sf0,'authorities/names/'))"/>
179
+ </xsl:variable>
180
+ <xsl:choose>
181
+ <xsl:when test="starts-with($v0Identifier,'(uri)https://')">
182
+ <xsl:value-of select="concat('http://', substring-after($v0Identifier,'(uri)https://'))"/>
183
+ </xsl:when>
184
+ <xsl:when test="starts-with($v0Identifier,'(uri) ')">
185
+ <xsl:value-of select="substring-after($v0Identifier,'(uri) ')"/>
186
+ </xsl:when>
187
+ <xsl:when test="starts-with($v0Identifier,'(uri)')">
188
+ <xsl:value-of select="substring-after($v0Identifier,'(uri)')"/>
189
+ </xsl:when>
190
+ <xsl:when test="starts-with($v0Identifier,'https://')">
191
+ <xsl:value-of select="concat('http://', substring-after($v0Identifier,'https://'))"/>
192
+ </xsl:when>
193
+ <xsl:otherwise>
194
+ <xsl:value-of select="$v0Identifier"/>
195
+ </xsl:otherwise>
196
+ </xsl:choose>
197
+ </xsl:when>
198
+ <xsl:when test="marc:subfield[@code='1'][contains(text(),'isni.org/isni/')]">
199
+ <xsl:variable name="vIdentifier">
200
+ <xsl:value-of select="marc:subfield[@code='1'][contains(text(),'isni.org/isni/')][1]"/>
201
+ </xsl:variable>
202
+ <xsl:choose>
203
+ <xsl:when test="substring($vIdentifier, string-length($vIdentifier)) = '.'">
204
+ <xsl:value-of select="substring($vIdentifier, 1, string-length($vIdentifier) - 1)"/>
205
+ </xsl:when>
206
+ <xsl:otherwise>
207
+ <xsl:value-of select="$vIdentifier"/>
208
+ </xsl:otherwise>
209
+ </xsl:choose>
210
+ </xsl:when>
211
+ <xsl:when test="marc:subfield[@code='1'][starts-with(text(),'http')]">
212
+ <xsl:value-of select="marc:subfield[@code='1'][starts-with(text(),'http')][1]" />
213
+ </xsl:when>
214
+ </xsl:choose>
215
+ </xsl:variable>
216
+ <xsl:choose>
217
+ <xsl:when test="$vGeneratedUri != ''"><xsl:value-of select="$vGeneratedUri"/></xsl:when>
218
+ <xsl:otherwise><xsl:value-of select="$pDefaultUri"/></xsl:otherwise>
219
+ </xsl:choose>
220
+ </xsl:template>
221
+
222
+ <!--
223
+ create a bf:identifiedBy property from a subfield $0 or $w
224
+ -->
225
+ <xsl:template match="marc:subfield" mode="subfield0orw">
226
+ <xsl:param name="serialization" select="'rdfxml'"/>
227
+ <xsl:param name="pIdClass" select="'bf:Identifier'"/>
228
+ <xsl:variable name="source" select="substring(substring-after(text(),'('),1,string-length(substring-before(text(),')'))-1)"/>
229
+ <xsl:variable name="value">
230
+ <xsl:choose>
231
+ <xsl:when test="$source != ''"><xsl:value-of select="substring-after(text(),')')"/></xsl:when>
232
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
233
+ </xsl:choose>
234
+ </xsl:variable>
235
+ <xsl:choose>
236
+ <xsl:when test="$serialization='rdfxml'">
237
+ <xsl:choose>
238
+ <xsl:when test="starts-with(text(),'http')">
239
+ <madsrdf:isIdentifiedByAuthority>
240
+ <xsl:attribute name="rdf:resource">
241
+ <xsl:value-of select="text()" />
242
+ </xsl:attribute>
243
+ </madsrdf:isIdentifiedByAuthority>
244
+ </xsl:when>
245
+ <xsl:when test="starts-with(text(),'(uri) ')">
246
+ <madsrdf:isIdentifiedByAuthority>
247
+ <xsl:attribute name="rdf:resource">
248
+ <xsl:value-of select="substring-after(text(),'(uri) ')" />
249
+ </xsl:attribute>
250
+ </madsrdf:isIdentifiedByAuthority>
251
+ </xsl:when>
252
+ <xsl:when test="starts-with(text(),'(uri)')">
253
+ <madsrdf:isIdentifiedByAuthority>
254
+ <xsl:attribute name="rdf:resource">
255
+ <xsl:value-of select="substring-after(text(),'(uri)')" />
256
+ </xsl:attribute>
257
+ </madsrdf:isIdentifiedByAuthority>
258
+ </xsl:when>
259
+ <xsl:when test="starts-with(text(),'(OCoLC)fst')">
260
+ <!-- http://id.worldcat.org/fast/1919741 -->
261
+ <madsrdf:isIdentifiedByAuthority>
262
+ <xsl:attribute name="rdf:resource">
263
+ <xsl:value-of select="concat('http://id.worldcat.org/fast/', substring-after(text(),'(OCoLC)fst'))" />
264
+ </xsl:attribute>
265
+ </madsrdf:isIdentifiedByAuthority>
266
+ </xsl:when>
267
+ <xsl:otherwise>
268
+ <bf:identifiedBy>
269
+ <xsl:element name="{$pIdClass}">
270
+ <rdf:value>
271
+ <xsl:choose>
272
+ <xsl:when test="contains($value,'://')">
273
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$value"/></xsl:attribute>
274
+ </xsl:when>
275
+ <xsl:otherwise>
276
+ <xsl:value-of select="$value"/>
277
+ </xsl:otherwise>
278
+ </xsl:choose>
279
+ </rdf:value>
280
+ <xsl:if test="$source != '' and $source != 'uri'">
281
+ <xsl:choose>
282
+ <xsl:when test="@code='w'">
283
+ <bf:assigner>
284
+ <bf:Agent>
285
+ <xsl:if test="$source='DLC'">
286
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
287
+ </xsl:if>
288
+ <bf:code><xsl:value-of select="$source"/></bf:code>
289
+ </bf:Agent>
290
+ </bf:assigner>
291
+ </xsl:when>
292
+ <xsl:otherwise>
293
+ <bf:source>
294
+ <bf:Source>
295
+ <xsl:if test="$source='DLC'">
296
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,'dlc')"/></xsl:attribute>
297
+ </xsl:if>
298
+ <bf:code><xsl:value-of select="$source"/></bf:code>
299
+ </bf:Source>
300
+ </bf:source>
301
+ </xsl:otherwise>
302
+ </xsl:choose>
303
+ </xsl:if>
304
+ </xsl:element>
305
+ </bf:identifiedBy>
306
+ </xsl:otherwise>
307
+ </xsl:choose>
308
+ </xsl:when>
309
+ </xsl:choose>
310
+ </xsl:template>
311
+
312
+ <!-- create a bf:source property from a subfield $2 -->
313
+ <xsl:template match="marc:subfield" mode="subfield2">
314
+ <xsl:param name="serialization" select="'rdfxml'"/>
315
+ <xsl:param name="pVocabStem"/>
316
+ <xsl:param name="pStripPunct" select="false()"/>
317
+ <xsl:variable name="vCode">
318
+ <xsl:choose>
319
+ <xsl:when test="contains(., '%2F')"><xsl:value-of select="substring-before(., '%2F')" /></xsl:when>
320
+ <xsl:when test="not(parent::marc:datafield[@tag='082']) and contains(., '/')"><xsl:value-of select="substring-before(., '/')" /></xsl:when>
321
+ <xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
322
+ </xsl:choose>
323
+ </xsl:variable>
324
+ <xsl:variable name="vURI">
325
+ <xsl:if test="$pVocabStem != ''">
326
+ <xsl:variable name="vNormCode">
327
+ <xsl:call-template name="tNormalizeCode">
328
+ <xsl:with-param name="pCode" select="$vCode"/>
329
+ <xsl:with-param name="pStripPunct" select="$pStripPunct"/>
330
+ </xsl:call-template>
331
+ </xsl:variable>
332
+ <xsl:value-of select="concat($pVocabStem,$vNormCode)" />
333
+ </xsl:if>
334
+ </xsl:variable>
335
+ <xsl:choose>
336
+ <xsl:when test="$serialization='rdfxml'">
337
+ <xsl:choose>
338
+ <xsl:when test="contains($vURI, '/fast')">
339
+ <bf:source>
340
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$vURI"/></xsl:attribute>
341
+ </bf:source>
342
+ </xsl:when>
343
+ <xsl:otherwise>
344
+ <bf:source>
345
+ <bf:Source>
346
+ <xsl:if test="$vURI != ''">
347
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vURI"/></xsl:attribute>
348
+ </xsl:if>
349
+ <bf:code>
350
+ <xsl:value-of select="$vCode"/>
351
+ </bf:code>
352
+ </bf:Source>
353
+ </bf:source>
354
+ </xsl:otherwise>
355
+ </xsl:choose>
356
+ </xsl:when>
357
+ </xsl:choose>
358
+ </xsl:template>
359
+
360
+ <!--
361
+ create a bflc:appliesTo property from a subfield $3
362
+ -->
363
+ <xsl:template match="marc:subfield|marc:sf" mode="subfield3">
364
+ <xsl:param name="serialization" select="'rdfxml'"/>
365
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="parent::*" mode="xmllang"/></xsl:variable>
366
+ <xsl:choose>
367
+ <xsl:when test="$serialization='rdfxml'">
368
+ <bflc:appliesTo>
369
+ <bflc:AppliesTo>
370
+ <rdfs:label>
371
+ <xsl:if test="$vXmlLang != ''">
372
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
373
+ </xsl:if>
374
+ <xsl:call-template name="tChopPunct">
375
+ <xsl:with-param name="pString" select="."/>
376
+ </xsl:call-template>
377
+ </rdfs:label>
378
+ </bflc:AppliesTo>
379
+ </bflc:appliesTo>
380
+ </xsl:when>
381
+ </xsl:choose>
382
+ </xsl:template>
383
+
384
+ <!--
385
+ create a bf:role property from a subfield $4
386
+ -->
387
+ <xsl:template match="marc:subfield" mode="subfield4">
388
+ <xsl:param name="serialization" select="'rdfxml'"/>
389
+ <xsl:choose>
390
+ <xsl:when test="$serialization='rdfxml'">
391
+ <bf:role>
392
+ <bf:Role>
393
+ <xsl:choose>
394
+ <xsl:when test="contains(.,'://')">
395
+ <xsl:attribute name="rdf:about"><xsl:value-of select="."/></xsl:attribute>
396
+ </xsl:when>
397
+ <xsl:otherwise>
398
+ <rdfs:label><xsl:value-of select="."/></rdfs:label>
399
+ </xsl:otherwise>
400
+ </xsl:choose>
401
+ </bf:Role>
402
+ </bf:role>
403
+ </xsl:when>
404
+ </xsl:choose>
405
+ </xsl:template>
406
+
407
+ <!--
408
+ create a bflc:applicableInstitution property from a subfield $5
409
+ -->
410
+ <xsl:template match="marc:subfield" mode="subfield5">
411
+ <xsl:param name="serialization" select="'rdfxml'"/>
412
+ <xsl:variable name="vNormCode">
413
+ <xsl:call-template name="tNormalizeCode">
414
+ <xsl:with-param name="pCode" select="."/>
415
+ <xsl:with-param name="pStripPunct" select="true()"/>
416
+ </xsl:call-template>
417
+ </xsl:variable>
418
+ <xsl:choose>
419
+ <xsl:when test="$serialization='rdfxml'">
420
+ <bflc:applicableInstitution>
421
+ <bf:Agent>
422
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($organizations,$vNormCode)"/></xsl:attribute>
423
+ <bf:code><xsl:value-of select="."/></bf:code>
424
+ </bf:Agent>
425
+ </bflc:applicableInstitution>
426
+ </xsl:when>
427
+ </xsl:choose>
428
+ </xsl:template>
429
+
430
+ <!--
431
+ create rdf:type and bf:issuance properties from a subfield $7
432
+ -->
433
+ <xsl:template match="marc:subfield" mode="subfield7">
434
+ <xsl:param name="serialization" select="'rdfxml'"/>
435
+ <xsl:variable name="type">
436
+ <xsl:choose>
437
+ <xsl:when test="substring(.,1,1) = 'a'">Text</xsl:when>
438
+ <xsl:when test="substring(.,1,1) = 'c'">NotatedMusic</xsl:when>
439
+ <xsl:when test="substring(.,1,1) = 'd'">NotatedMusic</xsl:when>
440
+ <xsl:when test="substring(.,1,1) = 'e'">Cartography</xsl:when>
441
+ <xsl:when test="substring(.,1,1) = 'f'">Cartography</xsl:when>
442
+ <xsl:when test="substring(.,1,1) = 'g'">MovingImage</xsl:when>
443
+ <xsl:when test="substring(.,1,1) = 'i'">Audio</xsl:when>
444
+ <xsl:when test="substring(.,1,1) = 'j'">Audio</xsl:when>
445
+ <xsl:when test="substring(.,1,1) = 'k'">StillImage</xsl:when>
446
+ <xsl:when test="substring(.,1,1) = 'o'">MixedMaterial</xsl:when>
447
+ <xsl:when test="substring(.,1,1) = 'p'">MixedMaterial</xsl:when>
448
+ <xsl:when test="substring(.,1,1) = 'r'">Object</xsl:when>
449
+ <xsl:when test="substring(.,1,1) = 't'">Text</xsl:when>
450
+ </xsl:choose>
451
+ </xsl:variable>
452
+ <xsl:variable name="issuance">
453
+ <xsl:choose>
454
+ <xsl:when test="substring(.,2,1) = 'a'">m</xsl:when>
455
+ <xsl:when test="substring(.,2,1) = 'b'">s</xsl:when>
456
+ <xsl:when test="substring(.,2,1) = 'd'">d</xsl:when>
457
+ <xsl:when test="substring(.,2,1) = 'i'">i</xsl:when>
458
+ <xsl:when test="substring(.,2,1) = 'm'">m</xsl:when>
459
+ <xsl:when test="substring(.,2,1) = 's'">s</xsl:when>
460
+ </xsl:choose>
461
+ </xsl:variable>
462
+ <xsl:choose>
463
+ <xsl:when test="$serialization='rdfxml'">
464
+ <xsl:if test="$type != ''">
465
+ <rdf:type>
466
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$bf"/><xsl:value-of select="$type"/></xsl:attribute>
467
+ </rdf:type>
468
+ </xsl:if>
469
+ <xsl:if test="$issuance != ''">
470
+ <bf:issuance>
471
+ <bf:Issuance>
472
+ <bf:code><xsl:value-of select="$issuance"/></bf:code>
473
+ </bf:Issuance>
474
+ </bf:issuance>
475
+ </xsl:if>
476
+ </xsl:when>
477
+ </xsl:choose>
478
+ </xsl:template>
479
+
480
+ <!--
481
+ create an rdfs:label property with datatype xs:anyURI from a
482
+ subfield u
483
+ -->
484
+ <xsl:template match="marc:subfield" mode="subfieldu">
485
+ <xsl:param name="serialization" select="'rdfxml'"/>
486
+ <xsl:choose>
487
+ <xsl:when test="$serialization = 'rdfxml'">
488
+ <bf:electronicLocator>
489
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="."/></xsl:attribute>
490
+ </bf:electronicLocator>
491
+ </xsl:when>
492
+ </xsl:choose>
493
+ </xsl:template>
494
+
495
+ </xsl:stylesheet>