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,2245 @@
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
+ xmlns:exsl="http://exslt.org/common"
11
+ exclude-result-prefixes="xsl marc exsl">
12
+
13
+ <!-- Conversion specs for 3XX -->
14
+
15
+ <xsl:template match="marc:datafield[@tag='334' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='334')]" mode="instance">
16
+ <xsl:param name="serialization" select="'rdfxml'"/>
17
+ <xsl:apply-templates select="." mode="rdaResource">
18
+ <xsl:with-param name="serialization" select="$serialization"/>
19
+ <xsl:with-param name="pProp">bf:issuance</xsl:with-param>
20
+ <xsl:with-param name="pResource">bf:Issuance</xsl:with-param>
21
+ <xsl:with-param name="pUriStem"><xsl:value-of select="$issuance"/></xsl:with-param>
22
+ </xsl:apply-templates>
23
+ </xsl:template>
24
+
25
+ <xsl:template match="marc:datafield[@tag='336' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='336')]" mode="work">
26
+ <xsl:param name="serialization" select="'rdfxml'"/>
27
+ <xsl:apply-templates select="." mode="rdaResource">
28
+ <xsl:with-param name="serialization" select="$serialization"/>
29
+ <xsl:with-param name="pProp">bf:content</xsl:with-param>
30
+ <xsl:with-param name="pResource">bf:Content</xsl:with-param>
31
+ <xsl:with-param name="pUriStem"><xsl:value-of select="$contentType"/></xsl:with-param>
32
+ </xsl:apply-templates>
33
+ </xsl:template>
34
+
35
+ <xsl:template match="marc:datafield[@tag='340' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='340')]" mode="work">
36
+ <xsl:param name="serialization" select="'rdfxml'"/>
37
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
38
+ <xsl:for-each select="marc:subfield[@code='p']">
39
+ <xsl:variable name="vCurrentNode" select="generate-id(.)"/>
40
+ <xsl:variable name="vCurrentNodeUri">
41
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
42
+ <xsl:if test="position() = 1">
43
+ <xsl:choose>
44
+ <xsl:when test="starts-with(.,'(uri)')">
45
+ <xsl:value-of select="substring-after(.,'(uri)')"/>
46
+ </xsl:when>
47
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
48
+ </xsl:choose>
49
+ </xsl:if>
50
+ </xsl:for-each>
51
+ </xsl:variable>
52
+ <xsl:choose>
53
+ <xsl:when test="$serialization = 'rdfxml'">
54
+ <bf:illustrativeContent>
55
+ <bf:Illustration>
56
+ <xsl:if test="$vCurrentNodeUri != ''">
57
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vCurrentNodeUri"/></xsl:attribute>
58
+ </xsl:if>
59
+ <rdfs:label>
60
+ <xsl:if test="$vXmlLang != ''">
61
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
62
+ </xsl:if>
63
+ <xsl:call-template name="tChopPunct">
64
+ <xsl:with-param name="pString" select="."/>
65
+ </xsl:call-template>
66
+ </rdfs:label>
67
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
68
+ <xsl:if test="position() != 1">
69
+ <xsl:apply-templates select="." mode="subfield0orw">
70
+ <xsl:with-param name="serialization" select="$serialization"/>
71
+ </xsl:apply-templates>
72
+ </xsl:if>
73
+ </xsl:for-each>
74
+ <xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and not(contains(text(),'://'))]" mode="subfield0orw">
75
+ <xsl:with-param name="serialization" select="$serialization"/>
76
+ </xsl:apply-templates>
77
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
78
+ <xsl:with-param name="serialization" select="$serialization"/>
79
+ </xsl:apply-templates>
80
+ </bf:Illustration>
81
+ </bf:illustrativeContent>
82
+ </xsl:when>
83
+ </xsl:choose>
84
+ </xsl:for-each>
85
+ </xsl:template>
86
+
87
+ <xsl:template match="marc:datafield[@tag='341' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='341')]" mode="work">
88
+ <xsl:param name="serialization" select="'rdfxml'"/>
89
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
90
+ <xsl:for-each select="marc:subfield[@code='a']">
91
+ <xsl:choose>
92
+ <xsl:when test="$serialization = 'rdfxml'">
93
+ <bf:contentAccessibility>
94
+ <bf:ContentAccessibility>
95
+ <rdfs:label>
96
+ <xsl:if test="$vXmlLang != ''">
97
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
98
+ </xsl:if>
99
+ <xsl:text>Content access mode: </xsl:text>
100
+ <xsl:call-template name="tChopPunct">
101
+ <xsl:with-param name="pString" select="."/>
102
+ </xsl:call-template>
103
+ </rdfs:label>
104
+ <xsl:for-each select="../marc:subfield[@code='b']">
105
+ <rdfs:label>
106
+ <xsl:if test="$vXmlLang != ''">
107
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
108
+ </xsl:if>
109
+ <xsl:text>Textual assistive features: </xsl:text>
110
+ <xsl:call-template name="tChopPunct">
111
+ <xsl:with-param name="pString" select="."/>
112
+ </xsl:call-template>
113
+ </rdfs:label>
114
+ </xsl:for-each>
115
+ <xsl:for-each select="../marc:subfield[@code='c']">
116
+ <rdfs:label>
117
+ <xsl:if test="$vXmlLang != ''">
118
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
119
+ </xsl:if>
120
+ <xsl:text>Visual assistive features: </xsl:text>
121
+ <xsl:call-template name="tChopPunct">
122
+ <xsl:with-param name="pString" select="."/>
123
+ </xsl:call-template>
124
+ </rdfs:label>
125
+ </xsl:for-each>
126
+ <xsl:for-each select="../marc:subfield[@code='d']">
127
+ <rdfs:label>
128
+ <xsl:if test="$vXmlLang != ''">
129
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
130
+ </xsl:if>
131
+ <xsl:text>Auditory assistive features: </xsl:text>
132
+ <xsl:call-template name="tChopPunct">
133
+ <xsl:with-param name="pString" select="."/>
134
+ </xsl:call-template>
135
+ </rdfs:label>
136
+ </xsl:for-each>
137
+ <xsl:for-each select="../marc:subfield[@code='e']">
138
+ <rdfs:label>
139
+ <xsl:if test="$vXmlLang != ''">
140
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
141
+ </xsl:if>
142
+ <xsl:text>Tactile assistive features: </xsl:text>
143
+ <xsl:call-template name="tChopPunct">
144
+ <xsl:with-param name="pString" select="."/>
145
+ </xsl:call-template>
146
+ </rdfs:label>
147
+ </xsl:for-each>
148
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
149
+ <xsl:with-param name="serialization" select="$serialization"/>
150
+ </xsl:apply-templates>
151
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
152
+ <xsl:with-param name="serialization" select="$serialization"/>
153
+ </xsl:apply-templates>
154
+ </bf:ContentAccessibility>
155
+ </bf:contentAccessibility>
156
+ </xsl:when>
157
+ </xsl:choose>
158
+ </xsl:for-each>
159
+ </xsl:template>
160
+
161
+ <!-- <xsl:template match="marc:datafield[@tag='348' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='348')]" mode="work">
162
+ <xsl:param name="serialization" select="'rdfxml'"/>
163
+ <xsl:apply-templates select="marc:subfield[@code='c']" mode="generateProperty">
164
+ <xsl:with-param name="serialization" select="$serialization"/>
165
+ <xsl:with-param name="pProp">bf:notation</xsl:with-param>
166
+ <xsl:with-param name="pResource">bf:MusicNotation</xsl:with-param>
167
+ </xsl:apply-templates>
168
+ </xsl:template>-->
169
+
170
+ <xsl:template match="marc:datafield[@tag='348' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='348')]"
171
+ mode="work">
172
+ <xsl:param name="serialization" select="'rdfxml'"/>
173
+ <xsl:variable name="vTag">
174
+ <xsl:choose>
175
+ <xsl:when test="@tag='880'"><xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/></xsl:when>
176
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
177
+ </xsl:choose>
178
+ </xsl:variable>
179
+ <xsl:for-each select="marc:subfield">
180
+ <xsl:variable name="vProp">
181
+ <xsl:choose>
182
+ <xsl:when test="$vTag='348'">
183
+ <xsl:choose>
184
+ <xsl:when test="@code='c'">bf:notation</xsl:when>
185
+ <xsl:otherwise>bf:musicFormat</xsl:otherwise>
186
+ </xsl:choose>
187
+ </xsl:when>
188
+ </xsl:choose>
189
+ </xsl:variable>
190
+ <xsl:variable name="vResource">
191
+ <xsl:choose>
192
+ <xsl:when test="$vTag='348'">
193
+ <xsl:if test="@code='a'">bf:MusicFormat</xsl:if>
194
+ <xsl:if test="@code='c'">bf:MusicNotation</xsl:if>
195
+ </xsl:when>
196
+ </xsl:choose>
197
+ </xsl:variable>
198
+ <xsl:variable name="vTarget">
199
+ <xsl:choose>
200
+ <xsl:when test="$vTag='348'">
201
+ <xsl:if test="@code='a'">
202
+ <xsl:choose>
203
+ <xsl:when test="text()='choir book'">
204
+ <xsl:value-of select="concat($mmusicformat,'choirbk')"/>
205
+ </xsl:when>
206
+ <xsl:when test="text()='chorus score'">
207
+ <xsl:value-of select="concat($mmusicformat,'chscore')"/>
208
+ </xsl:when>
209
+ <xsl:when test="text()='condensed score'">
210
+ <xsl:value-of select="concat($mmusicformat,'conscore')"/>
211
+ </xsl:when>
212
+ <xsl:when test="text()='part'">
213
+ <xsl:value-of select="concat($mmusicformat,'part')"/>
214
+ </xsl:when>
215
+ <xsl:when test="text()='piano conductor part'">
216
+ <xsl:value-of select="concat($mmusicformat,'pianoconpt')"/>
217
+ </xsl:when>
218
+ <xsl:when test="text()='piano score'">
219
+ <xsl:value-of select="concat($mmusicformat,'pianoscore')"/>
220
+ </xsl:when>
221
+ <xsl:when test="text()='score'">
222
+ <xsl:value-of select="concat($mmusicformat,'score')"/>
223
+ </xsl:when>
224
+ <xsl:when test="text()='study score'">
225
+ <xsl:value-of select="concat($mmusicformat,'study score')"/>
226
+ </xsl:when>
227
+ <xsl:when test="text()='table book'">
228
+ <xsl:value-of select="concat($mmusicformat,'tablebk')"/>
229
+ </xsl:when>
230
+ <xsl:when test="text()='violin conductor part'">
231
+ <xsl:value-of select="concat($mmusicformat,'violconpart')"/>
232
+ </xsl:when>
233
+ <xsl:when test="text()='vocal score'">
234
+ <xsl:value-of select="concat($mmusicformat,'vocalscore')"/>
235
+ </xsl:when>
236
+ </xsl:choose>
237
+ </xsl:if>
238
+ </xsl:when>
239
+ </xsl:choose>
240
+ </xsl:variable>
241
+ <xsl:variable name="vLabel"><xsl:value-of select="."/>
242
+ </xsl:variable>
243
+ <xsl:variable name="vObjStringProp">rdfs:label</xsl:variable>
244
+ <!-- We need to eliminate duplicates. The second condition looks for a preceding tag with the same value. -->
245
+ <xsl:if test="$vResource != '' and count(../preceding-sibling::marc:datafield[@tag = $vTag and marc:subfield[. = $vLabel]]) = 0">
246
+ <xsl:apply-templates select="." mode="generateProperty">
247
+ <xsl:with-param name="serialization" select="$serialization"/>
248
+ <xsl:with-param name="pProp" select="$vProp"/>
249
+ <xsl:with-param name="pResource" select="$vResource"/>
250
+ <xsl:with-param name="pTarget" select="$vTarget"/>
251
+ <xsl:with-param name="pLabel" select="$vLabel"/>
252
+ <xsl:with-param name="pObjStringProp" select="$vObjStringProp"/>
253
+ </xsl:apply-templates>
254
+ </xsl:if>
255
+ </xsl:for-each>
256
+ </xsl:template>
257
+
258
+ <xsl:template match="marc:datafield[@tag='351' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='351')]" mode="work">
259
+ <xsl:param name="serialization" select="'rdfxml'"/>
260
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
261
+ <xsl:choose>
262
+ <xsl:when test="$serialization = 'rdfxml'">
263
+ <bf:collectionArrangement>
264
+ <bf:CollectionArrangement>
265
+ <xsl:apply-templates select="marc:subfield[@code='3']" mode="subfield3">
266
+ <xsl:with-param name="serialization" select="$serialization"/>
267
+ </xsl:apply-templates>
268
+ <xsl:for-each select="marc:subfield[@code='c']">
269
+ <bf:hierarchicalLevel>
270
+ <xsl:if test="$vXmlLang != ''">
271
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
272
+ </xsl:if>
273
+ <xsl:call-template name="tChopPunct">
274
+ <xsl:with-param name="pString"><xsl:value-of select="."/></xsl:with-param>
275
+ </xsl:call-template>
276
+ </bf:hierarchicalLevel>
277
+ </xsl:for-each>
278
+ <xsl:for-each select="marc:subfield[@code='a']">
279
+ <bf:collectionOrganization>
280
+ <xsl:if test="$vXmlLang != ''">
281
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
282
+ </xsl:if>
283
+ <xsl:call-template name="tChopPunct">
284
+ <xsl:with-param name="pString"><xsl:value-of select="."/></xsl:with-param>
285
+ </xsl:call-template>
286
+ </bf:collectionOrganization>
287
+ </xsl:for-each>
288
+ <xsl:for-each select="marc:subfield[@code='b']">
289
+ <bf:pattern>
290
+ <xsl:if test="$vXmlLang != ''">
291
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
292
+ </xsl:if>
293
+ <xsl:call-template name="tChopPunct">
294
+ <xsl:with-param name="pString"><xsl:value-of select="."/></xsl:with-param>
295
+ </xsl:call-template>
296
+ </bf:pattern>
297
+ </xsl:for-each>
298
+ </bf:CollectionArrangement>
299
+ </bf:collectionArrangement>
300
+ </xsl:when>
301
+ </xsl:choose>
302
+ </xsl:template>
303
+
304
+ <xsl:template match="marc:datafield[@tag='353' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='353')]" mode="work">
305
+ <xsl:param name="serialization" select="'rdfxml'"/>
306
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
307
+ <xsl:variable name="vUri">
308
+ <xsl:if test="marc:subfield[@code='b']">
309
+ <xsl:value-of select="concat($msupplcont,marc:subfield[@code='b'][1])"/>
310
+ </xsl:if>
311
+ </xsl:variable>
312
+ <xsl:choose>
313
+ <xsl:when test="$serialization='rdfxml'">
314
+ <bf:supplementaryContent>
315
+ <bf:SupplementaryContent>
316
+ <xsl:if test="$vUri != ''">
317
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vUri"/></xsl:attribute>
318
+ </xsl:if>
319
+ <xsl:for-each select="marc:subfield[@code='a']">
320
+ <rdfs:label>
321
+ <xsl:if test="$vXmlLang != ''">
322
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
323
+ </xsl:if>
324
+ <xsl:call-template name="tChopPunct">
325
+ <xsl:with-param name="pString" select="."/>
326
+ </xsl:call-template>
327
+ </rdfs:label>
328
+ </xsl:for-each>
329
+ <xsl:if test="$vUri = ''">
330
+ <xsl:for-each select="marc:subfield[@code='b'][position() &gt; 1]">
331
+ <!-- process like $0 -->
332
+ <bf:identifiedBy>
333
+ <bf:Identifier>
334
+ <rdf:value>
335
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="concat($msupplcont,.)"/></xsl:attribute>
336
+ </rdf:value>
337
+ </bf:Identifier>
338
+ </bf:identifiedBy>
339
+ </xsl:for-each>
340
+ <xsl:apply-templates select="marc:subfield[@code='0']" mode="subfield0orw">
341
+ <xsl:with-param name="serialization" select="$serialization"/>
342
+ </xsl:apply-templates>
343
+ <xsl:apply-templates select="marc:subfield[@code='2']" mode="subfield2">
344
+ <xsl:with-param name="serialization" select="$serialization"/>
345
+ </xsl:apply-templates>
346
+ </xsl:if>
347
+ <!--
348
+ <xsl:apply-templates select="marc:subfield[@code='3']" mode="subfield3">
349
+ <xsl:with-param name="serialization" select="$serialization"/>
350
+ </xsl:apply-templates>
351
+ -->
352
+ </bf:SupplementaryContent>
353
+ </bf:supplementaryContent>
354
+ </xsl:when>
355
+ </xsl:choose>
356
+ </xsl:template>
357
+
358
+ <xsl:template match="marc:datafield[@tag='370' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='370')]" mode="work">
359
+ <xsl:param name="serialization" select="'rdfxml'"/>
360
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
361
+ <xsl:for-each select="marc:subfield[@code='c' or @code='g']">
362
+ <xsl:variable name="vCurrentNode" select="generate-id(.)"/>
363
+ <xsl:variable name="vCurrentNodeUri">
364
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
365
+ <xsl:if test="position() = 1">
366
+ <xsl:choose>
367
+ <xsl:when test="starts-with(.,'(uri)')">
368
+ <xsl:value-of select="substring-after(.,'(uri)')"/>
369
+ </xsl:when>
370
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
371
+ </xsl:choose>
372
+ </xsl:if>
373
+ </xsl:for-each>
374
+ </xsl:variable>
375
+ <xsl:choose>
376
+ <xsl:when test="$serialization = 'rdfxml'">
377
+ <bf:originPlace>
378
+ <bf:Place>
379
+ <xsl:if test="$vCurrentNodeUri != ''">
380
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vCurrentNodeUri"/></xsl:attribute>
381
+ </xsl:if>
382
+ <rdfs:label>
383
+ <xsl:if test="$vXmlLang != ''">
384
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
385
+ </xsl:if>
386
+ <xsl:call-template name="tChopPunct">
387
+ <xsl:with-param name="pString" select="."/>
388
+ </xsl:call-template>
389
+ </rdfs:label>
390
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
391
+ <xsl:if test="position() != 1">
392
+ <xsl:apply-templates select="." mode="subfield0orw">
393
+ <xsl:with-param name="serialization" select="$serialization"/>
394
+ </xsl:apply-templates>
395
+ </xsl:if>
396
+ </xsl:for-each>
397
+ <xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[(@code != '0') and (@code != '2')][1])=$vCurrentNode and not(contains(text(),'://'))]" mode="subfield0orw">
398
+ <xsl:with-param name="serialization" select="$serialization"/>
399
+ </xsl:apply-templates>
400
+ <xsl:for-each select="following-sibling::marc:subfield[@code='2' and generate-id(preceding-sibling::marc:subfield[(@code != '0') and (@code != '1')][1])=$vCurrentNode]">
401
+ <bf:source>
402
+ <bf:Source>
403
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($subjectSchemes,.)"/></xsl:attribute>
404
+ </bf:Source>
405
+ </bf:source>
406
+ </xsl:for-each>
407
+ </bf:Place>
408
+ </bf:originPlace>
409
+ </xsl:when>
410
+ </xsl:choose>
411
+ </xsl:for-each>
412
+ </xsl:template>
413
+
414
+ <xsl:template match="marc:datafield[@tag='377' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='377')]" mode="work">
415
+ <xsl:param name="serialization" select="'rdfxml'"/>
416
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
417
+ <xsl:for-each select="marc:subfield[@code='a' or @code='l']">
418
+ <xsl:variable name="vCurrentNode" select="generate-id(.)"/>
419
+ <xsl:choose>
420
+ <xsl:when test="$serialization = 'rdfxml'">
421
+ <bf:language>
422
+ <bf:Language>
423
+ <xsl:choose>
424
+ <xsl:when test="@code='a'">
425
+ <xsl:choose>
426
+ <xsl:when test="../@ind2=' '">
427
+ <xsl:attribute name="rdf:about">
428
+ <xsl:value-of select="concat($languages,.)"/>
429
+ </xsl:attribute>
430
+ <xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode]" mode="subfield0orw">
431
+ <xsl:with-param name="serialization" select="$serialization"/>
432
+ </xsl:apply-templates>
433
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
434
+ <xsl:with-param name="serialization" select="$serialization"/>
435
+ </xsl:apply-templates>
436
+ </xsl:when>
437
+ <xsl:otherwise>
438
+ <rdf:value><xsl:value-of select="."/></rdf:value>
439
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
440
+ <xsl:with-param name="serialization" select="$serialization"/>
441
+ </xsl:apply-templates>
442
+ </xsl:otherwise>
443
+ </xsl:choose>
444
+ </xsl:when>
445
+ <xsl:when test="@code='l'">
446
+ <xsl:variable name="vCurrentNodeUri">
447
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
448
+ <xsl:if test="position() = 1">
449
+ <xsl:choose>
450
+ <xsl:when test="starts-with(.,'(uri)')">
451
+ <xsl:value-of select="substring-after(.,'(uri)')"/>
452
+ </xsl:when>
453
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
454
+ </xsl:choose>
455
+ </xsl:if>
456
+ </xsl:for-each>
457
+ </xsl:variable>
458
+ <xsl:if test="$vCurrentNodeUri != ''">
459
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vCurrentNodeUri"/></xsl:attribute>
460
+ </xsl:if>
461
+ <rdfs:label>
462
+ <xsl:if test="$vXmlLang != ''">
463
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
464
+ </xsl:if>
465
+ <xsl:call-template name="tChopPunct">
466
+ <xsl:with-param name="pString" select="."/>
467
+ </xsl:call-template>
468
+ </rdfs:label>
469
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
470
+ <xsl:if test="position() != 1">
471
+ <xsl:apply-templates select="." mode="subfield0orw">
472
+ <xsl:with-param name="serialization" select="$serialization"/>
473
+ </xsl:apply-templates>
474
+ </xsl:if>
475
+ </xsl:for-each>
476
+ <xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and not(contains(text(),'://'))]" mode="subfield0orw">
477
+ <xsl:with-param name="serialization" select="$serialization"/>
478
+ </xsl:apply-templates>
479
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
480
+ <xsl:with-param name="serialization" select="$serialization"/>
481
+ </xsl:apply-templates>
482
+ </xsl:when>
483
+ </xsl:choose>
484
+ </bf:Language>
485
+ </bf:language>
486
+ </xsl:when>
487
+ </xsl:choose>
488
+ </xsl:for-each>
489
+ </xsl:template>
490
+
491
+ <xsl:template match="marc:datafield[@tag='380' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='380')]" mode="work">
492
+ <xsl:param name="serialization" select="'rdfxml'"/>
493
+ <xsl:apply-templates select="marc:subfield[@code='a']" mode="generateProperty">
494
+ <xsl:with-param name="serialization" select="$serialization"/>
495
+ <xsl:with-param name="pProp">bf:genreForm</xsl:with-param>
496
+ <xsl:with-param name="pResource">bf:GenreForm</xsl:with-param>
497
+ <xsl:with-param name="pVocabStem" select="$genreFormSchemes"/>
498
+ </xsl:apply-templates>
499
+ </xsl:template>
500
+
501
+ <xsl:template match="marc:datafield[@tag='382' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='382')]" mode="work">
502
+ <xsl:param name="serialization" select="'rdfxml'"/>
503
+
504
+ <xsl:variable name="vSource">
505
+ <xsl:if test="marc:subfield[@code = '2']">
506
+ <xsl:choose>
507
+ <xsl:when test="marc:subfield[@code = '2'] = 'lcmpt'">
508
+ <bf:source>
509
+ <bf:Source>
510
+ <xsl:attribute name="rdf:about">http://id.loc.gov/authorities/performanceMediums</xsl:attribute>
511
+ <bf:code>lcmpt</bf:code>
512
+ </bf:Source>
513
+ </bf:source>
514
+ </xsl:when>
515
+ <xsl:otherwise>
516
+ <xsl:apply-templates select="marc:subfield[@code='2']" mode="subfield2">
517
+ <xsl:with-param name="serialization" select="$serialization"/>
518
+ </xsl:apply-templates>
519
+ </xsl:otherwise>
520
+ </xsl:choose>
521
+ </xsl:if>
522
+ </xsl:variable>
523
+
524
+ <xsl:variable name="vStatus">
525
+ <xsl:if test="@ind1='1'">
526
+ <bf:status>
527
+ <bf:Status rdf:about="http://id.loc.gov/vocabulary/mstatus/part">
528
+ <rdfs:label>partial</rdfs:label>
529
+ </bf:Status>
530
+ </bf:status>
531
+ </xsl:if>
532
+ </xsl:variable>
533
+
534
+ <xsl:variable name="group382sfs-prenodeset">
535
+ <xsl:call-template name="group382sfs">
536
+ <xsl:with-param name="df" select="."/>
537
+ <xsl:with-param name="gpos" select="1"/>
538
+ <xsl:with-param name="pos" select="1"/>
539
+ </xsl:call-template>
540
+ </xsl:variable>
541
+ <xsl:variable name="vGroup382sfs" select="exsl:node-set($group382sfs-prenodeset)"/>
542
+
543
+ <!-- Find the group numbers. -->
544
+ <xsl:variable name="groups-prenodeset">
545
+ <xsl:for-each select="$vGroup382sfs/marc:sf">
546
+ <xsl:variable name="g" select="@gpos"/>
547
+ <xsl:choose>
548
+ <xsl:when test="count(preceding-sibling::marc:sf) = 0">
549
+ <group>
550
+ <xsl:value-of select="$g"/>
551
+ </group>
552
+ </xsl:when>
553
+ <xsl:when test="preceding-sibling::marc:sf[1][@gpos != $g]">
554
+ <group>
555
+ <xsl:value-of select="$g"/>
556
+ </group>
557
+ </xsl:when>
558
+ </xsl:choose>
559
+ </xsl:for-each>
560
+ </xsl:variable>
561
+ <xsl:variable name="groups" select="exsl:node-set($groups-prenodeset)" />
562
+
563
+ <xsl:choose>
564
+ <xsl:when test="$serialization = 'rdfxml'">
565
+
566
+ <bf:ensemble>
567
+ <bf:Ensemble>
568
+ <xsl:apply-templates select="marc:subfield[@code='3']" mode="subfield3">
569
+ <xsl:with-param name="serialization" select="$serialization"/>
570
+ </xsl:apply-templates>
571
+ <xsl:for-each select="$groups/group">
572
+ <xsl:variable name="g" select="."/>
573
+ <bf:mediumComponent>
574
+ <bf:MediumComponent>
575
+ <xsl:for-each select="$vGroup382sfs/marc:sf[@gpos = $g]">
576
+ <xsl:choose>
577
+ <xsl:when test="@code = 'a' or @code = 'b'">
578
+ <bf:mediumOfPerformance>
579
+ <bf:MediumOfPerformance>
580
+ <rdfs:label>
581
+ <xsl:value-of select="." />
582
+ </rdfs:label>
583
+ <xsl:copy-of select="$vSource" />
584
+ </bf:MediumOfPerformance>
585
+ </bf:mediumOfPerformance>
586
+ <xsl:if test="@code = 'b'">
587
+ <bf:mediumComponentQualifier>
588
+ <bf:MediumComponentQualifier rdf:about="http://id.loc.gov/vocabulary/medcompqual/solo">
589
+ <rdfs:label>solo</rdfs:label>
590
+ </bf:MediumComponentQualifier>
591
+ </bf:mediumComponentQualifier>
592
+ </xsl:if>
593
+ </xsl:when>
594
+ <xsl:when test="@code = 'p'">
595
+ <bf:note>
596
+ <bf:Note>
597
+ <rdf:type rdf:resource="http://id.loc.gov/vocabulary/mnotetype/alternative" />
598
+ <rdfs:label>
599
+ <xsl:value-of select="." />
600
+ </rdfs:label>
601
+ </bf:Note>
602
+ </bf:note>
603
+ </xsl:when>
604
+ <xsl:when test="@code = 'd' or @code = 'v'">
605
+ <bf:note>
606
+ <bf:Note>
607
+ <xsl:if test="@code = 'd'">
608
+ <rdf:type rdf:resource="http://id.loc.gov/vocabulary/mnotetype/doubling" />
609
+ </xsl:if>
610
+ <rdfs:label>
611
+ <xsl:value-of select="." />
612
+ </rdfs:label>
613
+ </bf:Note>
614
+ </bf:note>
615
+ </xsl:when>
616
+ <xsl:when test="(@code = 'e' or @code = 'n') and not(preceding-sibling::marc:sf[@gpos = $g and (@code = 'e' or @code = 'n')])">
617
+ <bf:count><xsl:value-of select="." /></bf:count>
618
+ </xsl:when>
619
+ </xsl:choose>
620
+ </xsl:for-each>
621
+ </bf:MediumComponent>
622
+ </bf:mediumComponent>
623
+ </xsl:for-each>
624
+
625
+ <xsl:copy-of select="$vStatus" />
626
+
627
+ <xsl:choose>
628
+ <xsl:when test="marc:subfield[@code = 't']">
629
+ <bf:ensembleSize>
630
+ <bf:EnsembleSize rdf:about="http://id.loc.gov/vocabulary/ensemblesize/ensemble">
631
+ <rdfs:label>large ensemble</rdfs:label>
632
+ </bf:EnsembleSize>
633
+ </bf:ensembleSize>
634
+ </xsl:when>
635
+ <xsl:when test="number(marc:subfield[@code = 's']) &gt;= 10">
636
+ <bf:ensembleSize>
637
+ <bf:EnsembleSize rdf:about="http://id.loc.gov/vocabulary/ensemblesize/ensemble">
638
+ <rdfs:label>large ensemble</rdfs:label>
639
+ </bf:EnsembleSize>
640
+ </bf:ensembleSize>
641
+ </xsl:when>
642
+ <xsl:when test="marc:subfield[@code = 's']">
643
+ <xsl:variable name="vElName" select="concat('_', marc:subfield[@code = 's'])"/>
644
+ <xsl:if test="$codeMaps/maps/ensembleSizes/*[name() = $vElName]">
645
+ <bf:ensembleSize>
646
+ <bf:EnsembleSize>
647
+ <xsl:attribute name="rdf:about">
648
+ <xsl:value-of select="$codeMaps/maps/ensembleSizes/*[name() = $vElName]/@href" />
649
+ </xsl:attribute>
650
+ <rdfs:label>
651
+ <xsl:value-of select="$codeMaps/maps/ensembleSizes/*[name() = $vElName]" />
652
+ </rdfs:label>
653
+ </bf:EnsembleSize>
654
+ </bf:ensembleSize>
655
+ </xsl:if>
656
+ </xsl:when>
657
+ </xsl:choose>
658
+ </bf:Ensemble>
659
+ </bf:ensemble>
660
+
661
+ </xsl:when>
662
+ </xsl:choose>
663
+ </xsl:template>
664
+
665
+ <xsl:template name="group382sfs">
666
+ <xsl:param name="df"/>
667
+ <xsl:param name="pos"/>
668
+ <xsl:param name="gpos"/>
669
+
670
+ <xsl:variable name="sf" select="$df/marc:subfield[$pos]"/>
671
+
672
+ <marc:sf>
673
+ <xsl:copy-of select="$sf/@*"/>
674
+ <xsl:attribute name="gpos">
675
+ <xsl:value-of select="$gpos"/>
676
+ </xsl:attribute>
677
+ <xsl:attribute name="pos">
678
+ <xsl:value-of select="$pos"/>
679
+ </xsl:attribute>
680
+ <xsl:copy-of select="$sf/text()"/>
681
+ </marc:sf>
682
+
683
+ <xsl:variable name="next_gpos" select="$gpos + 1"/>
684
+ <xsl:variable name="next_pos" select="$pos + 1"/>
685
+
686
+ <xsl:choose>
687
+ <xsl:when
688
+ test="$df/marc:subfield[$next_pos][@code = 'p' or @code = 'd' or @code = 'e' or @code = 'n' or @code = 'v']">
689
+ <xsl:call-template name="group382sfs">
690
+ <xsl:with-param name="df" select="$df"/>
691
+ <xsl:with-param name="gpos" select="$gpos"/>
692
+ <xsl:with-param name="pos" select="$next_pos"/>
693
+ </xsl:call-template>
694
+ </xsl:when>
695
+ <xsl:when
696
+ test="$sf/@code = '3' and $df/marc:subfield[$next_pos][@code = 'a' or @code = 'b']">
697
+ <xsl:call-template name="group382sfs">
698
+ <xsl:with-param name="df" select="$df"/>
699
+ <xsl:with-param name="gpos" select="$gpos"/>
700
+ <xsl:with-param name="pos" select="$next_pos"/>
701
+ </xsl:call-template>
702
+ </xsl:when>
703
+ <xsl:when
704
+ test="$df/marc:subfield[$next_pos][@code = 'a' or @code = 'b']">
705
+ <xsl:call-template name="group382sfs">
706
+ <xsl:with-param name="df" select="$df"/>
707
+ <xsl:with-param name="gpos" select="$next_gpos"/>
708
+ <xsl:with-param name="pos" select="$next_pos"/>
709
+ </xsl:call-template>
710
+ </xsl:when>
711
+ </xsl:choose>
712
+ </xsl:template>
713
+
714
+ <xsl:template match="marc:datafield[@tag='383' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='383')]" mode="work">
715
+ <xsl:param name="serialization" select="'rdfxml'"/>
716
+ <xsl:choose>
717
+ <xsl:when test="$serialization = 'rdfxml'">
718
+ <xsl:choose>
719
+ <xsl:when test="count(marc:subfield[@code='a']) = '1' and marc:subfield[@code='a'] and marc:subfield[@code='b']">
720
+ <bf:identifiedBy>
721
+ <bf:OpusNumber>
722
+ <rdf:value><xsl:value-of select="concat(marc:subfield[@code='b'], ', ', marc:subfield[@code='a'])"/></rdf:value>
723
+ <xsl:if test="marc:subfield[@code = 'e']">
724
+ <bf:source>
725
+ <bf:Source>
726
+ <bf:code>
727
+ <xsl:value-of select="marc:subfield[@code = 'e'][1]"/>
728
+ </bf:code>
729
+ </bf:Source>
730
+ </bf:source>
731
+ </xsl:if>
732
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
733
+ <xsl:with-param name="serialization" select="$serialization"/>
734
+ </xsl:apply-templates>
735
+ </bf:OpusNumber>
736
+ </bf:identifiedBy>
737
+ </xsl:when>
738
+ <xsl:when test="count(marc:subfield[@code='a']) = '1' and marc:subfield[@code='a'] and not(marc:subfield[@code='b'])">
739
+ <bf:identifiedBy>
740
+ <bf:SerialNumber>
741
+ <rdf:value><xsl:value-of select="marc:subfield[@code='a']"/></rdf:value>
742
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
743
+ <xsl:with-param name="serialization" select="$serialization"/>
744
+ </xsl:apply-templates>
745
+ </bf:SerialNumber>
746
+ </bf:identifiedBy>
747
+ </xsl:when>
748
+ <xsl:otherwise>
749
+ <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
750
+ <bf:identifiedBy>
751
+ <xsl:variable name="vElName">
752
+ <xsl:choose>
753
+ <xsl:when test="@code = 'a'">bf:SerialNumber</xsl:when>
754
+ <xsl:when test="@code = 'b'">bf:OpusNumber</xsl:when>
755
+ <xsl:when test="@code = 'c'">bf:ThematicCatalogNumber</xsl:when>
756
+ </xsl:choose>
757
+ </xsl:variable>
758
+ <xsl:element name="{$vElName}">
759
+ <rdf:value><xsl:value-of select="."/></rdf:value>
760
+ <xsl:if test="../marc:subfield[@code = 'e' or @code = 'd']">
761
+ <bf:source>
762
+ <bf:Source>
763
+ <bf:code>
764
+ <xsl:value-of select="../marc:subfield[@code = 'e' or @code = 'd'][1]"/>
765
+ </bf:code>
766
+ </bf:Source>
767
+ </bf:source>
768
+ </xsl:if>
769
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
770
+ <xsl:with-param name="serialization" select="$serialization"/>
771
+ </xsl:apply-templates>
772
+ </xsl:element>
773
+ </bf:identifiedBy>
774
+ </xsl:for-each>
775
+ </xsl:otherwise>
776
+ </xsl:choose>
777
+ </xsl:when>
778
+ </xsl:choose>
779
+ </xsl:template>
780
+
781
+ <xsl:template match="marc:datafield[@tag='384' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='384')]" mode="work">
782
+ <xsl:param name="serialization" select="'rdfxml'"/>
783
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
784
+ <xsl:for-each select="marc:subfield[@code='a']">
785
+ <xsl:choose>
786
+ <xsl:when test="$serialization = 'rdfxml'">
787
+ <bf:keyMode>
788
+ <bf:KeyMode>
789
+ <rdfs:label>
790
+ <xsl:if test="$vXmlLang != ''">
791
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
792
+ </xsl:if>
793
+ <xsl:call-template name="tChopPunct">
794
+ <xsl:with-param name="pString" select="."/>
795
+ </xsl:call-template>
796
+ </rdfs:label>
797
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
798
+ <xsl:with-param name="serialization" select="$serialization"/>
799
+ </xsl:apply-templates>
800
+ </bf:KeyMode>
801
+ </bf:keyMode>
802
+ </xsl:when>
803
+ </xsl:choose>
804
+ </xsl:for-each>
805
+ </xsl:template>
806
+
807
+ <xsl:template match="marc:datafield[@tag='385' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='385')] |
808
+ marc:datafield[@tag='386' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='386')]"
809
+ mode="work">
810
+ <xsl:param name="serialization" select="'rdfxml'"/>
811
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
812
+ <xsl:variable name="vTag">
813
+ <xsl:choose>
814
+ <xsl:when test="@tag='880'"><xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/></xsl:when>
815
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
816
+ </xsl:choose>
817
+ </xsl:variable>
818
+ <xsl:variable name="vProp">
819
+ <xsl:choose>
820
+ <xsl:when test="$vTag='385'">bf:intendedAudience</xsl:when>
821
+ <xsl:when test="$vTag='386'">bflc:creatorCharacteristic</xsl:when>
822
+ </xsl:choose>
823
+ </xsl:variable>
824
+ <xsl:variable name="vResource">
825
+ <xsl:choose>
826
+ <xsl:when test="$vTag='385'">bf:IntendedAudience</xsl:when>
827
+ <xsl:when test="$vTag='386'">bflc:CreatorCharacteristic</xsl:when>
828
+ </xsl:choose>
829
+ </xsl:variable>
830
+ <xsl:choose>
831
+ <xsl:when test="$serialization = 'rdfxml'">
832
+ <xsl:variable name="vDGURI">
833
+ <xsl:choose>
834
+ <xsl:when test="contains(marc:subfield[@code='0'], 'id.loc.gov') and starts-with(marc:subfield[@code='0'], 'http')">
835
+ <xsl:apply-templates mode="generateUriFrom0" select=".">
836
+ <xsl:with-param name="pDefaultUri" select="''"/>
837
+ </xsl:apply-templates>
838
+ </xsl:when>
839
+ <xsl:when test="starts-with(substring-after(marc:subfield[@code='0'][1],')'),'dg')">
840
+ <xsl:variable name="encoded">
841
+ <xsl:call-template name="url-encode">
842
+ <xsl:with-param name="str" select="normalize-space(substring-after(marc:subfield[@code='0'][1],')'))"/>
843
+ </xsl:call-template>
844
+ </xsl:variable>
845
+ <xsl:value-of select="concat($demographicTerms,$encoded)"/>
846
+ </xsl:when>
847
+ <xsl:when test="starts-with(substring-after(marc:subfield[@code='0'][1],')'),'sh')">
848
+ <xsl:variable name="encoded">
849
+ <xsl:value-of select="translate(substring-after(marc:subfield[@code='0'][1],')'), ' ', '')"/>
850
+ </xsl:variable>
851
+ <xsl:value-of select="concat('http://id.loc.gov/authorities/subjects/',$encoded)"/>
852
+ </xsl:when>
853
+ </xsl:choose>
854
+ </xsl:variable>
855
+ <xsl:for-each select="marc:subfield[@code='a']">
856
+ <xsl:element name="{$vProp}">
857
+ <xsl:element name="{$vResource}">
858
+ <xsl:if test="$vDGURI != ''">
859
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vDGURI"/></xsl:attribute>
860
+ </xsl:if>
861
+ <rdfs:label>
862
+ <xsl:if test="$vXmlLang != ''">
863
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
864
+ </xsl:if>
865
+ <xsl:call-template name="tChopPunct">
866
+ <xsl:with-param name="pString" select="."/>
867
+ </xsl:call-template>
868
+ </rdfs:label>
869
+ <xsl:for-each select="following-sibling::marc:subfield[@code='b'][position()=1]">
870
+ <bf:code><xsl:value-of select="."/></bf:code>
871
+ </xsl:for-each>
872
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
873
+ <xsl:with-param name="serialization" select="$serialization"/>
874
+ <xsl:with-param name="pVocabStem" select="$subjectSchemes"/>
875
+ </xsl:apply-templates>
876
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
877
+ <xsl:with-param name="serialization" select="$serialization"/>
878
+ </xsl:apply-templates>
879
+ </xsl:element>
880
+ </xsl:element>
881
+ </xsl:for-each>
882
+ <xsl:choose>
883
+ <xsl:when test="not(marc:subfield[@code='a']) and marc:subfield[@code='m']">
884
+ <xsl:for-each select="marc:subfield[@code='m']">
885
+ <xsl:element name="{$vProp}">
886
+ <bflc:DemographicGroup>
887
+ <xsl:if test="following-sibling::marc:subfield[@code='n']">
888
+ <xsl:variable name="encoded">
889
+ <xsl:call-template name="url-encode">
890
+ <xsl:with-param name="str" select="normalize-space(following-sibling::marc:subfield[@code='n'][1])"/>
891
+ </xsl:call-template>
892
+ </xsl:variable>
893
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($demographicTerms,$encoded)"/></xsl:attribute>
894
+ </xsl:if>
895
+ <rdfs:label>
896
+ <xsl:if test="$vXmlLang != ''">
897
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
898
+ </xsl:if>
899
+ <xsl:call-template name="tChopPunct">
900
+ <xsl:with-param name="pString" select="."/>
901
+ </xsl:call-template>
902
+ </rdfs:label>
903
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
904
+ <xsl:with-param name="serialization" select="$serialization"/>
905
+ <xsl:with-param name="pVocabStem" select="$subjectSchemes"/>
906
+ </xsl:apply-templates>
907
+ </bflc:DemographicGroup>
908
+ </xsl:element>
909
+ </xsl:for-each>
910
+ </xsl:when>
911
+ <xsl:when test="not(marc:subfield[@code='a']) and marc:subfield[@code='n']">
912
+ <xsl:for-each select="marc:subfield[@code='n']">
913
+ <xsl:element name="{$vProp}">
914
+ <xsl:variable name="encoded">
915
+ <xsl:call-template name="url-encode">
916
+ <xsl:with-param name="str" select="normalize-space(.)"/>
917
+ </xsl:call-template>
918
+ </xsl:variable>
919
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="concat($demographicTerms,$encoded)"/></xsl:attribute>
920
+ </xsl:element>
921
+ </xsl:for-each>
922
+ </xsl:when>
923
+ </xsl:choose>
924
+ </xsl:when>
925
+ </xsl:choose>
926
+ </xsl:template>
927
+
928
+ <xsl:template match="marc:datafield[@tag='334' or @tag='336' or @tag='337' or @tag='338' or @tag='880']" mode="rdaResource">
929
+ <xsl:param name="serialization" select="'rdfxml'"/>
930
+ <xsl:param name="pProp"/>
931
+ <xsl:param name="pResource"/>
932
+ <xsl:param name="pUriStem"/>
933
+ <xsl:param name="pInstanceType" />
934
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
935
+ <xsl:choose>
936
+ <xsl:when test="$serialization = 'rdfxml'">
937
+ <xsl:for-each select="marc:subfield[@code='b']">
938
+ <xsl:variable name="encoded">
939
+ <xsl:call-template name="url-encode">
940
+ <xsl:with-param name="str" select="normalize-space(.)"/>
941
+ </xsl:call-template>
942
+ </xsl:variable>
943
+ <xsl:element name="{$pProp}">
944
+ <xsl:element name="{$pResource}">
945
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($pUriStem,$encoded)"/></xsl:attribute>
946
+ <xsl:if test="preceding-sibling::marc:subfield[position()=1]/@code = 'a'">
947
+ <rdfs:label>
948
+ <xsl:if test="$vXmlLang != ''">
949
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
950
+ </xsl:if>
951
+ <xsl:call-template name="tChopPunct">
952
+ <xsl:with-param name="pString" select="preceding-sibling::marc:subfield[position()=1]"/>
953
+ </xsl:call-template>
954
+ </rdfs:label>
955
+ </xsl:if>
956
+ <xsl:if test="following-sibling::marc:subfield[position()=1]/@code = '0'">
957
+ <xsl:choose>
958
+ <xsl:when test="contains(following-sibling::marc:subfield[position()=1], '://')">
959
+ <xsl:variable name="the0">
960
+ <xsl:choose>
961
+ <xsl:when test="starts-with(following-sibling::marc:subfield[position()=1],'(uri)')">
962
+ <xsl:value-of select="substring-after(following-sibling::marc:subfield[position()=1],'(uri)')"/>
963
+ </xsl:when>
964
+ <xsl:otherwise>
965
+ <xsl:value-of select="following-sibling::marc:subfield[position()=1]"/>
966
+ </xsl:otherwise>
967
+ </xsl:choose>
968
+ </xsl:variable>
969
+ <xsl:if test="$the0 != concat($pUriStem,$encoded)">
970
+ <madsrdf:hasRelatedAuthority>
971
+ <xsl:attribute name="rdf:resource">
972
+ <xsl:value-of select="$the0"/>
973
+ </xsl:attribute>
974
+ </madsrdf:hasRelatedAuthority>
975
+ </xsl:if>
976
+ </xsl:when>
977
+ <xsl:otherwise>
978
+ <xsl:apply-templates select="following-sibling::marc:subfield[position()=1]" mode="subfield0orw">
979
+ <xsl:with-param name="serialization" select="$serialization"/>
980
+ </xsl:apply-templates>
981
+ </xsl:otherwise>
982
+ </xsl:choose>
983
+ </xsl:if>
984
+ <xsl:for-each select="../marc:subfield[@code='2']">
985
+ <xsl:variable name="vCode">
986
+ <xsl:call-template name="tNormalizeCode">
987
+ <xsl:with-param name="pCode" select="."/>
988
+ </xsl:call-template>
989
+ </xsl:variable>
990
+ <bf:source>
991
+ <bf:Source>
992
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($genreFormSchemes,$vCode)"/></xsl:attribute>
993
+ </bf:Source>
994
+ </bf:source>
995
+ </xsl:for-each>
996
+ <xsl:if test="$pInstanceType != 'SecondaryInstance'">
997
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
998
+ <xsl:with-param name="serialization" select="$serialization"/>
999
+ </xsl:apply-templates>
1000
+ </xsl:if>
1001
+ </xsl:element>
1002
+ </xsl:element>
1003
+ </xsl:for-each>
1004
+ <xsl:for-each select="marc:subfield[@code='a']">
1005
+ <xsl:if test="following-sibling::marc:subfield[position()=1]/@code != 'b'">
1006
+ <xsl:variable name="tA" select="." />
1007
+ <xsl:variable name="mtURI" select="($codeMaps/maps/mediaTypes/*[. = $tA]/@href|$codeMaps/maps/carriers/*[. = $tA]/@href|$codeMaps/maps/contentTypes/*[. = $tA]/@href)[1]" />
1008
+ <xsl:element name="{$pProp}">
1009
+ <xsl:element name="{$pResource}">
1010
+ <xsl:if test="$mtURI!=''">
1011
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$mtURI"/></xsl:attribute>
1012
+ </xsl:if>
1013
+ <rdfs:label>
1014
+ <xsl:if test="$vXmlLang != ''">
1015
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1016
+ </xsl:if>
1017
+ <xsl:call-template name="tChopPunct">
1018
+ <xsl:with-param name="pString" select="."/>
1019
+ </xsl:call-template>
1020
+ </rdfs:label>
1021
+ <xsl:if test="$mtURI=''">
1022
+ <xsl:if test="following-sibling::marc:subfield[position()=1]/@code = '0'">
1023
+ <xsl:apply-templates select="following-sibling::marc:subfield[position()=1]" mode="subfield0orw">
1024
+ <xsl:with-param name="serialization" select="$serialization"/>
1025
+ </xsl:apply-templates>
1026
+ </xsl:if>
1027
+ <xsl:for-each select="../marc:subfield[@code='2']">
1028
+ <xsl:variable name="vCode">
1029
+ <xsl:call-template name="tNormalizeCode">
1030
+ <xsl:with-param name="pCode" select="."/>
1031
+ </xsl:call-template>
1032
+ </xsl:variable>
1033
+ <bf:source>
1034
+ <bf:Source>
1035
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($genreFormSchemes,$vCode)"/></xsl:attribute>
1036
+ </bf:Source>
1037
+ </bf:source>
1038
+ </xsl:for-each>
1039
+ </xsl:if>
1040
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
1041
+ <xsl:with-param name="serialization" select="$serialization"/>
1042
+ </xsl:apply-templates>
1043
+ </xsl:element>
1044
+ </xsl:element>
1045
+ </xsl:if>
1046
+ </xsl:for-each>
1047
+ </xsl:when>
1048
+ </xsl:choose>
1049
+ </xsl:template>
1050
+
1051
+ <xsl:template match="marc:datafield[@tag='300' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='300')]" mode="instance">
1052
+ <xsl:param name="serialization" select="'rdfxml'"/>
1053
+ <xsl:param name="pInstanceType" />
1054
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
1055
+ <xsl:variable name="vExtent">
1056
+ <xsl:apply-templates select="marc:subfield[@code='a' or @code='f' or @code='g']" mode="concat-nodes-space"/>
1057
+ </xsl:variable>
1058
+ <xsl:choose>
1059
+ <xsl:when test="$serialization='rdfxml'">
1060
+ <xsl:if test="$vExtent != ''">
1061
+ <bf:extent>
1062
+ <bf:Extent>
1063
+ <rdfs:label>
1064
+ <xsl:if test="$vXmlLang != ''">
1065
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1066
+ </xsl:if>
1067
+ <xsl:call-template name="tChopPunct">
1068
+ <xsl:with-param name="pString" select="$vExtent"/>
1069
+ <xsl:with-param name="pEndPunct" select="':;,/=+'"/>
1070
+ </xsl:call-template>
1071
+ </rdfs:label>
1072
+ <xsl:if test="marc:subfield[@code='3'] and
1073
+ marc:subfield[@code='3'] != 'all' and
1074
+ $pInstanceType != 'SecondaryInstance'
1075
+ ">
1076
+ <xsl:apply-templates select="marc:subfield[@code='3']" mode="subfield3">
1077
+ <xsl:with-param name="serialization" select="$serialization"/>
1078
+ </xsl:apply-templates>
1079
+ </xsl:if>
1080
+ <xsl:for-each select="marc:subfield[@code='b']">
1081
+ <bf:note>
1082
+ <bf:Note>
1083
+ <rdf:type>
1084
+ <xsl:attribute name="rdf:resource">http://id.loc.gov/vocabulary/mnotetype/physical</xsl:attribute>
1085
+ </rdf:type>
1086
+ <rdfs:label>
1087
+ <xsl:if test="$vXmlLang != ''">
1088
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1089
+ </xsl:if>
1090
+ <xsl:call-template name="tChopPunct">
1091
+ <xsl:with-param name="pString" select="."/>
1092
+ <xsl:with-param name="pEndPunct" select="':;,/=+'"/>
1093
+ </xsl:call-template>
1094
+ </rdfs:label>
1095
+ </bf:Note>
1096
+ </bf:note>
1097
+ </xsl:for-each>
1098
+ </bf:Extent>
1099
+ </bf:extent>
1100
+ </xsl:if>
1101
+ <xsl:for-each select="marc:subfield[@code='e']">
1102
+ <bf:note>
1103
+ <bf:Note>
1104
+ <rdf:type>
1105
+ <xsl:attribute name="rdf:resource">http://id.loc.gov/vocabulary/mnotetype/accmat</xsl:attribute>
1106
+ </rdf:type>
1107
+ <rdfs:label>
1108
+ <xsl:if test="$vXmlLang != ''">
1109
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1110
+ </xsl:if>
1111
+ <xsl:call-template name="tChopPunct">
1112
+ <xsl:with-param name="pString" select="."/>
1113
+ <xsl:with-param name="pEndPunct" select="':;,/=+'"/>
1114
+ </xsl:call-template>
1115
+ </rdfs:label>
1116
+ <xsl:if test="../marc:subfield[@code='3'] and $pInstanceType != 'SecondaryInstance'">
1117
+ <xsl:apply-templates select="../marc:subfield[@code='3']" mode="subfield3">
1118
+ <xsl:with-param name="serialization" select="$serialization"/>
1119
+ </xsl:apply-templates>
1120
+ </xsl:if>
1121
+ </bf:Note>
1122
+ </bf:note>
1123
+ </xsl:for-each>
1124
+ <xsl:for-each select="marc:subfield[@code='c']">
1125
+ <bf:dimensions>
1126
+ <xsl:if test="$vXmlLang != ''">
1127
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1128
+ </xsl:if>
1129
+ <xsl:call-template name="tChopPunct">
1130
+ <xsl:with-param name="pString" select="."/>
1131
+ <xsl:with-param name="pEndPunct" select="':;,/=+.'"/>
1132
+ </xsl:call-template>
1133
+ </bf:dimensions>
1134
+ </xsl:for-each>
1135
+ </xsl:when>
1136
+ </xsl:choose>
1137
+ </xsl:template>
1138
+
1139
+ <xsl:template match="marc:datafield[@tag='306' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='306')]" mode="instance">
1140
+ <xsl:param name="serialization" select="'rdfxml'"/>
1141
+ <xsl:choose>
1142
+ <xsl:when test="$serialization='rdfxml'">
1143
+ <xsl:for-each select="marc:subfield[@code='a']">
1144
+ <xsl:variable name="vDuration">
1145
+ <xsl:choose>
1146
+ <xsl:when test="string-length(.) = '6'">
1147
+ <xsl:variable name="vH" select="concat(substring(., 1, 2), 'H')"/>
1148
+ <xsl:variable name="vM" select="concat(substring(., 3, 2), 'M')"/>
1149
+ <xsl:variable name="vS" select="concat(substring(., 5, 2), 'S')"/>
1150
+ <xsl:value-of select="concat('PT', $vH, $vM, $vS)" />
1151
+ </xsl:when>
1152
+ <xsl:otherwise>
1153
+ <xsl:value-of select="."/>
1154
+ </xsl:otherwise>
1155
+ </xsl:choose>
1156
+ </xsl:variable>
1157
+ <bf:duration>
1158
+ <xsl:if test="starts-with($vDuration, 'PT')">
1159
+ <xsl:attribute name="rdf:datatype"><xsl:value-of select="concat($xs,'duration')"/></xsl:attribute>
1160
+ </xsl:if>
1161
+ <xsl:value-of select="$vDuration"/>
1162
+ </bf:duration>
1163
+ </xsl:for-each>
1164
+ </xsl:when>
1165
+ </xsl:choose>
1166
+ </xsl:template>
1167
+
1168
+ <xsl:template match="marc:datafield[@tag='310' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='310')] |
1169
+ marc:datafield[@tag='321' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='321')]"
1170
+ mode="instance">
1171
+ <xsl:param name="serialization" select="'rdfxml'"/>
1172
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
1173
+ <xsl:variable name="vTag">
1174
+ <xsl:choose>
1175
+ <xsl:when test="@tag='880'"><xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/></xsl:when>
1176
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
1177
+ </xsl:choose>
1178
+ </xsl:variable>
1179
+ <xsl:choose>
1180
+ <xsl:when test="$serialization='rdfxml'">
1181
+ <xsl:for-each select="marc:subfield[@code='a']">
1182
+ <bf:frequency>
1183
+ <bf:Frequency>
1184
+ <xsl:if test="../marc:subfield[@code='0'][contains(.,'://')]">
1185
+ <xsl:attribute name="rdf:about"><xsl:value-of select="../marc:subfield[@code='0'][contains(.,'://')]"/></xsl:attribute>
1186
+ </xsl:if>
1187
+ <rdfs:label>
1188
+ <xsl:if test="$vXmlLang != ''">
1189
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1190
+ </xsl:if>
1191
+ <xsl:call-template name="tChopPunct">
1192
+ <xsl:with-param name="pString" select="."/>
1193
+ </xsl:call-template>
1194
+ </rdfs:label>
1195
+ <xsl:for-each select="../marc:subfield[@code='b']">
1196
+ <bf:date>
1197
+ <xsl:if test="$vXmlLang != ''">
1198
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1199
+ </xsl:if>
1200
+ <xsl:call-template name="tChopPunct">
1201
+ <xsl:with-param name="pString" select="."/>
1202
+ </xsl:call-template>
1203
+ </bf:date>
1204
+ </xsl:for-each>
1205
+ <xsl:if test="$vTag='310'">
1206
+ <bf:status>
1207
+ <bf:Status>
1208
+ <xsl:attribute name="rdf:about">http://id.loc.gov/vocabulary/mstatus/current</xsl:attribute>
1209
+ <rdfs:label>current</rdfs:label>
1210
+ </bf:Status>
1211
+ </bf:status>
1212
+ </xsl:if>
1213
+ <xsl:if test="$vTag='321'">
1214
+ <bf:status>
1215
+ <bf:Status>
1216
+ <xsl:attribute name="rdf:about">http://id.loc.gov/vocabulary/mstatus/former</xsl:attribute>
1217
+ <rdfs:label>former</rdfs:label>
1218
+ </bf:Status>
1219
+ </bf:status>
1220
+ </xsl:if>
1221
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
1222
+ <xsl:with-param name="serialization" select="$serialization"/>
1223
+ </xsl:apply-templates>
1224
+ <xsl:apply-templates select="../marc:subfield[@code='0'][not(contains(.,'://'))]" mode="subfield0orw">
1225
+ <xsl:with-param name="serialization" select="$serialization"/>
1226
+ </xsl:apply-templates>
1227
+ </bf:Frequency>
1228
+ </bf:frequency>
1229
+ </xsl:for-each>
1230
+ </xsl:when>
1231
+ </xsl:choose>
1232
+ </xsl:template>
1233
+
1234
+ <xsl:template match="marc:datafield[@tag='337' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='337')]" mode="instance">
1235
+ <xsl:param name="serialization" select="'rdfxml'"/>
1236
+ <xsl:param name="pInstanceType" />
1237
+ <xsl:apply-templates select="." mode="rdaResource">
1238
+ <xsl:with-param name="serialization" select="$serialization"/>
1239
+ <xsl:with-param name="pProp">bf:media</xsl:with-param>
1240
+ <xsl:with-param name="pResource">bf:Media</xsl:with-param>
1241
+ <xsl:with-param name="pUriStem"><xsl:value-of select="$mediaType"/></xsl:with-param>
1242
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
1243
+ </xsl:apply-templates>
1244
+ </xsl:template>
1245
+
1246
+ <xsl:template match="marc:datafield[@tag='338' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='338')]" mode="instance">
1247
+ <xsl:param name="serialization" select="'rdfxml'"/>
1248
+ <xsl:param name="pInstanceType" />
1249
+ <xsl:apply-templates select="." mode="rdaResource">
1250
+ <xsl:with-param name="serialization" select="$serialization"/>
1251
+ <xsl:with-param name="pProp">bf:carrier</xsl:with-param>
1252
+ <xsl:with-param name="pResource">bf:Carrier</xsl:with-param>
1253
+ <xsl:with-param name="pUriStem"><xsl:value-of select="$carriers"/></xsl:with-param>
1254
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
1255
+ </xsl:apply-templates>
1256
+ </xsl:template>
1257
+
1258
+ <xsl:template match="marc:datafield[@tag='340' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='340')]" mode="instance">
1259
+ <xsl:param name="serialization" select="'rdfxml'"/>
1260
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
1261
+ <xsl:for-each select="marc:subfield[@code='a' or @code='c' or @code='d' or @code='e' or @code='f' or @code='g' or @code='j' or @code='k' or @code='l' or @code='m' or @code='n' or @code='o' or @code='q' ]">
1262
+ <xsl:variable name="vProp">
1263
+ <xsl:choose>
1264
+ <xsl:when test="@code='a'">bf:baseMaterial</xsl:when>
1265
+ <xsl:when test="@code='c'">bf:appliedMaterial</xsl:when>
1266
+ <xsl:when test="@code='d'">bf:productionMethod</xsl:when>
1267
+ <xsl:when test="@code='e'">bf:mount</xsl:when>
1268
+ <xsl:when test="@code='f'">bf:reductionRatio</xsl:when>
1269
+ <xsl:when test="@code='g'">bf:colorContent</xsl:when>
1270
+ <xsl:when test="@code='j'">bf:generation</xsl:when>
1271
+ <xsl:when test="@code='k'">bf:layout</xsl:when>
1272
+ <xsl:when test="@code='l'">bf:binding</xsl:when>
1273
+ <xsl:when test="@code='m'">bf:bookFormat</xsl:when>
1274
+ <xsl:when test="@code='n'">bf:fontSize</xsl:when>
1275
+ <xsl:when test="@code='o'">bf:polarity</xsl:when>
1276
+ <xsl:when test="@code='q'">bf:reductionRatio</xsl:when>
1277
+ </xsl:choose>
1278
+ </xsl:variable>
1279
+ <xsl:variable name="vObject">
1280
+ <xsl:choose>
1281
+ <xsl:when test="@code='a'">bf:BaseMaterial</xsl:when>
1282
+ <xsl:when test="@code='c'">bf:AppliedMaterial</xsl:when>
1283
+ <xsl:when test="@code='d'">bf:ProductionMethod</xsl:when>
1284
+ <xsl:when test="@code='e'">bf:Mount</xsl:when>
1285
+ <xsl:when test="@code='f'">bf:ReductionRatio</xsl:when>
1286
+ <xsl:when test="@code='g'">bf:ColorContent</xsl:when>
1287
+ <xsl:when test="@code='j'">bf:Generation</xsl:when>
1288
+ <xsl:when test="@code='k'">bf:Layout</xsl:when>
1289
+ <xsl:when test="@code='l'">bf:Binding</xsl:when>
1290
+ <xsl:when test="@code='m'">bf:BookFormat</xsl:when>
1291
+ <xsl:when test="@code='n'">bf:FontSize</xsl:when>
1292
+ <xsl:when test="@code='o'">bf:Polarity</xsl:when>
1293
+ <xsl:when test="@code='q'">bf:ReductionRatio</xsl:when>
1294
+ </xsl:choose>
1295
+ </xsl:variable>
1296
+ <xsl:variable name="vCurrentNode" select="generate-id(.)"/>
1297
+ <xsl:variable name="vCurrentNodeUri">
1298
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
1299
+ <xsl:if test="position() = 1">
1300
+ <xsl:choose>
1301
+ <xsl:when test="starts-with(.,'(uri)')">
1302
+ <xsl:value-of select="substring-after(.,'(uri)')"/>
1303
+ </xsl:when>
1304
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1305
+ </xsl:choose>
1306
+ </xsl:if>
1307
+ </xsl:for-each>
1308
+ </xsl:variable>
1309
+ <xsl:choose>
1310
+ <xsl:when test="$serialization = 'rdfxml'">
1311
+ <xsl:element name="{$vProp}">
1312
+ <xsl:element name="{$vObject}">
1313
+ <xsl:if test="$vCurrentNodeUri != ''">
1314
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vCurrentNodeUri"/></xsl:attribute>
1315
+ </xsl:if>
1316
+ <xsl:choose>
1317
+ <xsl:when test="@code='f'">
1318
+
1319
+ <rdf:value>
1320
+ <xsl:if test="$vXmlLang != ''">
1321
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1322
+ </xsl:if>
1323
+ <xsl:call-template name="tChopPunct">
1324
+ <xsl:with-param name="pString" select="."/>
1325
+ </xsl:call-template>
1326
+ </rdf:value>
1327
+ </xsl:when>
1328
+ <xsl:otherwise>
1329
+ <rdfs:label>
1330
+ <xsl:if test="$vXmlLang != ''">
1331
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1332
+ </xsl:if>
1333
+ <xsl:call-template name="tChopPunct">
1334
+ <xsl:with-param name="pString" select="."/>
1335
+ </xsl:call-template>
1336
+ </rdfs:label>
1337
+ </xsl:otherwise>
1338
+ </xsl:choose>
1339
+ <xsl:for-each select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and contains(text(),'://')]">
1340
+ <xsl:variable name="the0">
1341
+ <xsl:choose>
1342
+ <xsl:when test="starts-with(.,'(uri)')">
1343
+ <xsl:value-of select="substring-after(.,'(uri)')"/>
1344
+ </xsl:when>
1345
+ <xsl:otherwise>
1346
+ <xsl:value-of select="."/>
1347
+ </xsl:otherwise>
1348
+ </xsl:choose>
1349
+ </xsl:variable>
1350
+ <xsl:if test="$the0 != $vCurrentNodeUri">
1351
+ <madsrdf:hasRelatedAuthority>
1352
+ <xsl:attribute name="rdf:resource">
1353
+ <xsl:value-of select="$the0"/>
1354
+ </xsl:attribute>
1355
+ </madsrdf:hasRelatedAuthority>
1356
+ </xsl:if>
1357
+ </xsl:for-each>
1358
+ <xsl:apply-templates select="following-sibling::marc:subfield[@code='0' and generate-id(preceding-sibling::marc:subfield[@code != '0'][1])=$vCurrentNode and not(contains(text(),'://'))]" mode="subfield0orw">
1359
+ <xsl:with-param name="serialization" select="$serialization"/>
1360
+ </xsl:apply-templates>
1361
+ <xsl:apply-templates select="../marc:subfield[@code='2']" mode="subfield2">
1362
+ <xsl:with-param name="serialization" select="$serialization"/>
1363
+ </xsl:apply-templates>
1364
+ </xsl:element>
1365
+ </xsl:element>
1366
+ </xsl:when>
1367
+ </xsl:choose>
1368
+ </xsl:for-each>
1369
+ <xsl:for-each select="marc:subfield[@code='b']">
1370
+ <xsl:choose>
1371
+ <xsl:when test="$serialization = 'rdfxml'">
1372
+ <bf:dimensions>
1373
+ <xsl:if test="$vXmlLang != ''">
1374
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1375
+ </xsl:if>
1376
+ <xsl:call-template name="tChopPunct">
1377
+ <xsl:with-param name="pString" select="."/>
1378
+ </xsl:call-template>
1379
+ </bf:dimensions>
1380
+ </xsl:when>
1381
+ </xsl:choose>
1382
+ </xsl:for-each>
1383
+ <xsl:for-each select="marc:subfield[@code='i']">
1384
+ <xsl:choose>
1385
+ <xsl:when test="$serialization = 'rdfxml'">
1386
+ <bf:systemRequirement>
1387
+ <bf:SystemRequirement>
1388
+ <rdfs:label>
1389
+ <xsl:if test="$vXmlLang != ''">
1390
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1391
+ </xsl:if>
1392
+ <xsl:call-template name="tChopPunct">
1393
+ <xsl:with-param name="pString" select="."/>
1394
+ </xsl:call-template>
1395
+ </rdfs:label>
1396
+ </bf:SystemRequirement>
1397
+ </bf:systemRequirement>
1398
+ </xsl:when>
1399
+ </xsl:choose>
1400
+ </xsl:for-each>
1401
+ </xsl:template>
1402
+
1403
+ <xsl:template match="marc:datafield[@tag='344' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='344')] |
1404
+ marc:datafield[@tag='345' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='345')] |
1405
+ marc:datafield[@tag='346' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='346')] |
1406
+ marc:datafield[@tag='347' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='347')]"
1407
+ mode="instance">
1408
+ <xsl:param name="serialization" select="'rdfxml'"/>
1409
+ <xsl:param name="pInstanceType" />
1410
+ <xsl:variable name="vTag">
1411
+ <xsl:choose>
1412
+ <xsl:when test="@tag='880'"><xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/></xsl:when>
1413
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
1414
+ </xsl:choose>
1415
+ </xsl:variable>
1416
+ <xsl:for-each select="marc:subfield">
1417
+ <xsl:variable name="vProp">
1418
+ <xsl:choose>
1419
+ <xsl:when test="$vTag='344'">
1420
+ <xsl:choose>
1421
+ <xsl:when test="@code='i'">bf:soundContent</xsl:when>
1422
+ <xsl:otherwise>bf:soundCharacteristic</xsl:otherwise>
1423
+ </xsl:choose>
1424
+ </xsl:when>
1425
+ <xsl:when test="$vTag='345'">
1426
+ <xsl:choose>
1427
+ <xsl:when test="@code='c' or @code='d'">bf:aspectRatio</xsl:when>
1428
+ <xsl:otherwise>bf:projectionCharacteristic</xsl:otherwise>
1429
+ </xsl:choose>
1430
+ </xsl:when>
1431
+ <xsl:when test="$vTag='346'">bf:videoCharacteristic</xsl:when>
1432
+ <xsl:when test="$vTag='347'">bf:digitalCharacteristic</xsl:when>
1433
+ <xsl:when test="$vTag='348'">
1434
+ <xsl:choose>
1435
+ <xsl:when test="@code='c'">bf:notation</xsl:when>
1436
+ <xsl:otherwise>bf:musicFormat</xsl:otherwise>
1437
+ </xsl:choose>
1438
+ </xsl:when>
1439
+ </xsl:choose>
1440
+ </xsl:variable>
1441
+ <xsl:variable name="vResource">
1442
+ <xsl:choose>
1443
+ <xsl:when test="$vTag='344'">
1444
+ <xsl:choose>
1445
+ <xsl:when test="@code='a'">bf:RecordingMethod</xsl:when>
1446
+ <xsl:when test="@code='b'">bf:RecordingMedium</xsl:when>
1447
+ <xsl:when test="@code='c'">bf:PlayingSpeed</xsl:when>
1448
+ <xsl:when test="@code='d'">bf:GrooveCharacteristic</xsl:when>
1449
+ <xsl:when test="@code='e'">bf:TrackConfig</xsl:when>
1450
+ <xsl:when test="@code='f'">bf:TapeConfig</xsl:when>
1451
+ <xsl:when test="@code='g'">bf:PlaybackChannels</xsl:when>
1452
+ <xsl:when test="@code='h'">bf:PlaybackCharacteristic</xsl:when>
1453
+ <xsl:when test="@code='i'">bf:SoundContent</xsl:when>
1454
+ </xsl:choose>
1455
+ </xsl:when>
1456
+ <xsl:when test="$vTag='345'">
1457
+ <xsl:choose>
1458
+ <xsl:when test="@code='a'">bf:PresentationFormat</xsl:when>
1459
+ <xsl:when test="@code='b'">bf:ProjectionSpeed</xsl:when>
1460
+ <xsl:when test="@code='c' or @code='d'">bf:AspectRatio</xsl:when>
1461
+ </xsl:choose>
1462
+ </xsl:when>
1463
+ <xsl:when test="$vTag='346'">
1464
+ <xsl:choose>
1465
+ <xsl:when test="@code='a'">bf:VideoFormat</xsl:when>
1466
+ <xsl:when test="@code='b'">bf:BroadcastStandard</xsl:when>
1467
+ </xsl:choose>
1468
+ </xsl:when>
1469
+ <xsl:when test="$vTag='347'">
1470
+ <xsl:choose>
1471
+ <xsl:when test="@code='a'">bf:FileType</xsl:when>
1472
+ <xsl:when test="@code='b'">bf:EncodingFormat</xsl:when>
1473
+ <xsl:when test="@code='c'">bf:FileSize</xsl:when>
1474
+ <xsl:when test="@code='d'">bf:Resolution</xsl:when>
1475
+ <xsl:when test="@code='e'">bf:RegionalEncoding</xsl:when>
1476
+ <xsl:when test="@code='f'">bf:EncodedBitrate</xsl:when>
1477
+ </xsl:choose>
1478
+ </xsl:when>
1479
+ <xsl:when test="$vTag='348'">
1480
+ <xsl:if test="@code='a'">bf:MusicFormat</xsl:if>
1481
+ <xsl:if test="@code='c'">bf:MusicNotation</xsl:if>
1482
+ </xsl:when>
1483
+ </xsl:choose>
1484
+ </xsl:variable>
1485
+ <xsl:variable name="vTarget">
1486
+ <xsl:choose>
1487
+ <xsl:when test="$vTag='344'">
1488
+ <xsl:choose>
1489
+ <xsl:when test="@code='a'">
1490
+ <xsl:choose>
1491
+ <xsl:when test="text()='analog'">
1492
+ <xsl:value-of select="concat($mrectype,'analog')"/>
1493
+ </xsl:when>
1494
+ <xsl:when test="text()='digital'">
1495
+ <xsl:value-of select="concat($mrectype,'digital')"/>
1496
+ </xsl:when>
1497
+ </xsl:choose>
1498
+ </xsl:when>
1499
+ <xsl:when test="@code='b'">
1500
+ <xsl:choose>
1501
+ <xsl:when test="text()='magnetic'">
1502
+ <xsl:value-of select="concat($mrecmedium,'mag')"/>
1503
+ </xsl:when>
1504
+ <xsl:when test="text()='optical'">
1505
+ <xsl:value-of select="concat($mrecmedium,'opt')"/>
1506
+ </xsl:when>
1507
+ <xsl:when test="text()='magneto-optical'">
1508
+ <xsl:value-of select="concat($mrecmedium,'magopt')"/>
1509
+ </xsl:when>
1510
+ </xsl:choose>
1511
+ </xsl:when>
1512
+ <xsl:when test="@code='d'">
1513
+ <xsl:choose>
1514
+ <xsl:when test="text()='coarse groove'">
1515
+ <xsl:value-of select="concat($mgroove,'coarse')"/>
1516
+ </xsl:when>
1517
+ <xsl:when test="text()='microgroove'">
1518
+ <xsl:value-of select="concat($mgroove,'micro')"/>
1519
+ </xsl:when>
1520
+ </xsl:choose>
1521
+ </xsl:when>
1522
+ <xsl:when test="@code='g'">
1523
+ <xsl:choose>
1524
+ <xsl:when test="text()='mono'">
1525
+ <xsl:value-of select="concat($mplayback,'mon')"/>
1526
+ </xsl:when>
1527
+ <xsl:when test="text()='quadraphonic' or text()='surround'">
1528
+ <xsl:value-of select="concat($mplayback,'mul')"/>
1529
+ </xsl:when>
1530
+ <xsl:when test="text()='stereo'">
1531
+ <xsl:value-of select="concat($mplayback,'ste')"/>
1532
+ </xsl:when>
1533
+ </xsl:choose>
1534
+ </xsl:when>
1535
+ <xsl:when test="@code='h'">
1536
+ <xsl:choose>
1537
+ <xsl:when test="text()='CCIR encoded'">
1538
+ <xsl:value-of select="concat($mspecplayback,'ccir')"/>
1539
+ </xsl:when>
1540
+ <xsl:when test="text()='CX encoded'">
1541
+ <xsl:value-of select="concat($mspecplayback,'cx')"/>
1542
+ </xsl:when>
1543
+ <xsl:when test="text()='dbx encoded'">
1544
+ <xsl:value-of select="concat($mspecplayback,'dbx')"/>
1545
+ </xsl:when>
1546
+ <xsl:when test="text()='Dolby'">
1547
+ <xsl:value-of select="concat($mspecplayback,'dolby')"/>
1548
+ </xsl:when>
1549
+ <xsl:when test="text()='Dolby-A encoded'">
1550
+ <xsl:value-of select="concat($mspecplayback,'dolbya')"/>
1551
+ </xsl:when>
1552
+ <xsl:when test="text()='Dolby-B encoded'">
1553
+ <xsl:value-of select="concat($mspecplayback,'dolbyb')"/>
1554
+ </xsl:when>
1555
+ <xsl:when test="text()='Dolby-C encoded'">
1556
+ <xsl:value-of select="concat($mspecplayback,'dolbyc')"/>
1557
+ </xsl:when>
1558
+ <xsl:when test="text()='LPCM'">
1559
+ <xsl:value-of select="concat($mspecplayback,'lpcm')"/>
1560
+ </xsl:when>
1561
+ <xsl:when test="text()='NAB standard'">
1562
+ <xsl:value-of select="concat($mspecplayback,'nab')"/>
1563
+ </xsl:when>
1564
+ <xsl:when test="text()='Dolby Digital'">
1565
+ <xsl:value-of select="concat($mspecplayback,'dolbydig')"/>
1566
+ </xsl:when>
1567
+ <xsl:when test="text()='Dolby Digital 5.1'">
1568
+ <xsl:value-of select="concat($mspecplayback,'dolbydig51')"/>
1569
+ </xsl:when>
1570
+ <xsl:when test="text()='Dolby Digital 2.0'">
1571
+ <xsl:value-of select="concat($mspecplayback,'dolbydig2')"/>
1572
+ </xsl:when>
1573
+ <xsl:when test="text()='Dolby digital'">
1574
+ <xsl:value-of select="concat($mspecplayback,'dolbydig')"/>
1575
+ </xsl:when>
1576
+ <xsl:when test="text()='DTS-HD Master Audio 5.1'">
1577
+ <xsl:value-of select="concat($mspecplayback,'dtshd51')"/>
1578
+ </xsl:when>
1579
+ <xsl:when test="text()='5.1 Dolby Digital'">
1580
+ <xsl:value-of select="concat($mspecplayback,'dolbydig51')"/>
1581
+ </xsl:when>
1582
+ <xsl:when test="text()='DTS-HD Master Audio'">
1583
+ <xsl:value-of select="concat($mspecplayback,'dtshd')"/>
1584
+ </xsl:when>
1585
+ <xsl:when test="text()='Dolby digital 5.1'">
1586
+ <xsl:value-of select="concat($mspecplayback,'dolbydig51')"/>
1587
+ </xsl:when>
1588
+ <xsl:when test="text()='DTS'">
1589
+ <xsl:value-of select="concat($mspecplayback,'dts')"/>
1590
+ </xsl:when>
1591
+ <xsl:when test="text()='2.0 Dolby Digital'">
1592
+ <xsl:value-of select="concat($mspecplayback,'dolbydig2')"/>
1593
+ </xsl:when>
1594
+ <xsl:when test="text()='5.1 DTS-HD Master Audio'">
1595
+ <xsl:value-of select="concat($mspecplayback,'dtshd51')"/>
1596
+ </xsl:when>
1597
+ <xsl:when test="text()='Dolby digital 2.0'">
1598
+ <xsl:value-of select="concat($mspecplayback,'dolbydig2')"/>
1599
+ </xsl:when>
1600
+ <xsl:when test="text()='5.1 DTS-HD MA'">
1601
+ <xsl:value-of select="concat($mspecplayback,'dtshd51')"/>
1602
+ </xsl:when>
1603
+ <xsl:when test="text()='DTS-HD Master Audio 7.1'">
1604
+ <xsl:value-of select="concat($mspecplayback,'dtshd71')"/>
1605
+ </xsl:when>
1606
+ <xsl:when test="text()='DTS 5.1'">
1607
+ <xsl:value-of select="concat($mspecplayback,'dts51')"/>
1608
+ </xsl:when>
1609
+ <xsl:when test="text()='Dolby Digital 1.0'">
1610
+ <xsl:value-of select="concat($mspecplayback,'dolbydig1')"/>
1611
+ </xsl:when>
1612
+ <xsl:when test="text()='PCM'">
1613
+ <xsl:value-of select="concat($mspecplayback,'pcm')"/>
1614
+ </xsl:when>
1615
+ <xsl:when test="text()='DTS-HD master audio'">
1616
+ <xsl:value-of select="concat($mspecplayback,'dtshd')"/>
1617
+ </xsl:when>
1618
+ <xsl:when test="text()='DTS-HD MA 5.1'">
1619
+ <xsl:value-of select="concat($mspecplayback,'dtshd51')"/>
1620
+ </xsl:when>
1621
+ <xsl:when test="text()='DTS-HD MA'">
1622
+ <xsl:value-of select="concat($mspecplayback,'dtshd')"/>
1623
+ </xsl:when>
1624
+ <xsl:when test="text()='5.1 Dolby digital'">
1625
+ <xsl:value-of select="concat($mspecplayback,'dolbydig51')"/>
1626
+ </xsl:when>
1627
+ <xsl:when test="text()='DTS-HD master audio 5.1'">
1628
+ <xsl:value-of select="concat($mspecplayback,'dtshd51')"/>
1629
+ </xsl:when>
1630
+ <xsl:when test="text()='7.1 DTS-HD Master Audio'">
1631
+ <xsl:value-of select="concat($mspecplayback,'dtshd71')"/>
1632
+ </xsl:when>
1633
+ <xsl:when test="text()='PCM uncompressed'">
1634
+ <xsl:value-of select="concat($mspecplayback,'pcmunc')"/>
1635
+ </xsl:when>
1636
+ <xsl:when test="text()='PCM 5.1'">
1637
+ <xsl:value-of select="concat($mspecplayback,'pcm51')"/>
1638
+ </xsl:when>
1639
+ <xsl:when test="text()='7.1 DTS-HD MA'">
1640
+ <xsl:value-of select="concat($mspecplayback,'dtshd71')"/>
1641
+ </xsl:when>
1642
+ <xsl:when test="text()='2.0 Dolby digital'">
1643
+ <xsl:value-of select="concat($mspecplayback,'dolbydig2')"/>
1644
+ </xsl:when>
1645
+ <xsl:when test="text()='5.1 DTS-HD Master audio'">
1646
+ <xsl:value-of select="concat($mspecplayback,'dtshd51')"/>
1647
+ </xsl:when>
1648
+ <xsl:when test="text()='5.1 DTS'">
1649
+ <xsl:value-of select="concat($mspecplayback,'dts51')"/>
1650
+ </xsl:when>
1651
+ <xsl:when test="text()='Dolby 5.1'">
1652
+ <xsl:value-of select="concat($mspecplayback,'dolbydig51')"/>
1653
+ </xsl:when>
1654
+ <xsl:when test="text()='Dolby 2.0'">
1655
+ <xsl:value-of select="concat($mspecplayback,'dolbydig2')"/>
1656
+ </xsl:when>
1657
+ </xsl:choose>
1658
+ </xsl:when>
1659
+ <xsl:when test="@code='i'">
1660
+ <xsl:choose>
1661
+ <xsl:when test="translate(text(),$upper,$lower)='silent'">http://id.loc.gov/vocabulary/msoundcontent/silent</xsl:when>
1662
+ <xsl:when test="translate(text(),$upper,$lower)='sound'">http://id.loc.gov/vocabulary/msoundcontent/sound</xsl:when>
1663
+ </xsl:choose>
1664
+ </xsl:when>
1665
+ </xsl:choose>
1666
+ </xsl:when>
1667
+ <xsl:when test="$vTag='345'">
1668
+ <xsl:if test="@code='a'">
1669
+ <xsl:choose>
1670
+ <xsl:when test="text()='3D'">
1671
+ <xsl:value-of select="concat($mpresformat,'3d')"/>
1672
+ </xsl:when>
1673
+ <xsl:when test="text()='Cinemiracle'">
1674
+ <xsl:value-of select="concat($mpresformat,'ciner')"/>
1675
+ </xsl:when>
1676
+ <xsl:when test="text()='Cinemiracle'">
1677
+ <xsl:value-of select="concat($mpresformat,'cinem')"/>
1678
+ </xsl:when>
1679
+ <xsl:when test="text()='Cinerama'">
1680
+ <xsl:value-of select="concat($mpresformat,'ciner')"/>
1681
+ </xsl:when>
1682
+ <xsl:when test="text()='Circarama'">
1683
+ <xsl:value-of select="concat($mpresformat,'circa')"/>
1684
+ </xsl:when>
1685
+ <xsl:when test="text()='IMAX'">
1686
+ <xsl:value-of select="concat($mpresformat,'imax')"/>
1687
+ </xsl:when>
1688
+ <xsl:when test="text()='multiprojector'">
1689
+ <xsl:value-of select="concat($mpresformat,'mproj')"/>
1690
+ </xsl:when>
1691
+ <xsl:when test="text()='multiscreen'">
1692
+ <xsl:value-of select="concat($mpresformat,'mscreen')"/>
1693
+ </xsl:when>
1694
+ <xsl:when test="text()='Panavision'">
1695
+ <xsl:value-of select="concat($mpresformat,'pana')"/>
1696
+ </xsl:when>
1697
+ <xsl:when test="text()='standard silent aperture'">
1698
+ <xsl:value-of select="concat($mpresformat,'silent')"/>
1699
+ </xsl:when>
1700
+ <xsl:when test="text()='standard sound aperture'">
1701
+ <xsl:value-of select="concat($mpresformat,'sound')"/>
1702
+ </xsl:when>
1703
+ <xsl:when test="text()='stereoscopic'">
1704
+ <xsl:value-of select="concat($mpresformat,'stereo')"/>
1705
+ </xsl:when>
1706
+ <xsl:when test="text()='Techniscope'">
1707
+ <xsl:value-of select="concat($mpresformat,'tech')"/>
1708
+ </xsl:when>
1709
+ </xsl:choose>
1710
+ </xsl:if>
1711
+ </xsl:when>
1712
+ <xsl:when test="$vTag='346'">
1713
+ <xsl:choose>
1714
+ <xsl:when test="@code='a'">
1715
+ <xsl:choose>
1716
+ <xsl:when test="text()='8 mm'">
1717
+ <xsl:value-of select="concat($mvidformat,'8mm')"/>
1718
+ </xsl:when>
1719
+ <xsl:when test="text()='Betacam'">
1720
+ <xsl:value-of select="concat($mvidformat,'betacam')"/>
1721
+ </xsl:when>
1722
+ <xsl:when test="text()='Betacam SP'">
1723
+ <xsl:value-of select="concat($mvidformat,'betasp')"/>
1724
+ </xsl:when>
1725
+ <xsl:when test="text()='Betamax'">
1726
+ <xsl:value-of select="concat($mvidformat,'betamax')"/>
1727
+ </xsl:when>
1728
+ <xsl:when test="text()='CED'">
1729
+ <xsl:value-of select="concat($mvidformat,'ced')"/>
1730
+ </xsl:when>
1731
+ <xsl:when test="text()='D-2'">
1732
+ <xsl:value-of select="concat($mvidformat,'d2')"/>
1733
+ </xsl:when>
1734
+ <xsl:when test="text()='EIAJ'">
1735
+ <xsl:value-of select="concat($mvidformat,'eiaj')"/>
1736
+ </xsl:when>
1737
+ <xsl:when test="text()='Hi-8 mm'">
1738
+ <xsl:value-of select="concat($mvidformat,'hi8mm')"/>
1739
+ </xsl:when>
1740
+ <xsl:when test="text()='laser optical'">
1741
+ <xsl:value-of select="concat($mvidformat,'laser')"/>
1742
+ </xsl:when>
1743
+ <xsl:when test="text()='M-II'">
1744
+ <xsl:value-of select="concat($mvidformat,'mii')"/>
1745
+ </xsl:when>
1746
+ <xsl:when test="text()='Quadruplex'">
1747
+ <xsl:value-of select="concat($mvidformat,'quad')"/>
1748
+ </xsl:when>
1749
+ <xsl:when test="text()='Super-VHS'">
1750
+ <xsl:value-of select="concat($mvidformat,'svhs')"/>
1751
+ </xsl:when>
1752
+ <xsl:when test="text()='Type C'">
1753
+ <xsl:value-of select="concat($mvidformat,'typec')"/>
1754
+ </xsl:when>
1755
+ <xsl:when test="text()='U-matic'">
1756
+ <xsl:value-of select="concat($mvidformat,'umatic')"/>
1757
+ </xsl:when>
1758
+ <xsl:when test="text()='VHS'">
1759
+ <xsl:value-of select="concat($mvidformat,'vhs')"/>
1760
+ </xsl:when>
1761
+ </xsl:choose>
1762
+ </xsl:when>
1763
+ <xsl:when test="@code='b'">
1764
+ <xsl:choose>
1765
+ <xsl:when test="text()='HDTV'">
1766
+ <xsl:value-of select="concat($mbroadstd,'hdtv')"/>
1767
+ </xsl:when>
1768
+ <xsl:when test="text()='NTSC'">
1769
+ <xsl:value-of select="concat($mbroadstd,'ntsc')"/>
1770
+ </xsl:when>
1771
+ <xsl:when test="text()='PAL'">
1772
+ <xsl:value-of select="concat($mbroadstd,'pal')"/>
1773
+ </xsl:when>
1774
+ <xsl:when test="text()='SECAM'">
1775
+ <xsl:value-of select="concat($mbroadstd,'secam')"/>
1776
+ </xsl:when>
1777
+ </xsl:choose>
1778
+ </xsl:when>
1779
+ </xsl:choose>
1780
+ </xsl:when>
1781
+ <xsl:when test="$vTag='347'">
1782
+ <xsl:choose>
1783
+ <xsl:when test="@code='a'">
1784
+ <xsl:choose>
1785
+ <xsl:when test="text()='audio file'">
1786
+ <xsl:value-of select="concat($mfiletype,'audio')"/>
1787
+ </xsl:when>
1788
+ <xsl:when test="text()='data file'">
1789
+ <xsl:value-of select="concat($mfiletype,'data')"/>
1790
+ </xsl:when>
1791
+ <xsl:when test="text()='image file'">
1792
+ <xsl:value-of select="concat($mfiletype,'image')"/>
1793
+ </xsl:when>
1794
+ <xsl:when test="text()='program file'">
1795
+ <xsl:value-of select="concat($mfiletype,'program')"/>
1796
+ </xsl:when>
1797
+ <xsl:when test="text()='text file'">
1798
+ <xsl:value-of select="concat($mfiletype,'text')"/>
1799
+ </xsl:when>
1800
+ <xsl:when test="text()='video file'">
1801
+ <xsl:value-of select="concat($mfiletype,'video')"/>
1802
+ </xsl:when>
1803
+ </xsl:choose>
1804
+ </xsl:when>
1805
+ <xsl:when test="@code='b'">
1806
+ <xsl:variable name="vNormalizedFormat">
1807
+ <xsl:value-of select="normalize-space(translate(translate(normalize-space(.),$upper,$lower),'-',''))"/>
1808
+ </xsl:variable>
1809
+ <xsl:choose>
1810
+ <xsl:when test="contains($vNormalizedFormat,'cd aud')">
1811
+ <xsl:value-of select="concat($mencformat,'cda')"/>
1812
+ </xsl:when>
1813
+ <xsl:when test="contains($vNormalizedFormat,'bluray')">
1814
+ <xsl:value-of select="concat($mencformat,'bluray')"/>
1815
+ </xsl:when>
1816
+ <xsl:when test="contains($vNormalizedFormat,'dvd')">
1817
+ <xsl:value-of select="concat($mencformat,'dvdv')"/>
1818
+ </xsl:when>
1819
+ <xsl:when test="contains($vNormalizedFormat,'sacd')">
1820
+ <xsl:value-of select="concat($mencformat,'sacd')"/>
1821
+ </xsl:when>
1822
+ <xsl:when test="contains($vNormalizedFormat,'mp3')">
1823
+ <xsl:value-of select="concat($mencformat,'mp3')"/>
1824
+ </xsl:when>
1825
+ <xsl:when test="contains($vNormalizedFormat,'pdf')">
1826
+ <xsl:value-of select="concat($mencformat,'pdf')"/>
1827
+ </xsl:when>
1828
+ </xsl:choose>
1829
+ </xsl:when>
1830
+ <xsl:when test="@code='e'">
1831
+ <xsl:choose>
1832
+ <xsl:when test="text()='all regions'">
1833
+ <xsl:value-of select="concat($mregencoding,'all')"/>
1834
+ </xsl:when>
1835
+ <xsl:when test="text()='region 1'">
1836
+ <xsl:value-of select="concat($mregencoding,'region1')"/>
1837
+ </xsl:when>
1838
+ <xsl:when test="text()='region 2'">
1839
+ <xsl:value-of select="concat($mregencoding,'region2')"/>
1840
+ </xsl:when>
1841
+ <xsl:when test="text()='region 3'">
1842
+ <xsl:value-of select="concat($mregencoding,'region3')"/>
1843
+ </xsl:when>
1844
+ <xsl:when test="text()='region 4'">
1845
+ <xsl:value-of select="concat($mregencoding,'region4')"/>
1846
+ </xsl:when>
1847
+ <xsl:when test="text()='region 5'">
1848
+ <xsl:value-of select="concat($mregencoding,'region5')"/>
1849
+ </xsl:when>
1850
+ <xsl:when test="text()='region 6'">
1851
+ <xsl:value-of select="concat($mregencoding,'region6')"/>
1852
+ </xsl:when>
1853
+ <xsl:when test="text()='region 7'">
1854
+ <xsl:value-of select="concat($mregencoding,'region7')"/>
1855
+ </xsl:when>
1856
+ <xsl:when test="text()='region 8'">
1857
+ <xsl:value-of select="concat($mregencoding,'region8')"/>
1858
+ </xsl:when>
1859
+ <xsl:when test="text()='region A'">
1860
+ <xsl:value-of select="concat($mregencoding,'regionA')"/>
1861
+ </xsl:when>
1862
+ <xsl:when test="text()='region B'">
1863
+ <xsl:value-of select="concat($mregencoding,'regionB')"/>
1864
+ </xsl:when>
1865
+ <xsl:when test="text()='region C (Blu-ray)'">
1866
+ <xsl:value-of select="concat($mregencoding,'regionCblu')"/>
1867
+ </xsl:when>
1868
+ <xsl:when test="text()='region C (video game)'">
1869
+ <xsl:value-of select="concat($mregencoding,'regionCgame')"/>
1870
+ </xsl:when>
1871
+ <xsl:when test="text()='region J'">
1872
+ <xsl:value-of select="concat($mregencoding,'regionJ')"/>
1873
+ </xsl:when>
1874
+ <xsl:when test="text()='region U/C'">
1875
+ <xsl:value-of select="concat($mregencoding,'regionU')"/>
1876
+ </xsl:when>
1877
+ </xsl:choose>
1878
+ </xsl:when>
1879
+ </xsl:choose>
1880
+ </xsl:when>
1881
+ <xsl:when test="$vTag='348'">
1882
+ <xsl:if test="@code='a'">
1883
+ <xsl:choose>
1884
+ <xsl:when test="text()='choir book'">
1885
+ <xsl:value-of select="concat($mmusicformat,'choirbk')"/>
1886
+ </xsl:when>
1887
+ <xsl:when test="text()='chorus score'">
1888
+ <xsl:value-of select="concat($mmusicformat,'chscore')"/>
1889
+ </xsl:when>
1890
+ <xsl:when test="text()='condensed score'">
1891
+ <xsl:value-of select="concat($mmusicformat,'conscore')"/>
1892
+ </xsl:when>
1893
+ <xsl:when test="text()='part'">
1894
+ <xsl:value-of select="concat($mmusicformat,'part')"/>
1895
+ </xsl:when>
1896
+ <xsl:when test="text()='piano conductor part'">
1897
+ <xsl:value-of select="concat($mmusicformat,'pianoconpt')"/>
1898
+ </xsl:when>
1899
+ <xsl:when test="text()='piano score'">
1900
+ <xsl:value-of select="concat($mmusicformat,'pianoscore')"/>
1901
+ </xsl:when>
1902
+ <xsl:when test="text()='score'">
1903
+ <xsl:value-of select="concat($mmusicformat,'score')"/>
1904
+ </xsl:when>
1905
+ <xsl:when test="text()='study score'">
1906
+ <xsl:value-of select="concat($mmusicformat,'study score')"/>
1907
+ </xsl:when>
1908
+ <xsl:when test="text()='table book'">
1909
+ <xsl:value-of select="concat($mmusicformat,'tablebk')"/>
1910
+ </xsl:when>
1911
+ <xsl:when test="text()='violin conductor part'">
1912
+ <xsl:value-of select="concat($mmusicformat,'violconpart')"/>
1913
+ </xsl:when>
1914
+ <xsl:when test="text()='vocal score'">
1915
+ <xsl:value-of select="concat($mmusicformat,'vocalscore')"/>
1916
+ </xsl:when>
1917
+ </xsl:choose>
1918
+ </xsl:if>
1919
+ </xsl:when>
1920
+ </xsl:choose>
1921
+ </xsl:variable>
1922
+ <xsl:variable name="vLabel">
1923
+ <xsl:choose>
1924
+ <xsl:when test="$vTag='347' and @code='b'">
1925
+ <xsl:choose>
1926
+ <xsl:when test="$vTarget=concat($mencformat,'bluray')">Blu-ray video</xsl:when>
1927
+ <xsl:when test="$vTarget=concat($mencformat,'dvdv')">DVD video</xsl:when>
1928
+ <xsl:otherwise>
1929
+ <xsl:call-template name="tChopPunct">
1930
+ <xsl:with-param name="pString" select="."/>
1931
+ </xsl:call-template>
1932
+ </xsl:otherwise>
1933
+ </xsl:choose>
1934
+ </xsl:when>
1935
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1936
+ </xsl:choose>
1937
+ </xsl:variable>
1938
+ <xsl:variable name="vObjStringProp">
1939
+ <xsl:choose>
1940
+ <xsl:when test="$vTag='345' and @code='c'">rdf:value</xsl:when>
1941
+ <xsl:otherwise>rdfs:label</xsl:otherwise>
1942
+ </xsl:choose>
1943
+ </xsl:variable>
1944
+ <!-- We need to eliminate duplicates. The second condition looks for a preceding tag with the same value. -->
1945
+ <xsl:if test="$vResource != '' and count(../preceding-sibling::marc:datafield[@tag = $vTag and marc:subfield[. = $vLabel]]) = 0">
1946
+ <xsl:apply-templates select="." mode="generateProperty">
1947
+ <xsl:with-param name="serialization" select="$serialization"/>
1948
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
1949
+ <xsl:with-param name="pProp" select="$vProp"/>
1950
+ <xsl:with-param name="pResource" select="$vResource"/>
1951
+ <xsl:with-param name="pTarget" select="$vTarget"/>
1952
+ <xsl:with-param name="pLabel" select="$vLabel"/>
1953
+ <xsl:with-param name="pObjStringProp" select="$vObjStringProp"/>
1954
+ </xsl:apply-templates>
1955
+ </xsl:if>
1956
+ </xsl:for-each>
1957
+ </xsl:template>
1958
+
1959
+ <!--
1960
+ <xsl:template match="marc:datafield[@tag='350' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='350')]" mode="instance">
1961
+ <xsl:param name="serialization" select="'rdfxml'"/>
1962
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
1963
+ <xsl:choose>
1964
+ <xsl:when test="$serialization = 'rdfxml'">
1965
+ <xsl:for-each select="marc:subfield[@code='a']">
1966
+ <bf:acquisitionSource>
1967
+ <bf:AcquisitionSource>
1968
+ <bf:acquisitionTerms>
1969
+ <xsl:if test="$vXmlLang != ''">
1970
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
1971
+ </xsl:if>
1972
+ <xsl:call-template name="tChopPunct">
1973
+ <xsl:with-param name="pString" select="."/>
1974
+ </xsl:call-template>
1975
+ </bf:acquisitionTerms>
1976
+ </bf:AcquisitionSource>
1977
+ </bf:acquisitionSource>
1978
+ </xsl:for-each>
1979
+ </xsl:when>
1980
+ </xsl:choose>
1981
+ </xsl:template>
1982
+ -->
1983
+
1984
+ <xsl:template match="marc:datafield[@tag='352' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='352')]" mode="instance">
1985
+ <xsl:param name="serialization" select="'rdfxml'"/>
1986
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
1987
+ <xsl:choose>
1988
+ <xsl:when test="$serialization = 'rdfxml'">
1989
+ <xsl:for-each select="marc:subfield[@code='a' or @code='q']">
1990
+ <xsl:variable name="vResource">
1991
+ <xsl:choose>
1992
+ <xsl:when test="@code='a'">bf:CartographicDataType</xsl:when>
1993
+ <xsl:when test="@code='q'">bf:EncodingFormat</xsl:when>
1994
+ </xsl:choose>
1995
+ </xsl:variable>
1996
+ <xsl:variable name="vProcess">
1997
+ <xsl:choose>
1998
+ <xsl:when test="@code='a'">chopPunctuation</xsl:when>
1999
+ <xsl:when test="@code='q'">chopPunctuation</xsl:when>
2000
+ </xsl:choose>
2001
+ </xsl:variable>
2002
+ <xsl:apply-templates select="." mode="generateProperty">
2003
+ <xsl:with-param name="serialization" select="$serialization"/>
2004
+ <xsl:with-param name="pProp">bf:digitalCharacteristic</xsl:with-param>
2005
+ <xsl:with-param name="pResource" select="$vResource"/>
2006
+ <xsl:with-param name="pProcess" select="$vProcess"/>
2007
+ </xsl:apply-templates>
2008
+ </xsl:for-each>
2009
+ <xsl:for-each select="marc:subfield[@code='b']">
2010
+ <bf:digitalCharacteristic>
2011
+ <bf:CartographicObjectType>
2012
+ <rdfs:label>
2013
+ <xsl:if test="$vXmlLang != ''">
2014
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
2015
+ </xsl:if>
2016
+ <xsl:call-template name="tChopPunct">
2017
+ <xsl:with-param name="pString" select="."/>
2018
+ </xsl:call-template>
2019
+ </rdfs:label>
2020
+ <xsl:if test="following-sibling::marc:subfield[position()=1]/@code = 'c'">
2021
+ <bf:count>
2022
+ <xsl:if test="$vXmlLang != ''">
2023
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
2024
+ </xsl:if>
2025
+ <xsl:call-template name="tChopPunct">
2026
+ <xsl:with-param name="pString" select="following-sibling::marc:subfield[position()=1][@code='c']"/>
2027
+ <xsl:with-param name="pChopParens" select="true()"/>
2028
+ </xsl:call-template>
2029
+ </bf:count>
2030
+ </xsl:if>
2031
+ </bf:CartographicObjectType>
2032
+ </bf:digitalCharacteristic>
2033
+ </xsl:for-each>
2034
+ </xsl:when>
2035
+ </xsl:choose>
2036
+ </xsl:template>
2037
+
2038
+ <xsl:template match="marc:datafield[@tag='362' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='362')]" mode="instance">
2039
+ <xsl:param name="serialization" select="'rdfxml'"/>
2040
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
2041
+ <xsl:choose>
2042
+ <xsl:when test="@ind1='0'">
2043
+ <xsl:choose>
2044
+ <!-- process as a note under some conditions -->
2045
+ <xsl:when test="contains(marc:subfield[@code='a'],';')
2046
+ or not(contains(marc:subfield[@code='a'],'-'))">
2047
+ <xsl:call-template name="numberingNote">
2048
+ <xsl:with-param name="serialization" select="$serialization"/>
2049
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2050
+ <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/>
2051
+ </xsl:call-template>
2052
+ </xsl:when>
2053
+ <!-- '=' indicates parallel statements -->
2054
+ <xsl:when test="contains(marc:subfield[@code='a'],'=')">
2055
+ <xsl:choose>
2056
+ <xsl:when test="not(contains(substring-after(marc:subfield[@code='a'],'='),'='))">
2057
+ <xsl:variable name="vStatement1">
2058
+ <xsl:value-of select="normalize-space(substring-before(marc:subfield[@code='a'],'='))"/>
2059
+ </xsl:variable>
2060
+ <xsl:variable name="vStatement2">
2061
+ <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code='a'],'='))"/>
2062
+ </xsl:variable>
2063
+ <!-- first statement -->
2064
+ <xsl:choose>
2065
+ <xsl:when test="contains($vStatement1,'&#x00029;-')">
2066
+ <xsl:call-template name="firstLastIssue">
2067
+ <xsl:with-param name="serialization" select="$serialization"/>
2068
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2069
+ <xsl:with-param name="pFirstIssue" select="concat(substring-before($vStatement1,'&#x00029;-'),'&#x00029;')"/>
2070
+ <xsl:with-param name="pLastIssue" select="substring-after($vStatement1,'&#x00029;-')"/>
2071
+ </xsl:call-template>
2072
+ </xsl:when>
2073
+ <xsl:when test="contains($vStatement1,'-')
2074
+ and not(contains(substring-after($vStatement1,'-'),'-'))">
2075
+ <xsl:call-template name="firstLastIssue">
2076
+ <xsl:with-param name="serialization" select="$serialization"/>
2077
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2078
+ <xsl:with-param name="pFirstIssue" select="substring-before($vStatement1,'-')"/>
2079
+ <xsl:with-param name="pLastIssue" select="substring-after($vStatement1,'-')"/>
2080
+ </xsl:call-template>
2081
+ </xsl:when>
2082
+ <xsl:otherwise>
2083
+ <xsl:call-template name="numberingNote">
2084
+ <xsl:with-param name="serialization" select="$serialization"/>
2085
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2086
+ <xsl:with-param name="pNote" select="$vStatement1"/>
2087
+ </xsl:call-template>
2088
+ </xsl:otherwise>
2089
+ </xsl:choose>
2090
+ <!-- second statement -->
2091
+ <xsl:choose>
2092
+ <xsl:when test="contains($vStatement2,'&#x00029;-')">
2093
+ <xsl:call-template name="firstLastIssue">
2094
+ <xsl:with-param name="serialization" select="$serialization"/>
2095
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2096
+ <xsl:with-param name="pFirstIssue" select="concat(substring-before($vStatement2,'&#x00029;-'),'&#x00029;')"/>
2097
+ <xsl:with-param name="pLastIssue" select="substring-after($vStatement2,'&#x00029;-')"/>
2098
+ </xsl:call-template>
2099
+ </xsl:when>
2100
+ <xsl:when test="contains($vStatement2,'-')
2101
+ and not(contains(substring-after($vStatement2,'-'),'-'))">
2102
+ <xsl:call-template name="firstLastIssue">
2103
+ <xsl:with-param name="serialization" select="$serialization"/>
2104
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2105
+ <xsl:with-param name="pFirstIssue" select="substring-before($vStatement2,'-')"/>
2106
+ <xsl:with-param name="pLastIssue" select="substring-after($vStatement2,'-')"/>
2107
+ </xsl:call-template>
2108
+ </xsl:when>
2109
+ <xsl:otherwise>
2110
+ <xsl:call-template name="numberingNote">
2111
+ <xsl:with-param name="serialization" select="$serialization"/>
2112
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2113
+ <xsl:with-param name="pNote" select="$vStatement2"/>
2114
+ </xsl:call-template>
2115
+ </xsl:otherwise>
2116
+ </xsl:choose>
2117
+ </xsl:when>
2118
+ <xsl:otherwise>
2119
+ <xsl:call-template name="numberingNote">
2120
+ <xsl:with-param name="serialization" select="$serialization"/>
2121
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2122
+ <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/>
2123
+ </xsl:call-template>
2124
+ </xsl:otherwise>
2125
+ </xsl:choose>
2126
+ </xsl:when>
2127
+ <!-- ')-' as split between first/last -->
2128
+ <xsl:when test="contains(marc:subfield[@code='a'],'&#x00029;-')">
2129
+ <xsl:call-template name="firstLastIssue">
2130
+ <xsl:with-param name="serialization" select="$serialization"/>
2131
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2132
+ <xsl:with-param name="pFirstIssue" select="concat(substring-before(marc:subfield[@code='a'],'&#x00029;-'),'&#x00029;')"/>
2133
+ <xsl:with-param name="pLastIssue" select="substring-after(marc:subfield[@code='a'],'&#x00029;-')"/>
2134
+ </xsl:call-template>
2135
+ </xsl:when>
2136
+ <!-- more than one hyphen, too hard to parse -->
2137
+ <xsl:when test="contains(substring-after(marc:subfield[@code='a'],'-'),'-')">
2138
+ <xsl:call-template name="numberingNote">
2139
+ <xsl:with-param name="serialization" select="$serialization"/>
2140
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2141
+ <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/>
2142
+ </xsl:call-template>
2143
+ </xsl:when>
2144
+ <!-- the standard case (one hyphen, not parallel) -->
2145
+ <xsl:otherwise>
2146
+ <xsl:call-template name="firstLastIssue">
2147
+ <xsl:with-param name="serialization" select="$serialization"/>
2148
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2149
+ <xsl:with-param name="pFirstIssue" select="substring-before(marc:subfield[@code='a'],'-')"/>
2150
+ <xsl:with-param name="pLastIssue" select="substring-after(marc:subfield[@code='a'],'-')"/>
2151
+ </xsl:call-template>
2152
+ </xsl:otherwise>
2153
+ </xsl:choose>
2154
+ </xsl:when>
2155
+ <xsl:otherwise>
2156
+ <xsl:call-template name="numberingNote">
2157
+ <xsl:with-param name="serialization" select="$serialization"/>
2158
+ <xsl:with-param name="pXmlLang" select="$vXmlLang"/>
2159
+ <xsl:with-param name="pNote" select="marc:subfield[@code='a']/text()"/>
2160
+ </xsl:call-template>
2161
+ </xsl:otherwise>
2162
+ </xsl:choose>
2163
+ </xsl:template>
2164
+
2165
+ <xsl:template name="numberingNote">
2166
+ <xsl:param name="serialization" select="'rdfxml'"/>
2167
+ <xsl:param name="pXmlLang"/>
2168
+ <xsl:param name="pNote"/>
2169
+ <xsl:choose>
2170
+ <xsl:when test="$serialization='rdfxml'">
2171
+ <bf:note>
2172
+ <bf:Note>
2173
+ <rdf:type>
2174
+ <xsl:attribute name="rdf:resource">http://id.loc.gov/vocabulary/mnotetype/number</xsl:attribute>
2175
+ </rdf:type>
2176
+ <rdfs:label>
2177
+ <xsl:if test="$pXmlLang != ''">
2178
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute>
2179
+ </xsl:if>
2180
+ <xsl:value-of select="$pNote"/>
2181
+ </rdfs:label>
2182
+ </bf:Note>
2183
+ </bf:note>
2184
+ </xsl:when>
2185
+ </xsl:choose>
2186
+ </xsl:template>
2187
+
2188
+ <xsl:template name="firstLastIssue">
2189
+ <xsl:param name="serialization" select="'rdfxml'"/>
2190
+ <xsl:param name="pXmlLang"/>
2191
+ <xsl:param name="pFirstIssue"/>
2192
+ <xsl:param name="pLastIssue"/>
2193
+ <xsl:if test="$pFirstIssue != ''">
2194
+ <xsl:choose>
2195
+ <xsl:when test="$serialization='rdfxml'">
2196
+ <bf:firstIssue>
2197
+ <xsl:if test="$pXmlLang != ''">
2198
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute>
2199
+ </xsl:if>
2200
+ <xsl:call-template name="tChopPunct">
2201
+ <xsl:with-param name="pString" select="$pFirstIssue"/>
2202
+ </xsl:call-template>
2203
+ </bf:firstIssue>
2204
+ </xsl:when>
2205
+ </xsl:choose>
2206
+ </xsl:if>
2207
+ <xsl:if test="$pLastIssue != ''">
2208
+ <xsl:choose>
2209
+ <xsl:when test="$serialization='rdfxml'">
2210
+ <bf:lastIssue>
2211
+ <xsl:if test="$pXmlLang != ''">
2212
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute>
2213
+ </xsl:if>
2214
+ <xsl:call-template name="tChopPunct">
2215
+ <xsl:with-param name="pString" select="$pLastIssue"/>
2216
+ </xsl:call-template>
2217
+ </bf:lastIssue>
2218
+ </xsl:when>
2219
+ </xsl:choose>
2220
+ </xsl:if>
2221
+ </xsl:template>
2222
+
2223
+ <!-- generate a list of URIs from MARC 33X -->
2224
+ <xsl:template match="marc:record" mode="mURI33X">
2225
+ <xsl:param name="pTag"/>
2226
+ <xsl:param name="pCode" select="'b'"/>
2227
+ <xsl:param name="pStem"/>
2228
+ <xsl:variable name="vURIList">
2229
+ <xsl:for-each select="marc:datafield[@tag=$pTag]">
2230
+ <xsl:for-each select="marc:subfield[@code=$pCode]">
2231
+ <xsl:variable name="vEncoded">
2232
+ <xsl:call-template name="url-encode">
2233
+ <xsl:with-param name="str" select="normalize-space(.)"/>
2234
+ </xsl:call-template>
2235
+ </xsl:variable>
2236
+ <xsl:if test="$vEncoded != ''">
2237
+ <xsl:value-of select="concat($pStem,$vEncoded,' ')"/>
2238
+ </xsl:if>
2239
+ </xsl:for-each>
2240
+ </xsl:for-each>
2241
+ </xsl:variable>
2242
+ <xsl:value-of select="normalize-space($vURIList)"/>
2243
+ </xsl:template>
2244
+
2245
+ </xsl:stylesheet>