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.
- checksums.yaml +4 -4
- data/README.md +24 -2
- data/docs/superpowers/plans/2026-09-09-marc-conversion.md +537 -0
- data/docs/superpowers/specs/2026-09-09-marc-conversion-design.md +110 -0
- data/lib/bibframe_ruby/marc_converter.rb +67 -0
- data/lib/bibframe_ruby/parser.rb +4 -2
- data/lib/bibframe_ruby/version.rb +1 -1
- data/lib/bibframe_ruby.rb +7 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-001-007.xsl +2276 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-006,008.xsl +1295 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-010-048.xsl +1712 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-050-088.xsl +713 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-1XX,7XX,8XX-names.xsl +1141 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-200-247not240-Titles.xsl +771 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-240andX30-UnifTitle.xsl +535 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-250-270.xsl +283 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-3XX.xsl +2245 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-460-468-SeriesTreat.xsl +135 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-490-510-Links.xsl +145 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-5XX.xsl +1448 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-600-662.xsl +1417 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-720+740to755.xsl +333 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-758.xsl +102 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-760-788-Links.xsl +771 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-841-887.xsl +328 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-880.xsl +119 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-ControlSubfields.xsl +495 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-LDR.xsl +183 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-Preprocess0-Splitting.xsl +765 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-Process6-Series.xsl +627 -0
- data/vendor/marc2bibframe2/xsl/ConvSpec-Process8-ProvAct.xsl +1021 -0
- data/vendor/marc2bibframe2/xsl/conf/abbreviations.xml +13 -0
- data/vendor/marc2bibframe2/xsl/conf/code-to-script.xml +399 -0
- data/vendor/marc2bibframe2/xsl/conf/codeMaps.xml +723 -0
- data/vendor/marc2bibframe2/xsl/conf/exclusions.xml +4 -0
- data/vendor/marc2bibframe2/xsl/conf/iso6392-to-1.xml +615 -0
- data/vendor/marc2bibframe2/xsl/conf/languageCrosswalk.xml +1503 -0
- data/vendor/marc2bibframe2/xsl/conf/map880.xml +175 -0
- data/vendor/marc2bibframe2/xsl/conf/scriptCrosswalk.xml +210 -0
- data/vendor/marc2bibframe2/xsl/conf/subjectThesaurus.xml +29 -0
- data/vendor/marc2bibframe2/xsl/marc2bibframe2.xsl +610 -0
- data/vendor/marc2bibframe2/xsl/naco-normalize.xsl +205 -0
- data/vendor/marc2bibframe2/xsl/utils.xsl +963 -0
- data/vendor/marc2bibframe2/xsl/variables.xsl +108 -0
- metadata +68 -1
|
@@ -0,0 +1,535 @@
|
|
|
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 Uniform Titles
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
<!-- bf:Work properties from Uniform Title fields -->
|
|
17
|
+
<xsl:template match="marc:datafield[@tag='130' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='130')] |
|
|
18
|
+
marc:datafield[@tag='240' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='240')]"
|
|
19
|
+
mode="work">
|
|
20
|
+
<xsl:param name="recordid"/>
|
|
21
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
22
|
+
<xsl:param name="pPosition" select="position()"/>
|
|
23
|
+
<xsl:param name="pInstanceType"/>
|
|
24
|
+
<!-- For MTA Hub records, process title directly on Work entity, otherwise create stub Hub entity -->
|
|
25
|
+
<xsl:choose>
|
|
26
|
+
<xsl:when test="$pInstanceType='Hub'">
|
|
27
|
+
<xsl:apply-templates mode="hubUnifTitle" select=".">
|
|
28
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
29
|
+
<xsl:with-param name="pInstanceType" select="$pInstanceType"/>
|
|
30
|
+
</xsl:apply-templates>
|
|
31
|
+
</xsl:when>
|
|
32
|
+
<xsl:otherwise>
|
|
33
|
+
<xsl:variable name="vHubIri">
|
|
34
|
+
<xsl:apply-templates mode="generateUri" select=".">
|
|
35
|
+
<xsl:with-param name="pDefaultUri"><xsl:value-of select="$recordid"/>#Hub<xsl:value-of select="@tag"/>-<xsl:value-of select="$pPosition"/></xsl:with-param>
|
|
36
|
+
<xsl:with-param name="pEntity">bf:Hub</xsl:with-param>
|
|
37
|
+
</xsl:apply-templates>
|
|
38
|
+
</xsl:variable>
|
|
39
|
+
<xsl:choose>
|
|
40
|
+
<xsl:when test="$serialization='rdfxml'">
|
|
41
|
+
<bf:expressionOf>
|
|
42
|
+
<bf:Hub>
|
|
43
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$vHubIri"/></xsl:attribute>
|
|
44
|
+
<xsl:apply-templates mode="hubUnifTitle" select=".">
|
|
45
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
46
|
+
<xsl:with-param name="pHubIri" select="$vHubIri"/>
|
|
47
|
+
</xsl:apply-templates>
|
|
48
|
+
</bf:Hub>
|
|
49
|
+
</bf:expressionOf>
|
|
50
|
+
</xsl:when>
|
|
51
|
+
</xsl:choose>
|
|
52
|
+
</xsl:otherwise>
|
|
53
|
+
</xsl:choose>
|
|
54
|
+
</xsl:template>
|
|
55
|
+
|
|
56
|
+
<!-- Processing for 630 tags in ConvSpec-600-662.xsl -->
|
|
57
|
+
|
|
58
|
+
<xsl:template match="marc:datafield[@tag='730' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='730')]"
|
|
59
|
+
mode="work">
|
|
60
|
+
<xsl:param name="recordid"/>
|
|
61
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
62
|
+
<xsl:param name="pPosition" select="position()"/>
|
|
63
|
+
<xsl:param name="pHasItem" select="false()"/>
|
|
64
|
+
<!-- note special $5 processing for LoC below -->
|
|
65
|
+
<xsl:if test="$pHasItem or not($localfields and marc:subfield[@code='5'])">
|
|
66
|
+
<xsl:variable name="vHubIri">
|
|
67
|
+
<xsl:apply-templates mode="generateUri" select=".">
|
|
68
|
+
<xsl:with-param name="pDefaultUri"><xsl:value-of select="$recordid"/>#Hub<xsl:value-of select="@tag"/>-<xsl:value-of select="$pPosition"/></xsl:with-param>
|
|
69
|
+
<xsl:with-param name="pEntity">bf:Hub</xsl:with-param>
|
|
70
|
+
</xsl:apply-templates>
|
|
71
|
+
</xsl:variable>
|
|
72
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
73
|
+
<xsl:variable name="vProp">
|
|
74
|
+
<xsl:choose>
|
|
75
|
+
<xsl:when test="@ind2='2' and count(marc:subfield[@code='i'])=0">http://id.loc.gov/vocabulary/relationship/part</xsl:when>
|
|
76
|
+
<xsl:when test="@ind2='2' and contains(marc:subfield[@code='i'], 'ontainer of')">http://id.loc.gov/vocabulary/relationship/part</xsl:when>
|
|
77
|
+
<xsl:when test="@ind2='2' and contains(marc:subfield[@code='i'], 'ontains')">http://id.loc.gov/vocabulary/relationship/part</xsl:when>
|
|
78
|
+
<xsl:when test="@ind2='4' and count(marc:subfield[@code='i'])=0">http://id.loc.gov/ontologies/bflc/hasVariantEntry</xsl:when>
|
|
79
|
+
<xsl:when test="@ind2=' ' and marc:subfield[@code='i']='is arrangement of'">http://id.loc.gov/vocabulary/relationship/arrangementof</xsl:when>
|
|
80
|
+
<xsl:when test="@ind2=' ' and marc:subfield[@code='i']='is translation of'">http://id.loc.gov/vocabulary/relationship/translationof</xsl:when>
|
|
81
|
+
<xsl:otherwise>http://id.loc.gov/vocabulary/relationship/relatedwork</xsl:otherwise>
|
|
82
|
+
</xsl:choose>
|
|
83
|
+
</xsl:variable>
|
|
84
|
+
<xsl:choose>
|
|
85
|
+
<xsl:when test="$serialization = 'rdfxml'">
|
|
86
|
+
<bf:relation>
|
|
87
|
+
<bf:Relation>
|
|
88
|
+
<bf:relationship>
|
|
89
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="$vProp"/></xsl:attribute>
|
|
90
|
+
</bf:relationship>
|
|
91
|
+
<xsl:for-each select="marc:subfield[@code='i' and
|
|
92
|
+
not(contains(., 'ontainer of')) and
|
|
93
|
+
not(contains(., 'ontains')) and
|
|
94
|
+
. !='is arrangement of' and
|
|
95
|
+
. !='is translation of']">
|
|
96
|
+
<bf:relationship>
|
|
97
|
+
<bf:Relationship>
|
|
98
|
+
<rdfs:label>
|
|
99
|
+
<xsl:if test="$vXmlLang != ''">
|
|
100
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
|
|
101
|
+
</xsl:if>
|
|
102
|
+
<xsl:call-template name="tChopPunct">
|
|
103
|
+
<xsl:with-param name="pString" select="."/>
|
|
104
|
+
</xsl:call-template>
|
|
105
|
+
</rdfs:label>
|
|
106
|
+
</bf:Relationship>
|
|
107
|
+
</bf:relationship>
|
|
108
|
+
</xsl:for-each>
|
|
109
|
+
<bf:associatedResource>
|
|
110
|
+
<bf:Hub>
|
|
111
|
+
<xsl:attribute name="rdf:about"><xsl:value-of select="$vHubIri"/></xsl:attribute>
|
|
112
|
+
<xsl:apply-templates select="." mode="hubUnifTitle">
|
|
113
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
114
|
+
<xsl:with-param name="pHubIri" select="$vHubIri"/>
|
|
115
|
+
</xsl:apply-templates>
|
|
116
|
+
</bf:Hub>
|
|
117
|
+
</bf:associatedResource>
|
|
118
|
+
</bf:Relation>
|
|
119
|
+
</bf:relation>
|
|
120
|
+
|
|
121
|
+
</xsl:when>
|
|
122
|
+
</xsl:choose>
|
|
123
|
+
</xsl:if>
|
|
124
|
+
</xsl:template>
|
|
125
|
+
|
|
126
|
+
<!-- Processing for 830/440 tags in ConvSpec-Process6-Series.xsl -->
|
|
127
|
+
|
|
128
|
+
<!-- can be applied by templates above or by name/subject templates -->
|
|
129
|
+
<xsl:template match="marc:datafield" mode="hubUnifTitle">
|
|
130
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
131
|
+
<xsl:param name="pHubIri"/>
|
|
132
|
+
<xsl:param name="pSource"/>
|
|
133
|
+
<xsl:param name="pLabel"/>
|
|
134
|
+
<xsl:param name="pInstanceType"/>
|
|
135
|
+
<xsl:variable name="tag">
|
|
136
|
+
<xsl:choose>
|
|
137
|
+
<xsl:when test="@tag=880">
|
|
138
|
+
<xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/>
|
|
139
|
+
</xsl:when>
|
|
140
|
+
<xsl:otherwise>
|
|
141
|
+
<xsl:value-of select="@tag"/>
|
|
142
|
+
</xsl:otherwise>
|
|
143
|
+
</xsl:choose>
|
|
144
|
+
</xsl:variable>
|
|
145
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
146
|
+
<xsl:variable name="label">
|
|
147
|
+
<!-- 8XX fields construct the label differently, prefer the passed-in parameter -->
|
|
148
|
+
<xsl:choose>
|
|
149
|
+
<xsl:when test="$pLabel != ''"><xsl:value-of select="$pLabel"/></xsl:when>
|
|
150
|
+
<xsl:otherwise>
|
|
151
|
+
<xsl:apply-templates select="." mode="tTitleLabel"/>
|
|
152
|
+
</xsl:otherwise>
|
|
153
|
+
</xsl:choose>
|
|
154
|
+
</xsl:variable>
|
|
155
|
+
<xsl:choose>
|
|
156
|
+
<xsl:when test="$serialization = 'rdfxml'">
|
|
157
|
+
<xsl:if test="marc:subfield[@code='o']">
|
|
158
|
+
<rdf:type>
|
|
159
|
+
<xsl:attribute name="rdf:resource"><xsl:value-of select="concat($bf,'Arrangement')"/></xsl:attribute>
|
|
160
|
+
</rdf:type>
|
|
161
|
+
</xsl:if>
|
|
162
|
+
<xsl:if test="$tag='240' and $pInstanceType != 'Hub'">
|
|
163
|
+
<xsl:apply-templates select="../marc:datafield[@tag='100' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='100')] |
|
|
164
|
+
../marc:datafield[@tag='110' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='110')] |
|
|
165
|
+
../marc:datafield[@tag='111' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='111')]"
|
|
166
|
+
mode="mProcessWork880">
|
|
167
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
168
|
+
<xsl:with-param name="pAgentIri" select="concat($pHubIri,'-Agent')"/>
|
|
169
|
+
</xsl:apply-templates>
|
|
170
|
+
</xsl:if>
|
|
171
|
+
<bf:title>
|
|
172
|
+
<xsl:apply-templates mode="titleUnifTitle" select=".">
|
|
173
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
174
|
+
<xsl:with-param name="label" select="$label"/>
|
|
175
|
+
</xsl:apply-templates>
|
|
176
|
+
</bf:title>
|
|
177
|
+
<xsl:choose>
|
|
178
|
+
<xsl:when test="substring($tag,2,2='10')">
|
|
179
|
+
<xsl:for-each select="marc:subfield[@code='t']/following-sibling::marc:subfield[@code='d']">
|
|
180
|
+
<bf:legalDate>
|
|
181
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
182
|
+
<xsl:with-param name="pSFCode" select="'d'" />
|
|
183
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
184
|
+
</xsl:apply-templates>
|
|
185
|
+
<xsl:call-template name="tChopPunct">
|
|
186
|
+
<xsl:with-param name="pString" select="."/>
|
|
187
|
+
<xsl:with-param name="pChopParens" select="true()"/>
|
|
188
|
+
</xsl:call-template>
|
|
189
|
+
</bf:legalDate>
|
|
190
|
+
</xsl:for-each>
|
|
191
|
+
</xsl:when>
|
|
192
|
+
<xsl:when test="substring($tag,2,2)='30' or substring($tag,2,2)='40'">
|
|
193
|
+
<xsl:for-each select="marc:subfield[@code='d']">
|
|
194
|
+
<bf:legalDate>
|
|
195
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
196
|
+
<xsl:with-param name="pSFCode" select="'d'" />
|
|
197
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
198
|
+
</xsl:apply-templates>
|
|
199
|
+
<xsl:call-template name="tChopPunct">
|
|
200
|
+
<xsl:with-param name="pString" select="."/>
|
|
201
|
+
<xsl:with-param name="pChopParens" select="true()"/>
|
|
202
|
+
</xsl:call-template>
|
|
203
|
+
</bf:legalDate>
|
|
204
|
+
</xsl:for-each>
|
|
205
|
+
</xsl:when>
|
|
206
|
+
</xsl:choose>
|
|
207
|
+
<xsl:for-each select="marc:subfield[@code='f']">
|
|
208
|
+
<bf:originDate>
|
|
209
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
210
|
+
<xsl:with-param name="pSFCode" select="'f'" />
|
|
211
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
212
|
+
</xsl:apply-templates>
|
|
213
|
+
<xsl:call-template name="tChopPunct">
|
|
214
|
+
<xsl:with-param name="pString" select="."/>
|
|
215
|
+
</xsl:call-template>
|
|
216
|
+
</bf:originDate>
|
|
217
|
+
</xsl:for-each>
|
|
218
|
+
<xsl:if test="not(ancestor::marc:record/marc:datafield[@tag = '377']) or $pInstanceType != 'Hub'">
|
|
219
|
+
<xsl:for-each select="marc:subfield[@code='l']">
|
|
220
|
+
<bf:language>
|
|
221
|
+
<bf:Language>
|
|
222
|
+
<rdfs:label>
|
|
223
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
224
|
+
<xsl:with-param name="pSFCode" select="'l'" />
|
|
225
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
226
|
+
</xsl:apply-templates>
|
|
227
|
+
<xsl:call-template name="tChopPunct">
|
|
228
|
+
<xsl:with-param name="pString" select="."/>
|
|
229
|
+
</xsl:call-template>
|
|
230
|
+
</rdfs:label>
|
|
231
|
+
</bf:Language>
|
|
232
|
+
</bf:language>
|
|
233
|
+
</xsl:for-each>
|
|
234
|
+
</xsl:if>
|
|
235
|
+
<xsl:for-each select="marc:subfield[@code='m']">
|
|
236
|
+
<bf:musicMedium>
|
|
237
|
+
<bf:MusicMedium>
|
|
238
|
+
<rdfs:label>
|
|
239
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
240
|
+
<xsl:with-param name="pSFCode" select="'m'" />
|
|
241
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
242
|
+
</xsl:apply-templates>
|
|
243
|
+
<xsl:call-template name="tChopPunct">
|
|
244
|
+
<xsl:with-param name="pString" select="."/>
|
|
245
|
+
</xsl:call-template>
|
|
246
|
+
</rdfs:label>
|
|
247
|
+
</bf:MusicMedium>
|
|
248
|
+
</bf:musicMedium>
|
|
249
|
+
</xsl:for-each>
|
|
250
|
+
<xsl:for-each select="marc:subfield[@code='r']">
|
|
251
|
+
<bf:keyMode>
|
|
252
|
+
<bf:KeyMode>
|
|
253
|
+
<rdfs:label>
|
|
254
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
255
|
+
<xsl:with-param name="pSFCode" select="'r'" />
|
|
256
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
257
|
+
</xsl:apply-templates>
|
|
258
|
+
<xsl:call-template name="tChopPunct">
|
|
259
|
+
<xsl:with-param name="pString" select="."/>
|
|
260
|
+
</xsl:call-template>
|
|
261
|
+
</rdfs:label>
|
|
262
|
+
</bf:KeyMode>
|
|
263
|
+
</bf:keyMode>
|
|
264
|
+
</xsl:for-each>
|
|
265
|
+
<xsl:for-each select="marc:subfield[@code='s']">
|
|
266
|
+
<bf:version>
|
|
267
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
268
|
+
<xsl:with-param name="pSFCode" select="'s'" />
|
|
269
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
270
|
+
</xsl:apply-templates>
|
|
271
|
+
<xsl:call-template name="tChopPunct">
|
|
272
|
+
<xsl:with-param name="pString" select="."/>
|
|
273
|
+
</xsl:call-template>
|
|
274
|
+
</bf:version>
|
|
275
|
+
</xsl:for-each>
|
|
276
|
+
<xsl:if test="substring($tag,1,1)='7'"> <!-- $x processed in ConvSpec-Process for 8XX -->
|
|
277
|
+
<xsl:for-each select="marc:subfield[@code='x']">
|
|
278
|
+
<bf:identifiedBy>
|
|
279
|
+
<bf:Issn>
|
|
280
|
+
<rdf:value>
|
|
281
|
+
<xsl:call-template name="tChopPunct">
|
|
282
|
+
<xsl:with-param name="pString" select="."/>
|
|
283
|
+
</xsl:call-template>
|
|
284
|
+
</rdf:value>
|
|
285
|
+
</bf:Issn>
|
|
286
|
+
</bf:identifiedBy>
|
|
287
|
+
</xsl:for-each>
|
|
288
|
+
</xsl:if>
|
|
289
|
+
<xsl:if test="substring($tag,2,2)='30' or $tag='240' or marc:subfield[@code='t']">
|
|
290
|
+
<xsl:choose>
|
|
291
|
+
<xsl:when test="marc:subfield[@code='t']">
|
|
292
|
+
<xsl:for-each select="marc:subfield[@code='t']/following-sibling::marc:subfield[@code='0'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
|
|
293
|
+
<xsl:if test="position() != 1">
|
|
294
|
+
<xsl:apply-templates mode="subfield0orw" select=".">
|
|
295
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
296
|
+
</xsl:apply-templates>
|
|
297
|
+
</xsl:if>
|
|
298
|
+
</xsl:for-each>
|
|
299
|
+
<xsl:for-each select="marc:subfield[@code='t']/following-sibling::marc:subfield[@code='0']">
|
|
300
|
+
<xsl:if test="substring(text(),1,5) != '(uri)' and substring(text(),1,4) != 'http'">
|
|
301
|
+
<xsl:apply-templates mode="subfield0orw" select=".">
|
|
302
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
303
|
+
</xsl:apply-templates>
|
|
304
|
+
</xsl:if>
|
|
305
|
+
</xsl:for-each>
|
|
306
|
+
</xsl:when>
|
|
307
|
+
<xsl:otherwise>
|
|
308
|
+
<xsl:for-each select="marc:subfield[@code='0'][starts-with(text(),'(uri)') or starts-with(text(),'http')]">
|
|
309
|
+
<xsl:if test="position() != 1">
|
|
310
|
+
<xsl:apply-templates mode="subfield0orw" select=".">
|
|
311
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
312
|
+
</xsl:apply-templates>
|
|
313
|
+
</xsl:if>
|
|
314
|
+
</xsl:for-each>
|
|
315
|
+
<xsl:for-each select="marc:subfield[@code='0']">
|
|
316
|
+
<xsl:if test="substring(text(),1,5) != '(uri)' and substring(text(),1,4) != 'http'">
|
|
317
|
+
<xsl:apply-templates mode="subfield0orw" select=".">
|
|
318
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
319
|
+
</xsl:apply-templates>
|
|
320
|
+
</xsl:if>
|
|
321
|
+
</xsl:for-each>
|
|
322
|
+
</xsl:otherwise>
|
|
323
|
+
</xsl:choose>
|
|
324
|
+
<xsl:choose>
|
|
325
|
+
<xsl:when test="$pSource != ''">
|
|
326
|
+
<xsl:copy-of select="$pSource"/>
|
|
327
|
+
</xsl:when>
|
|
328
|
+
<xsl:otherwise>
|
|
329
|
+
<xsl:apply-templates mode="subfield2" select="marc:subfield[@code='2']">
|
|
330
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
331
|
+
</xsl:apply-templates>
|
|
332
|
+
</xsl:otherwise>
|
|
333
|
+
</xsl:choose>
|
|
334
|
+
<xsl:apply-templates mode="subfield3" select="marc:subfield[@code='3']">
|
|
335
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
336
|
+
</xsl:apply-templates>
|
|
337
|
+
<xsl:apply-templates mode="subfield5" select="marc:subfield[@code='5']">
|
|
338
|
+
<xsl:with-param name="serialization" select="$serialization"/>
|
|
339
|
+
</xsl:apply-templates>
|
|
340
|
+
</xsl:if>
|
|
341
|
+
|
|
342
|
+
<!-- marcKey -->
|
|
343
|
+
<xsl:variable name="v880Occurrence" select="substring(substring-after(marc:subfield[@code = '6'], '-'), 1, 2)" />
|
|
344
|
+
<xsl:variable name="v880Ref" select="concat($tag, '-', $v880Occurrence)" />
|
|
345
|
+
<xsl:variable name="related880" select="ancestor::marc:record/marc:datafield[@tag='880' and $v880Occurrence != '00' and marc:subfield[@code='6' and substring(., 1, 6)=$v880Ref]]"/>
|
|
346
|
+
<xsl:variable name="vXmlLang880"><xsl:apply-templates select="$related880" mode="xmllang"/></xsl:variable>
|
|
347
|
+
|
|
348
|
+
<xsl:choose>
|
|
349
|
+
<xsl:when test="$tag='240'">
|
|
350
|
+
<xsl:variable name="vDF1xx" select="../marc:datafield[starts-with(@tag, '1')]" />
|
|
351
|
+
<xsl:variable name="vMarcKey1XX"><xsl:apply-templates select="$vDF1xx" mode="marcKey"/></xsl:variable>
|
|
352
|
+
<xsl:variable name="vMarcKey240"><xsl:apply-templates select="." mode="marcKey"/></xsl:variable>
|
|
353
|
+
<bflc:marcKey><xsl:value-of select="concat($vMarcKey1XX, '$t', substring-after($vMarcKey240, '$a'))" /></bflc:marcKey>
|
|
354
|
+
<xsl:if test="$vXmlLang880 != ''">
|
|
355
|
+
<xsl:variable name="v880-1XX" select="../marc:datafield[@tag='880' and marc:subfield[@code='6' and starts-with(., '1')]]" />
|
|
356
|
+
<xsl:variable name="v880-1XX-marcKey"><xsl:apply-templates select="$v880-1XX" mode="marcKey"/></xsl:variable>
|
|
357
|
+
<xsl:variable name="vMarcKey880"><xsl:apply-templates select="$related880" mode="marcKey"/></xsl:variable>
|
|
358
|
+
<bflc:marcKey>
|
|
359
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang880"/></xsl:attribute>
|
|
360
|
+
<xsl:value-of select="concat($v880-1XX-marcKey, '$t', substring-after($vMarcKey880, '$a'))" />
|
|
361
|
+
</bflc:marcKey>
|
|
362
|
+
</xsl:if>
|
|
363
|
+
</xsl:when>
|
|
364
|
+
<xsl:when test="$tag='110' or $tag='100' or $tag='111'">
|
|
365
|
+
<xsl:variable name="vMarcKey1XX"><xsl:apply-templates select="." mode="marcKey"/></xsl:variable>
|
|
366
|
+
<bflc:marcKey><xsl:value-of select="concat(substring-before($vMarcKey1XX, '$k'), '$t', substring-after($vMarcKey1XX, '$k'))" /></bflc:marcKey>
|
|
367
|
+
<xsl:if test="$vXmlLang880 != ''">
|
|
368
|
+
<xsl:variable name="vMarcKey880"><xsl:apply-templates select="$related880" mode="marcKey"/></xsl:variable>
|
|
369
|
+
<bflc:marcKey>
|
|
370
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang880"/></xsl:attribute>
|
|
371
|
+
<xsl:value-of select="concat(substring-before($vMarcKey880, '$k'), '$t', substring-after($vMarcKey880, '$k'))" />
|
|
372
|
+
</bflc:marcKey>
|
|
373
|
+
</xsl:if>
|
|
374
|
+
</xsl:when>
|
|
375
|
+
<xsl:otherwise>
|
|
376
|
+
<bflc:marcKey><xsl:apply-templates select="." mode="marcKey"/></bflc:marcKey>
|
|
377
|
+
<xsl:if test="$vXmlLang880 != ''">
|
|
378
|
+
<bflc:marcKey>
|
|
379
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang880"/></xsl:attribute>
|
|
380
|
+
<xsl:apply-templates select="$related880" mode="marcKey"/>
|
|
381
|
+
</bflc:marcKey>
|
|
382
|
+
</xsl:if>
|
|
383
|
+
</xsl:otherwise>
|
|
384
|
+
</xsl:choose>
|
|
385
|
+
|
|
386
|
+
</xsl:when>
|
|
387
|
+
</xsl:choose>
|
|
388
|
+
</xsl:template>
|
|
389
|
+
|
|
390
|
+
<!-- build a bf:Title entity -->
|
|
391
|
+
<xsl:template match="marc:datafield" mode="titleUnifTitle">
|
|
392
|
+
<xsl:param name="serialization" select="'rdfxml'"/>
|
|
393
|
+
<xsl:param name="label"/>
|
|
394
|
+
<xsl:variable name="tag">
|
|
395
|
+
<xsl:choose>
|
|
396
|
+
<xsl:when test="@tag=880">
|
|
397
|
+
<xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/>
|
|
398
|
+
</xsl:when>
|
|
399
|
+
<xsl:otherwise>
|
|
400
|
+
<xsl:value-of select="@tag"/>
|
|
401
|
+
</xsl:otherwise>
|
|
402
|
+
</xsl:choose>
|
|
403
|
+
</xsl:variable>
|
|
404
|
+
|
|
405
|
+
<xsl:variable name="v880Occurrence" select="substring(substring-after(marc:subfield[@code = '6'], '-'), 1, 2)" />
|
|
406
|
+
<xsl:variable name="v880Ref" select="concat($tag, '-', $v880Occurrence)" />
|
|
407
|
+
<xsl:variable name="related880" select="ancestor::marc:record/marc:datafield[@tag='880' and $v880Occurrence != '00' and marc:subfield[@code='6' and substring(., 1, 6)=$v880Ref]]"/>
|
|
408
|
+
<xsl:variable name="vXmlLang880"><xsl:apply-templates select="$related880" mode="xmllang"/></xsl:variable>
|
|
409
|
+
|
|
410
|
+
<xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
|
|
411
|
+
<xsl:variable name="nfi">
|
|
412
|
+
<xsl:choose>
|
|
413
|
+
<xsl:when test="($tag='130' or $tag='630' or $tag='730') and @ind1 != ' '">
|
|
414
|
+
<xsl:value-of select="@ind1"/>
|
|
415
|
+
</xsl:when>
|
|
416
|
+
<xsl:when test="($tag='240' or $tag='830' or $tag='440') and @ind2 != ' '">
|
|
417
|
+
<xsl:value-of select="@ind2"/>
|
|
418
|
+
</xsl:when>
|
|
419
|
+
<xsl:otherwise>0</xsl:otherwise>
|
|
420
|
+
</xsl:choose>
|
|
421
|
+
</xsl:variable>
|
|
422
|
+
<xsl:choose>
|
|
423
|
+
<xsl:when test="$serialization = 'rdfxml'">
|
|
424
|
+
<bf:Title>
|
|
425
|
+
<xsl:if test="$nfi != 0">
|
|
426
|
+
<bflc:nonSortNum>
|
|
427
|
+
<xsl:if test="$vXmlLang != ''">
|
|
428
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
|
|
429
|
+
</xsl:if>
|
|
430
|
+
<xsl:value-of select="$nfi" />
|
|
431
|
+
</bflc:nonSortNum>
|
|
432
|
+
</xsl:if>
|
|
433
|
+
<bf:mainTitle>
|
|
434
|
+
<xsl:if test="$vXmlLang != ''">
|
|
435
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
|
|
436
|
+
</xsl:if>
|
|
437
|
+
<xsl:call-template name="tChopPunct">
|
|
438
|
+
<xsl:with-param name="pString" select="$label"/>
|
|
439
|
+
</xsl:call-template>
|
|
440
|
+
</bf:mainTitle>
|
|
441
|
+
<xsl:if test="$vXmlLang880 != ''">
|
|
442
|
+
<bf:mainTitle>
|
|
443
|
+
<xsl:if test="$vXmlLang880 != ''">
|
|
444
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang880"/></xsl:attribute>
|
|
445
|
+
</xsl:if>
|
|
446
|
+
<xsl:call-template name="tChopPunct">
|
|
447
|
+
<xsl:with-param name="pString">
|
|
448
|
+
<xsl:apply-templates select="$related880" mode="tTitleLabel"/>
|
|
449
|
+
</xsl:with-param>
|
|
450
|
+
</xsl:call-template>
|
|
451
|
+
</bf:mainTitle>
|
|
452
|
+
</xsl:if>
|
|
453
|
+
<xsl:choose>
|
|
454
|
+
<xsl:when test="substring($tag,2,2) = '11'">
|
|
455
|
+
<xsl:for-each select="marc:subfield[@code='t']/following-sibling::marc:subfield[@code='n']">
|
|
456
|
+
<bf:partNumber>
|
|
457
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
458
|
+
<xsl:with-param name="pSFCode" select="'n'" />
|
|
459
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
460
|
+
</xsl:apply-templates>
|
|
461
|
+
<xsl:call-template name="tChopPunct">
|
|
462
|
+
<xsl:with-param name="pString" select="."/>
|
|
463
|
+
</xsl:call-template>
|
|
464
|
+
</bf:partNumber>
|
|
465
|
+
</xsl:for-each>
|
|
466
|
+
</xsl:when>
|
|
467
|
+
<xsl:otherwise>
|
|
468
|
+
<xsl:for-each select="marc:subfield[@code='n']">
|
|
469
|
+
<bf:partNumber>
|
|
470
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
471
|
+
<xsl:with-param name="pSFCode" select="'n'" />
|
|
472
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
473
|
+
</xsl:apply-templates>
|
|
474
|
+
<xsl:call-template name="tChopPunct">
|
|
475
|
+
<xsl:with-param name="pString" select="."/>
|
|
476
|
+
</xsl:call-template>
|
|
477
|
+
</bf:partNumber>
|
|
478
|
+
</xsl:for-each>
|
|
479
|
+
</xsl:otherwise>
|
|
480
|
+
</xsl:choose>
|
|
481
|
+
<xsl:for-each select="marc:subfield[@code='p']">
|
|
482
|
+
<bf:partName>
|
|
483
|
+
<xsl:apply-templates select="ancestor::marc:datafield" mode="xmllang-attribute">
|
|
484
|
+
<xsl:with-param name="pSFCode" select="'p'" />
|
|
485
|
+
<xsl:with-param name="pXMLlang" select="$vXmlLang" />
|
|
486
|
+
</xsl:apply-templates>
|
|
487
|
+
<xsl:call-template name="tChopPunct">
|
|
488
|
+
<xsl:with-param name="pString" select="."/>
|
|
489
|
+
</xsl:call-template>
|
|
490
|
+
</bf:partName>
|
|
491
|
+
</xsl:for-each>
|
|
492
|
+
</bf:Title>
|
|
493
|
+
</xsl:when>
|
|
494
|
+
</xsl:choose>
|
|
495
|
+
</xsl:template>
|
|
496
|
+
|
|
497
|
+
<!-- can be applied by templates above or by name/subject templates -->
|
|
498
|
+
<xsl:template match="marc:datafield" mode="tTitleLabel">
|
|
499
|
+
<xsl:variable name="tag">
|
|
500
|
+
<xsl:choose>
|
|
501
|
+
<xsl:when test="@tag=880">
|
|
502
|
+
<xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/>
|
|
503
|
+
</xsl:when>
|
|
504
|
+
<xsl:otherwise>
|
|
505
|
+
<xsl:value-of select="@tag"/>
|
|
506
|
+
</xsl:otherwise>
|
|
507
|
+
</xsl:choose>
|
|
508
|
+
</xsl:variable>
|
|
509
|
+
<xsl:choose>
|
|
510
|
+
<xsl:when test="(
|
|
511
|
+
substring($tag,2,2)='00' or
|
|
512
|
+
substring($tag,2,2)='10' or
|
|
513
|
+
substring($tag,2,2)='11'
|
|
514
|
+
)">
|
|
515
|
+
<xsl:choose>
|
|
516
|
+
<xsl:when test="marc:subfield[@code='t']">
|
|
517
|
+
<xsl:apply-templates mode="concat-nodes-space"
|
|
518
|
+
select="marc:subfield[@code='t'] |
|
|
519
|
+
marc:subfield[@code='t']/following-sibling::marc:subfield[not(contains('ivwxyz012345678',@code))]"/>
|
|
520
|
+
</xsl:when>
|
|
521
|
+
<xsl:when test="marc:subfield[@code='k']">
|
|
522
|
+
<xsl:apply-templates mode="concat-nodes-space"
|
|
523
|
+
select="marc:subfield[@code='k'] |
|
|
524
|
+
marc:subfield[@code='k']/following-sibling::marc:subfield[not(contains('ivwxyz012345678',@code))]"/>
|
|
525
|
+
</xsl:when>
|
|
526
|
+
</xsl:choose>
|
|
527
|
+
</xsl:when>
|
|
528
|
+
<xsl:otherwise>
|
|
529
|
+
<xsl:apply-templates mode="concat-nodes-space"
|
|
530
|
+
select="marc:subfield[not(contains('ivwxyz012345678',@code))]"/>
|
|
531
|
+
</xsl:otherwise>
|
|
532
|
+
</xsl:choose>
|
|
533
|
+
</xsl:template>
|
|
534
|
+
|
|
535
|
+
</xsl:stylesheet>
|