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,328 @@
1
+ <?xml version='1.0'?>
2
+ <xsl:stylesheet version="1.0"
3
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
5
+ xmlns:marc="http://www.loc.gov/MARC21/slim"
6
+ xmlns:bf="http://id.loc.gov/ontologies/bibframe/"
7
+ xmlns:bflc="http://id.loc.gov/ontologies/bflc/"
8
+ xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#"
9
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10
+ exclude-result-prefixes="xsl marc">
11
+
12
+ <!--
13
+ Conversion specs for 841-887
14
+ -->
15
+
16
+ <xsl:template match="marc:datafield[@tag='856' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='856')]" mode="work">
17
+ <xsl:param name="recordid"/>
18
+ <xsl:param name="pPosition" select="position()"/>
19
+ <xsl:param name="serialization" select="'rdfxml'"/>
20
+ <xsl:apply-templates select="." mode="work856">
21
+ <xsl:with-param name="recordid" select="$recordid"/>
22
+ <xsl:with-param name="serialization" select="$serialization"/>
23
+ <xsl:with-param name="pTagOrd" select="$pPosition"/>
24
+ </xsl:apply-templates>
25
+ </xsl:template>
26
+
27
+ <!-- 859 is a local field at LoC -->
28
+ <xsl:template match="marc:datafield[@tag='859' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='859')]" mode="work">
29
+ <xsl:param name="recordid"/>
30
+ <xsl:param name="pPosition" select="position()"/>
31
+ <xsl:param name="serialization" select="'rdfxml'"/>
32
+ <xsl:if test="$localfields">
33
+ <xsl:apply-templates select="." mode="work856">
34
+ <xsl:with-param name="recordid" select="$recordid"/>
35
+ <xsl:with-param name="serialization" select="$serialization"/>
36
+ <xsl:with-param name="pTagOrd" select="$pPosition"/>
37
+ </xsl:apply-templates>
38
+ </xsl:if>
39
+ </xsl:template>
40
+
41
+ <xsl:template match="marc:datafield" mode="work856">
42
+ <xsl:param name="recordid"/>
43
+ <xsl:param name="serialization" select="'rdfxml'"/>
44
+ <xsl:param name="pTagOrd" select="position()"/>
45
+ <xsl:variable name="theU" select="marc:subfield[@code='u']" />
46
+ <!-- only process if there is $u -->
47
+ <xsl:if test="marc:subfield[@code='u']">
48
+ <!-- lower case for comparison -->
49
+ <xsl:variable name="vSubfieldA" select="translate(normalize-space(marc:subfield[@code='a'][1]),$upper,$lower)"/>
50
+ <xsl:variable name="vSubfield3" select="translate(normalize-space(marc:subfield[@code='3'][1]),$upper,$lower)"/>
51
+ <xsl:choose>
52
+ <xsl:when test="contains($vSubfieldA, 'table of contents') or contains($vSubfield3, 'table of contents')">
53
+ <xsl:choose>
54
+ <xsl:when test="$serialization='rdfxml'">
55
+ <xsl:for-each select="marc:subfield[@code='u']">
56
+ <bf:tableOfContents>
57
+ <xsl:attribute name="rdf:resource">
58
+ <xsl:call-template name="url-encode">
59
+ <xsl:with-param name="str" select="."/>
60
+ </xsl:call-template>
61
+ </xsl:attribute>
62
+ </bf:tableOfContents>
63
+ </xsl:for-each>
64
+ </xsl:when>
65
+ </xsl:choose>
66
+ </xsl:when>
67
+ <!-- If ind2 is #, 0, 1, or 8 and the Instance does not have the class of Electronic, create a new Instance -->
68
+ <xsl:when test="(@ind2=' ' or @ind2='0' or @ind2='1' or @ind2='8') and
69
+ (substring(../marc:leader,7,1) != 'm' and
70
+ substring(../marc:controlfield[@tag='008'],24,1) != 'o' and
71
+ substring(../marc:controlfield[@tag='008'],24,1) != 's') and
72
+ count($exclusions/exclusions/exclusion/@text[contains($theU, .)]) = 0">
73
+ <xsl:variable name="vInstanceUri"><xsl:value-of select="$recordid"/>#Instance<xsl:value-of select="@tag"/>-<xsl:value-of select="$pTagOrd"/></xsl:variable>
74
+ <xsl:choose>
75
+ <xsl:when test="$serialization = 'rdfxml'">
76
+ <bf:hasInstance>
77
+ <bf:Instance>
78
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vInstanceUri"/></xsl:attribute>
79
+ <rdf:type>
80
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="concat($bf,'Electronic')"/></xsl:attribute>
81
+ </rdf:type>
82
+ <xsl:choose>
83
+ <xsl:when test="marc:subfield[@code='3']">
84
+ <bf:title>
85
+ <bf:Title>
86
+ <bf:mainTitle><xsl:value-of select="marc:subfield[@code='3']"/></bf:mainTitle>
87
+ </bf:Title>
88
+ </bf:title>
89
+ </xsl:when>
90
+ <xsl:when test="../marc:datafield[@tag='245']">
91
+ <bf:title>
92
+ <bf:Title>
93
+ <xsl:apply-templates mode="title245" select="../marc:datafield[@tag='245']">
94
+ <xsl:with-param name="serialization" select="$serialization"/>
95
+ <xsl:with-param name="label">
96
+ <xsl:apply-templates mode="concat-nodes-space"
97
+ select="../marc:datafield[@tag='245']/marc:subfield[@code='a' or
98
+ @code='b' or
99
+ @code='f' or
100
+ @code='g' or
101
+ @code='k' or
102
+ @code='n' or
103
+ @code='p' or
104
+ @code='s']"/>
105
+ </xsl:with-param>
106
+ </xsl:apply-templates>
107
+ </bf:Title>
108
+ </bf:title>
109
+ </xsl:when>
110
+ </xsl:choose>
111
+
112
+ <xsl:apply-templates select="." mode="locator856">
113
+ <xsl:with-param name="serialization" select="$serialization"/>
114
+ <xsl:with-param name="pProp">bf:electronicLocator</xsl:with-param>
115
+ </xsl:apply-templates>
116
+ <bf:instanceOf>
117
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$recordid"/>#Work</xsl:attribute>
118
+ </bf:instanceOf>
119
+ </bf:Instance>
120
+ </bf:hasInstance>
121
+ </xsl:when>
122
+ </xsl:choose>
123
+ </xsl:when>
124
+ </xsl:choose>
125
+ </xsl:if>
126
+ </xsl:template>
127
+
128
+ <xsl:template match="marc:datafield[@tag='856' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='856')]" mode="instance">
129
+ <xsl:param name="serialization" select="'rdfxml'"/>
130
+ <xsl:param name="pInstanceType" />
131
+ <xsl:apply-templates select="." mode="instance856">
132
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
133
+ <xsl:with-param name="serialization" select="$serialization"/>
134
+ </xsl:apply-templates>
135
+ </xsl:template>
136
+
137
+ <!-- 859 is a local field at LoC -->
138
+ <xsl:template match="marc:datafield[@tag='859' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='859')]" mode="instance">
139
+ <xsl:param name="pInstanceType" />
140
+ <xsl:param name="serialization" select="'rdfxml'"/>
141
+ <xsl:if test="$localfields">
142
+ <xsl:apply-templates select="." mode="instance856">
143
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
144
+ <xsl:with-param name="serialization" select="$serialization"/>
145
+ </xsl:apply-templates>
146
+ </xsl:if>
147
+ </xsl:template>
148
+
149
+ <xsl:template match="marc:datafield" mode="instance856">
150
+ <xsl:param name="pInstanceType" />
151
+ <xsl:param name="serialization" select="'rdfxml'"/>
152
+ <xsl:variable name="vSubfieldA" select="translate(normalize-space(marc:subfield[@code='a'][1]),$upper,$lower)"/>
153
+ <xsl:variable name="vSubfield3" select="translate(normalize-space(marc:subfield[@code='3'][1]),$upper,$lower)"/>
154
+ <xsl:if test="$serialization = 'rdfxml' and marc:subfield[@code='u']">
155
+ <xsl:choose>
156
+ <!-- If ind2 is #, 0, 1, or 8 and the Instance does not have the class of Electronic, create a new Instance -->
157
+ <!--
158
+ The check for a 758 here is to sniff if this is a Split MARC record.
159
+ That is, this MARC record is a slim one that will become a secondary Instance.
160
+ But records that have round-tripped will have a 758, not to mention who else sticks stuff in a 758.
161
+ And then there will be some records that do not have a 758, but will nonetheless have am 856
162
+ that needs to be converted.
163
+ -->
164
+ <xsl:when test="(@ind2=' ' or @ind2='0' or @ind2='1' or @ind2='8') and
165
+ $pInstanceType = 'SecondaryInstance'">
166
+ <xsl:choose>
167
+ <xsl:when test="marc:subfield[@code='3']">
168
+ <bf:title>
169
+ <bf:Title>
170
+ <bf:mainTitle><xsl:value-of select="marc:subfield[@code='3']"/></bf:mainTitle>
171
+ </bf:Title>
172
+ </bf:title>
173
+ </xsl:when>
174
+ <xsl:when test="../marc:datafield[@tag='245']">
175
+ <bf:title>
176
+ <bf:Title>
177
+ <xsl:apply-templates mode="title245" select="../marc:datafield[@tag='245']">
178
+ <xsl:with-param name="serialization" select="$serialization"/>
179
+ <xsl:with-param name="label">
180
+ <xsl:apply-templates mode="concat-nodes-space"
181
+ select="../marc:datafield[@tag='245']/marc:subfield[@code='a' or
182
+ @code='b' or
183
+ @code='f' or
184
+ @code='g' or
185
+ @code='k' or
186
+ @code='n' or
187
+ @code='p' or
188
+ @code='s']"/>
189
+ </xsl:with-param>
190
+ </xsl:apply-templates>
191
+ </bf:Title>
192
+ </bf:title>
193
+ </xsl:when>
194
+ </xsl:choose>
195
+ <xsl:apply-templates select="." mode="locator856" />
196
+ </xsl:when>
197
+ <xsl:when test="(@ind2=' ' or @ind2='0' or @ind2='1' or @ind2='8') and not(contains($vSubfieldA, 'table of contents')) and not(contains($vSubfield3, 'table of contents'))">
198
+ <xsl:apply-templates select="." mode="locator856" />
199
+ </xsl:when>
200
+ <xsl:when test="@ind2='2' and not(contains($vSubfieldA, 'table of contents')) and not(contains($vSubfield3, 'table of contents'))">
201
+ <xsl:apply-templates select="." mode="locator856">
202
+ <xsl:with-param name="serialization" select="$serialization"/>
203
+ <xsl:with-param name="pProp">bf:supplementaryContent</xsl:with-param>
204
+ <xsl:with-param name="pObject">bf:SupplementaryContent</xsl:with-param>
205
+ </xsl:apply-templates>
206
+ </xsl:when>
207
+ </xsl:choose>
208
+ </xsl:if>
209
+ </xsl:template>
210
+
211
+ <xsl:template match="marc:datafield[@tag='856' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='856')]" mode="hasItem">
212
+ <xsl:param name="recordid"/>
213
+ <xsl:param name="pPosition" select="position()"/>
214
+ <xsl:param name="serialization" select="'rdfxml'"/>
215
+ <xsl:apply-templates select="." mode="hasItem856">
216
+ <xsl:with-param name="recordid" select="$recordid"/>
217
+ <xsl:with-param name="serialization" select="$serialization"/>
218
+ <xsl:with-param name="pTagOrd" select="$pPosition"/>
219
+ </xsl:apply-templates>
220
+ </xsl:template>
221
+
222
+ <!-- 859 is a local field at LoC -->
223
+ <xsl:template match="marc:datafield[@tag='859' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='859')]" mode="hasItem">
224
+ <xsl:param name="recordid"/>
225
+ <xsl:param name="pPosition" select="position()"/>
226
+ <xsl:param name="serialization" select="'rdfxml'"/>
227
+ <xsl:if test="$localfields">
228
+ <xsl:apply-templates select="." mode="hasItem856">
229
+ <xsl:with-param name="recordid" select="$recordid"/>
230
+ <xsl:with-param name="serialization" select="$serialization"/>
231
+ <xsl:with-param name="pTagOrd" select="$pPosition"/>
232
+ </xsl:apply-templates>
233
+ </xsl:if>
234
+ </xsl:template>
235
+
236
+ <xsl:template match="marc:datafield" mode="hasItem856">
237
+ <xsl:param name="recordid"/>
238
+ <xsl:param name="serialization" select="'rdfxml'"/>
239
+ <xsl:param name="pTagOrd" select="position()"/>
240
+ <xsl:variable name="vSubfieldA" select="translate(normalize-space(marc:subfield[@code='a'][1]),$upper,$lower)"/>
241
+ <xsl:variable name="vSubfield3" select="translate(normalize-space(marc:subfield[@code='3'][1]),$upper,$lower)"/>
242
+ <!-- If ind2 is #, 0, 1, or 8, the Instance has the class of Electronic, and $3 != 'Table of Contents', add an Item to the Instance -->
243
+ <xsl:if test="not(../marc:datafield[@tag='758']) and
244
+ marc:subfield[@code='u'] and
245
+ (@ind2=' ' or @ind2='1' or @ind2='8' or (@ind2='0' and count(../marc:datafield[@tag='856']) &gt; 1)) and
246
+ (substring(../marc:leader,7,1) = 'm' or
247
+ substring(../marc:controlfield[@tag='008'],24,1) = 'o' or
248
+ substring(../marc:controlfield[@tag='008'],24,1) = 's') and
249
+ not(contains($vSubfieldA, 'table of contents')) and
250
+ not(contains($vSubfield3, 'table of contents'))">
251
+ <xsl:variable name="vItemUri"><xsl:value-of select="$recordid"/>#Item<xsl:value-of select="@tag"/>-<xsl:value-of select="$pTagOrd"/></xsl:variable>
252
+ <xsl:choose>
253
+ <xsl:when test="$serialization = 'rdfxml'">
254
+ <bf:hasItem>
255
+ <bf:Item>
256
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$vItemUri"/></xsl:attribute>
257
+ <xsl:apply-templates select="." mode="locator856">
258
+ <xsl:with-param name="serialization" select="$serialization"/>
259
+ <xsl:with-param name="pProp">bf:electronicLocator</xsl:with-param>
260
+ </xsl:apply-templates>
261
+ <bf:itemOf>
262
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$recordid"/>#Instance</xsl:attribute>
263
+ </bf:itemOf>
264
+ </bf:Item>
265
+ </bf:hasItem>
266
+ </xsl:when>
267
+ </xsl:choose>
268
+ </xsl:if>
269
+ </xsl:template>
270
+
271
+ <xsl:template match="marc:datafield" mode="locator856">
272
+ <xsl:param name="serialization" select="'rdfxml'"/>
273
+ <xsl:param name="pProp" select="'bf:electronicLocator'"/>
274
+ <xsl:param name="pObject" select="'rdfs:Resource'"/>
275
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
276
+ <xsl:choose>
277
+ <xsl:when test="$serialization='rdfxml'">
278
+ <xsl:for-each select="marc:subfield[@code='u']">
279
+ <xsl:choose>
280
+ <xsl:when test="$pProp = 'bf:electronicLocator'">
281
+ <xsl:element name="{$pProp}">
282
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="."/></xsl:attribute>
283
+ </xsl:element>
284
+ <xsl:for-each select="../marc:subfield[@code='z' or @code='y']">
285
+ <bf:note>
286
+ <bf:Note>
287
+ <rdfs:label>
288
+ <xsl:if test="$vXmlLang != ''">
289
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
290
+ </xsl:if>
291
+ <xsl:call-template name="tChopPunct">
292
+ <xsl:with-param name="pString" select="."/>
293
+ </xsl:call-template>
294
+ </rdfs:label>
295
+ </bf:Note>
296
+ </bf:note>
297
+ </xsl:for-each>
298
+ </xsl:when>
299
+ <xsl:otherwise>
300
+ <xsl:element name="{$pProp}">
301
+ <xsl:element name="{$pObject}">
302
+ <bf:electronicLocator>
303
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="."/></xsl:attribute>
304
+ </bf:electronicLocator>
305
+ <xsl:for-each select="../marc:subfield[@code='3' or @code='z' or @code='y']">
306
+ <bf:note>
307
+ <bf:Note>
308
+ <rdfs:label>
309
+ <xsl:if test="$vXmlLang != ''">
310
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
311
+ </xsl:if>
312
+ <xsl:call-template name="tChopPunct">
313
+ <xsl:with-param name="pString" select="."/>
314
+ </xsl:call-template>
315
+ </rdfs:label>
316
+ </bf:Note>
317
+ </bf:note>
318
+ </xsl:for-each>
319
+ </xsl:element>
320
+ </xsl:element>
321
+ </xsl:otherwise>
322
+ </xsl:choose>
323
+ </xsl:for-each>
324
+ </xsl:when>
325
+ </xsl:choose>
326
+ </xsl:template>
327
+
328
+ </xsl:stylesheet>
@@ -0,0 +1,119 @@
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:xsl="http://www.w3.org/1999/XSL/Transform"
9
+ xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#"
10
+ exclude-result-prefixes="xsl marc">
11
+
12
+ <!--
13
+ Conversion specs for handling 880 fields
14
+ -->
15
+
16
+ <xsl:template match="*" mode="mProcessAdminMetadata880">
17
+ <xsl:param name="serialization" select="'rdfxml'"/>
18
+ <xsl:variable name="vProcess">
19
+ <xsl:call-template name="tProcess"/>
20
+ </xsl:variable>
21
+ <xsl:if test="$vProcess='true'">
22
+ <xsl:apply-templates select="." mode="adminmetadata">
23
+ <xsl:with-param name="serialization" select="$serialization"/>
24
+ </xsl:apply-templates>
25
+ </xsl:if>
26
+ </xsl:template>
27
+
28
+ <xsl:template match="*" mode="mProcessWork880">
29
+ <xsl:param name="serialization" select="'rdfxml'"/>
30
+ <xsl:param name="recordid"/>
31
+ <xsl:param name="pAgentIri"/>
32
+ <xsl:param name="pInstanceType"/>
33
+ <xsl:variable name="vProcess">
34
+ <xsl:call-template name="tProcess"/>
35
+ </xsl:variable>
36
+ <xsl:if test="$vProcess='true'">
37
+ <xsl:apply-templates select="." mode="work">
38
+ <xsl:with-param name="serialization" select="$serialization"/>
39
+ <xsl:with-param name="recordid" select="$recordid"/>
40
+ <xsl:with-param name="pPosition" select="position()"/>
41
+ <xsl:with-param name="pAgentIri" select="$pAgentIri"/>
42
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
43
+ </xsl:apply-templates>
44
+ </xsl:if>
45
+ </xsl:template>
46
+
47
+ <xsl:template match="*" mode="mProcessInstance880">
48
+ <xsl:param name="serialization" select="'rdfxml'"/>
49
+ <xsl:param name="recordid"/>
50
+ <xsl:param name="pInstanceType"/>
51
+ <xsl:variable name="vProcess">
52
+ <xsl:call-template name="tProcess"/>
53
+ </xsl:variable>
54
+ <xsl:if test="$vProcess='true'">
55
+ <xsl:apply-templates select="." mode="instance">
56
+ <xsl:with-param name="serialization" select="$serialization"/>
57
+ <xsl:with-param name="recordid" select="$recordid"/>
58
+ <xsl:with-param name="pInstanceType" select="$pInstanceType"/>
59
+ <xsl:with-param name="pPosition" select="position()"/>
60
+ </xsl:apply-templates>
61
+ </xsl:if>
62
+ </xsl:template>
63
+
64
+ <xsl:template match="*" mode="mProcessItem880">
65
+ <xsl:param name="serialization" select="'rdfxml'"/>
66
+ <xsl:param name="recordid"/>
67
+ <xsl:variable name="vProcess">
68
+ <xsl:call-template name="tProcess"/>
69
+ </xsl:variable>
70
+ <xsl:if test="$vProcess='true'">
71
+ <xsl:apply-templates select="." mode="item">
72
+ <xsl:with-param name="recordid" select="$recordid"/>
73
+ <xsl:with-param name="serialization" select="$serialization"/>
74
+ <xsl:with-param name="pPosition" select="position()"/>
75
+ </xsl:apply-templates>
76
+ </xsl:if>
77
+ </xsl:template>
78
+
79
+ <!-- return true() if field should be processed based on 880/$6 processing specs -->
80
+ <!-- context is a leader, controlfield, or datafield node -->
81
+ <xsl:template name="tProcess">
82
+ <xsl:variable name="vTag">
83
+ <xsl:choose>
84
+ <xsl:when test="@tag='880'">
85
+ <xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/>
86
+ </xsl:when>
87
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
88
+ </xsl:choose>
89
+ </xsl:variable>
90
+ <xsl:variable name="vOccurrence">
91
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
92
+ </xsl:variable>
93
+ <xsl:choose>
94
+ <xsl:when test="name()='leader' or name()='controlfield'">
95
+ <xsl:value-of select="true()"/>
96
+ </xsl:when>
97
+ <xsl:when test="not(marc:subfield[@code='6'])">
98
+ <xsl:value-of select="true()"/>
99
+ </xsl:when>
100
+ <xsl:when test="not($map880/datafields/datafield[@tag=$vTag])">
101
+ <xsl:value-of select="true()"/>
102
+ </xsl:when>
103
+ <xsl:when test="@tag != '880' and not(../marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrence])">
104
+ <xsl:value-of select="true()"/>
105
+ </xsl:when>
106
+ <xsl:when test="@tag='880' and not(../marc:datafield[@tag=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrence])">
107
+ <xsl:value-of select="true()"/>
108
+ </xsl:when>
109
+ <xsl:when test="@tag != '880' and $map880/datafields/datafield[@tag=$vTag]/@convertLinked='false'">
110
+ <xsl:value-of select="true()"/>
111
+ </xsl:when>
112
+ <xsl:when test="@tag='880' and $map880/datafields/datafield[@tag=$vTag]/@convertLinked='true'">
113
+ <xsl:value-of select="true()"/>
114
+ </xsl:when>
115
+ <xsl:otherwise><xsl:value-of select="false()"/></xsl:otherwise>
116
+ </xsl:choose>
117
+ </xsl:template>
118
+
119
+ </xsl:stylesheet>