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,771 @@
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 760-788
14
+ -->
15
+
16
+
17
+ <xsl:template match="marc:datafield[@tag='760' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='760') and contains(marc:subfield[@code='6'], '-00')] |
18
+ marc:datafield[@tag='762' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='762') and contains(marc:subfield[@code='6'], '-00')] |
19
+ marc:datafield[@tag='765' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='765') and contains(marc:subfield[@code='6'], '-00')] |
20
+ marc:datafield[@tag='767' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='767') and contains(marc:subfield[@code='6'], '-00')] |
21
+ marc:datafield[@tag='770' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='770') and contains(marc:subfield[@code='6'], '-00')] |
22
+ marc:datafield[@tag='772' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='772') and contains(marc:subfield[@code='6'], '-00')] |
23
+ marc:datafield[@tag='773' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='773') and contains(marc:subfield[@code='6'], '-00')] |
24
+ marc:datafield[@tag='774' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='774') and contains(marc:subfield[@code='6'], '-00')] |
25
+ marc:datafield[@tag='775' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='775') and contains(marc:subfield[@code='6'], '-00')] |
26
+ marc:datafield[@tag='776' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='776') and contains(marc:subfield[@code='6'], '-00')] |
27
+ marc:datafield[@tag='777' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='777') and contains(marc:subfield[@code='6'], '-00')] |
28
+ marc:datafield[
29
+ (@tag='780' and @ind2='4' and not(preceding-sibling::marc:datafield[1][@tag='780' and @ind2='4'])) or
30
+ (@tag='780' and @ind2!='4') or
31
+ (@tag='880' and substring(marc:subfield[@code='6'],1,3)='780') and contains(marc:subfield[@code='6'], '-00')] |
32
+ marc:datafield[
33
+ (@tag='785' and @ind2='6' and not(preceding-sibling::marc:datafield[1][@tag='785' and @ind2='6'])) or
34
+ (@tag='785' and @ind2='7' and not(preceding-sibling::marc:datafield[1][@tag='785' and @ind2='7'])) or
35
+ (@tag='785' and @ind2!='6' and @ind2!='7') or
36
+ (@tag='880' and substring(marc:subfield[@code='6'],1,3)='785') and contains(marc:subfield[@code='6'], '-00')] |
37
+ marc:datafield[@tag='786' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='786') and contains(marc:subfield[@code='6'], '-00')] |
38
+ marc:datafield[@tag='787' or (@tag='880' and substring(marc:subfield[@code='6'],1,3)='787') and contains(marc:subfield[@code='6'], '-00')]"
39
+ mode="work">
40
+ <xsl:param name="recordid"/>
41
+ <xsl:param name="pPosition" select="position()"/>
42
+ <xsl:param name="serialization" select="'rdfxml'"/>
43
+ <xsl:variable name="vWorkUri"><xsl:value-of select="$recordid"/>#Work<xsl:value-of select="@tag"/>-<xsl:value-of select="$pPosition"/></xsl:variable>
44
+ <xsl:variable name="vInstanceUri"><xsl:value-of select="$recordid"/>#Instance<xsl:value-of select="@tag"/>-<xsl:value-of select="$pPosition"/></xsl:variable>
45
+ <xsl:variable name="vTag">
46
+ <xsl:choose>
47
+ <xsl:when test="@tag='880'"><xsl:value-of select="substring(marc:subfield[@code='6'],1,3)"/></xsl:when>
48
+ <xsl:otherwise><xsl:value-of select="@tag"/></xsl:otherwise>
49
+ </xsl:choose>
50
+ </xsl:variable>
51
+
52
+ <xsl:variable name="vProperty">
53
+ <xsl:choose>
54
+ <xsl:when test="$vTag='760'">http://id.loc.gov/vocabulary/relationship/series</xsl:when>
55
+ <xsl:when test="$vTag='762'">http://id.loc.gov/vocabulary/relationship/subseries</xsl:when>
56
+ <xsl:when test="$vTag='765'">http://id.loc.gov/vocabulary/relationship/translationof</xsl:when>
57
+ <xsl:when test="$vTag='767'">http://id.loc.gov/vocabulary/relationship/translatedas</xsl:when>
58
+ <xsl:when test="$vTag='770'">http://id.loc.gov/vocabulary/relationship/supplement</xsl:when>
59
+ <xsl:when test="$vTag='772'">http://id.loc.gov/vocabulary/relationship/supplementto</xsl:when>
60
+ <xsl:when test="$vTag='773'">http://id.loc.gov/vocabulary/relationship/partof</xsl:when>
61
+ <xsl:when test="$vTag='774'">http://id.loc.gov/vocabulary/relationship/part</xsl:when>
62
+ <xsl:when test="$vTag='775'">http://id.loc.gov/vocabulary/relationship/otheredition</xsl:when>
63
+ <xsl:when test="$vTag='776'">http://id.loc.gov/vocabulary/relationship/otherphysicalformat</xsl:when>
64
+ <xsl:when test="$vTag='777'">http://id.loc.gov/vocabulary/relationship/issuedwith</xsl:when>
65
+ <xsl:when test="$vTag='780'">
66
+ <xsl:choose>
67
+ <xsl:when test="@ind2='0'">http://id.loc.gov/vocabulary/relationship/continuationof</xsl:when>
68
+ <xsl:when test="@ind2='1'">http://id.loc.gov/vocabulary/relationship/continuedinpart</xsl:when>
69
+ <xsl:when test="@ind2='4'">http://id.loc.gov/vocabulary/relationship/mergerof</xsl:when>
70
+ <xsl:when test="@ind2='5' or @ind2='6'">http://id.loc.gov/vocabulary/relationship/absorptionof</xsl:when>
71
+ <xsl:when test="@ind2='7'">http://id.loc.gov/vocabulary/relationship/separatedfrom</xsl:when>
72
+ <xsl:otherwise>http://id.loc.gov/vocabulary/relationship/precededby</xsl:otherwise>
73
+ </xsl:choose>
74
+ </xsl:when>
75
+ <xsl:when test="$vTag='785'">
76
+ <xsl:choose>
77
+ <xsl:when test="@ind2='0' or @ind2='8'">http://id.loc.gov/vocabulary/relationship/continuedby</xsl:when>
78
+ <xsl:when test="@ind2='1'">http://id.loc.gov/vocabulary/relationship/continuedinpartby</xsl:when>
79
+ <xsl:when test="@ind2='4' or @ind2='5'">http://id.loc.gov/vocabulary/relationship/absorbedby</xsl:when>
80
+ <xsl:when test="@ind2='6'">http://id.loc.gov/vocabulary/relationship/splitinto</xsl:when>
81
+ <xsl:when test="@ind2='7'">http://id.loc.gov/vocabulary/relationship/mergedtoform</xsl:when>
82
+ <xsl:otherwise>http://id.loc.gov/vocabulary/relationship/succeededby</xsl:otherwise>
83
+ </xsl:choose>
84
+ </xsl:when>
85
+ <xsl:when test="$vTag='786'">http://id.loc.gov/vocabulary/relationship/datasource</xsl:when>
86
+ <xsl:when test="$vTag='787'">http://id.loc.gov/vocabulary/relationship/relatedwork</xsl:when>
87
+ </xsl:choose>
88
+ </xsl:variable>
89
+ <xsl:variable name="vElement">bf:Work</xsl:variable>
90
+ <xsl:variable name="vElementUri"><xsl:value-of select="$vWorkUri"/></xsl:variable>
91
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
92
+
93
+ <xsl:variable name="vOccurrence">
94
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
95
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
96
+ </xsl:if>
97
+ </xsl:variable>
98
+ <xsl:variable name="vRelated880" select="../marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrence]" />
99
+ <xsl:variable name="v880XmlLang"><xsl:apply-templates select="$vRelated880" mode="xmllang"/></xsl:variable>
100
+
101
+ <xsl:variable name="v8" select="marc:subfield[@code='8']"/>
102
+ <!--
103
+ if http://id.loc.gov/vocabulary/relationship/mergedtoform
104
+ then we need to test if there is a second 785 ind2=7.
105
+ If there is,
106
+ then the first 785 is the "mergedWith" relation and the second is the resource both were merged into.
107
+ if there isn't,
108
+ then guess we'll just treat this as the resource the 245 was merged into.
109
+ -->
110
+ <xsl:choose>
111
+ <xsl:when test="$serialization = 'rdfxml'">
112
+ <bf:relation>
113
+ <bf:Relation>
114
+ <xsl:if test="../marc:datafield[@tag='580']">
115
+ <xsl:choose>
116
+ <xsl:when test="../marc:datafield[@tag='580' and marc:subfield[@code='8']=$v8]">
117
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and marc:subfield[@code='8']=$v8][1]" mode="relNote" />
118
+ </xsl:when>
119
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/supplement' and
120
+ ../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'upplement')]">
121
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'upplement')][1]" mode="relNote" />
122
+ </xsl:when>
123
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/mergedtoform' and
124
+ count(preceding-sibling::marc:datafield[@tag='785' and @ind2='7']) = 0 and
125
+ ../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'erged with')]">
126
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'erged with')][1]" mode="relNote" />
127
+ </xsl:when>
128
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/mergerof' and
129
+ count(preceding-sibling::marc:datafield[@tag='780' and @ind2='4']) = 0 and
130
+ ../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'erger of')]">
131
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'erger of')][1]" mode="relNote" />
132
+ </xsl:when>
133
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/splitinto' and
134
+ count(preceding-sibling::marc:datafield[@tag='785' and @ind2='6']) = 0 and
135
+ ../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'plit into')]">
136
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'plit into')][1]" mode="relNote" />
137
+ </xsl:when>
138
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/absorbedby' and
139
+ contains(../marc:datafield[@tag='580']/marc:subfield[@code='a'], 'bsorbed by')">
140
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'bsorbed by')][1]" mode="relNote" />
141
+ </xsl:when>
142
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/continuedby' and
143
+ contains(../marc:datafield[@tag='580']/marc:subfield[@code='a'], 'ontinued by')">
144
+ <xsl:apply-templates select="../marc:datafield[@tag='580' and contains(marc:subfield[@code='a'], 'ontinued by')][1]" mode="relNote" />
145
+ </xsl:when>
146
+ </xsl:choose>
147
+ </xsl:if>
148
+ <bf:relationship>
149
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$vProperty"/></xsl:attribute>
150
+ </bf:relationship>
151
+ <xsl:for-each select="marc:subfield[@code='i']">
152
+ <bf:relationship>
153
+ <bf:Relationship>
154
+ <rdfs:label>
155
+ <xsl:if test="$vXmlLang != ''">
156
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
157
+ </xsl:if>
158
+ <xsl:call-template name="tChopPunct">
159
+ <xsl:with-param name="pString" select="."/>
160
+ </xsl:call-template>
161
+ </rdfs:label>
162
+ </bf:Relationship>
163
+ </bf:relationship>
164
+ </xsl:for-each>
165
+
166
+ <xsl:variable name="df880s" select="../marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag]"/>
167
+ <xsl:choose>
168
+ <!-- Let's use those 8s!!!! -->
169
+ <xsl:when test="$v8 != '' and
170
+ count(preceding-sibling::marc:datafield[starts-with(@tag, '7') and marc:subfield[@code='8']=$v8]) = 0">
171
+ <xsl:for-each select="../marc:datafield[starts-with(@tag, '7') and marc:subfield[@code='8']=$v8]">
172
+ <xsl:variable name="vRelProp">
173
+ <xsl:choose>
174
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/mergedtoform' and position()=last()">bf:associatedResource</xsl:when>
175
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/mergedtoform'">bf:mergedWith</xsl:when>
176
+ <xsl:otherwise>bf:associatedResource</xsl:otherwise>
177
+ </xsl:choose>
178
+ </xsl:variable>
179
+ <xsl:variable name="vWorkUriFE"><xsl:value-of select="$recordid"/>#Work<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
180
+ <xsl:variable name="vInstanceUriFE"><xsl:value-of select="$recordid"/>#Instance<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
181
+
182
+ <xsl:variable name="vOccurrenceFE">
183
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
184
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
185
+ </xsl:if>
186
+ </xsl:variable>
187
+ <xsl:variable name="vRelated880FE" select="$df880s[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrenceFE]" />
188
+ <xsl:variable name="v880XmlLangFE"><xsl:apply-templates select="$vRelated880FE" mode="xmllang"/></xsl:variable>
189
+
190
+ <xsl:element name="{$vRelProp}">
191
+ <xsl:apply-templates select="." mode="link7XXwork">
192
+ <xsl:with-param name="serialization" select="$serialization"/>
193
+ <xsl:with-param name="pTitleType" select="'work'"/>
194
+ <xsl:with-param name="pTag" select="$vTag" />
195
+ <xsl:with-param name="pWorkUri" select="$vWorkUriFE" />
196
+ <xsl:with-param name="pInstanceUri" select="$vInstanceUriFE" />
197
+ <xsl:with-param name="pXmlLang" select="$vXmlLang" />
198
+ <xsl:with-param name="pRelated880" select="$vRelated880FE" />
199
+ <xsl:with-param name="p880XmlLang" select="$v880XmlLangFE" />
200
+ </xsl:apply-templates>
201
+ </xsl:element>
202
+ </xsl:for-each>
203
+ </xsl:when>
204
+
205
+ <!-- No 8s!!!! -->
206
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/mergedtoform' and
207
+ count(preceding-sibling::marc:datafield[@tag='785' and @ind2='7']) = 0">
208
+ <xsl:for-each select="../marc:datafield[@tag='785' and @ind2='7']">
209
+ <xsl:variable name="vRelProp">
210
+ <xsl:choose>
211
+ <xsl:when test="position()=last()">bf:associatedResource</xsl:when>
212
+ <xsl:otherwise>bf:mergedWith</xsl:otherwise>
213
+ </xsl:choose>
214
+ </xsl:variable>
215
+ <xsl:variable name="vWorkUriFE"><xsl:value-of select="$recordid"/>#Work<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
216
+ <xsl:variable name="vInstanceUriFE"><xsl:value-of select="$recordid"/>#Instance<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
217
+
218
+ <xsl:variable name="vOccurrenceFE">
219
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
220
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
221
+ </xsl:if>
222
+ </xsl:variable>
223
+ <xsl:variable name="vRelated880FE" select="$df880s[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrenceFE]" />
224
+ <xsl:variable name="v880XmlLangFE"><xsl:apply-templates select="$vRelated880FE" mode="xmllang"/></xsl:variable>
225
+
226
+ <xsl:element name="{$vRelProp}">
227
+ <xsl:apply-templates select="." mode="link7XXwork">
228
+ <xsl:with-param name="serialization" select="$serialization"/>
229
+ <xsl:with-param name="pTitleType" select="'work'"/>
230
+ <xsl:with-param name="pTag" select="$vTag" />
231
+ <xsl:with-param name="pWorkUri" select="$vWorkUriFE" />
232
+ <xsl:with-param name="pInstanceUri" select="$vInstanceUriFE" />
233
+ <xsl:with-param name="pXmlLang" select="$vXmlLang" />
234
+ <xsl:with-param name="pRelated880" select="$vRelated880FE" />
235
+ <xsl:with-param name="p880XmlLang" select="$v880XmlLangFE" />
236
+ </xsl:apply-templates>
237
+ </xsl:element>
238
+ </xsl:for-each>
239
+ </xsl:when>
240
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/mergerof' and
241
+ count(preceding-sibling::marc:datafield[1][@tag='780' and @ind2='4']) = 0">
242
+ <xsl:for-each select="../marc:datafield[@tag='780' and @ind2='4']">
243
+ <xsl:variable name="vRelProp">bf:associatedResource</xsl:variable>
244
+ <xsl:variable name="vWorkUriFE"><xsl:value-of select="$recordid"/>#Work<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
245
+ <xsl:variable name="vInstanceUriFE"><xsl:value-of select="$recordid"/>#Instance<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
246
+
247
+ <xsl:variable name="vOccurrenceFE">
248
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
249
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
250
+ </xsl:if>
251
+ </xsl:variable>
252
+ <xsl:variable name="vRelated880FE" select="$df880s[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrenceFE]" />
253
+ <xsl:variable name="v880XmlLangFE"><xsl:apply-templates select="$vRelated880FE" mode="xmllang"/></xsl:variable>
254
+
255
+ <xsl:element name="{$vRelProp}">
256
+ <xsl:apply-templates select="." mode="link7XXwork">
257
+ <xsl:with-param name="serialization" select="$serialization"/>
258
+ <xsl:with-param name="pTitleType" select="'work'"/>
259
+ <xsl:with-param name="pTag" select="$vTag" />
260
+ <xsl:with-param name="pWorkUri" select="$vWorkUriFE" />
261
+ <xsl:with-param name="pInstanceUri" select="$vInstanceUriFE" />
262
+ <xsl:with-param name="pXmlLang" select="$vXmlLang" />
263
+ <xsl:with-param name="pRelated880" select="$vRelated880FE" />
264
+ <xsl:with-param name="p880XmlLang" select="$v880XmlLangFE" />
265
+ </xsl:apply-templates>
266
+ </xsl:element>
267
+ </xsl:for-each>
268
+ </xsl:when>
269
+ <xsl:when test="$vProperty = 'http://id.loc.gov/vocabulary/relationship/splitinto' and
270
+ count(preceding-sibling::marc:datafield[@tag='785' and @ind2='6']) = 0">
271
+ <xsl:for-each select="../marc:datafield[@tag='785' and @ind2='6']">
272
+ <xsl:variable name="vRelProp">bf:associatedResource</xsl:variable>
273
+ <xsl:variable name="vWorkUriFE"><xsl:value-of select="$recordid"/>#Work<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
274
+ <xsl:variable name="vInstanceUriFE"><xsl:value-of select="$recordid"/>#Instance<xsl:value-of select="@tag"/>-<xsl:value-of select="position()"/></xsl:variable>
275
+
276
+ <xsl:variable name="vOccurrenceFE">
277
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
278
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
279
+ </xsl:if>
280
+ </xsl:variable>
281
+ <xsl:variable name="vRelated880FE" select="$df880s[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$vTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrenceFE]" />
282
+ <xsl:variable name="v880XmlLangFE"><xsl:apply-templates select="$vRelated880FE" mode="xmllang"/></xsl:variable>
283
+
284
+ <xsl:element name="{$vRelProp}">
285
+ <xsl:apply-templates select="." mode="link7XXwork">
286
+ <xsl:with-param name="serialization" select="$serialization"/>
287
+ <xsl:with-param name="pTitleType" select="'work'"/>
288
+ <xsl:with-param name="pTag" select="$vTag" />
289
+ <xsl:with-param name="pWorkUri" select="$vWorkUriFE" />
290
+ <xsl:with-param name="pInstanceUri" select="$vInstanceUriFE" />
291
+ <xsl:with-param name="pXmlLang" select="$vXmlLang" />
292
+ <xsl:with-param name="pRelated880" select="$vRelated880FE" />
293
+ <xsl:with-param name="p880XmlLang" select="$v880XmlLangFE" />
294
+ </xsl:apply-templates>
295
+ </xsl:element>
296
+ </xsl:for-each>
297
+ </xsl:when>
298
+ <xsl:otherwise>
299
+ <bf:associatedResource>
300
+ <xsl:apply-templates select="." mode="link7XXwork">
301
+ <xsl:with-param name="serialization" select="$serialization"/>
302
+ <xsl:with-param name="pTitleType" select="'work'"/>
303
+ <xsl:with-param name="pTag" select="$vTag" />
304
+ <xsl:with-param name="pWorkUri" select="$vWorkUri" />
305
+ <xsl:with-param name="pInstanceUri" select="$vInstanceUri" />
306
+ <xsl:with-param name="pXmlLang" select="$vXmlLang" />
307
+ <xsl:with-param name="pRelated880" select="$vRelated880" />
308
+ <xsl:with-param name="p880XmlLang" select="$v880XmlLang" />
309
+ </xsl:apply-templates>
310
+ </bf:associatedResource>
311
+ </xsl:otherwise>
312
+ </xsl:choose>
313
+ </bf:Relation>
314
+ </bf:relation>
315
+ </xsl:when>
316
+ </xsl:choose>
317
+ </xsl:template>
318
+
319
+ <xsl:template match="marc:datafield" mode="link7XXwork">
320
+ <xsl:param name="serialization" select="'rdfxml'"/>
321
+ <xsl:param name="pWorkUri"/>
322
+ <xsl:param name="pInstanceUri"/>
323
+ <xsl:param name="pXmlLang"/>
324
+ <xsl:param name="pRelated880"/>
325
+ <xsl:param name="p880XmlLang"/>
326
+ <xsl:param name="pTag"/>
327
+ <bf:Work>
328
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$pWorkUri"/></xsl:attribute>
329
+ <xsl:apply-templates select="." mode="tLink7XXTitle">
330
+ <xsl:with-param name="serialization" select="$serialization"/>
331
+ <xsl:with-param name="pTitleType" select="'work'"/>
332
+ <xsl:with-param name="pTag" select="$pTag" />
333
+ </xsl:apply-templates>
334
+ <xsl:for-each select="marc:subfield[@code='a']">
335
+ <bf:contribution>
336
+ <bf:PrimaryContribution>
337
+ <bf:agent>
338
+ <bf:Agent>
339
+ <rdfs:label>
340
+ <xsl:if test="$pXmlLang != ''">
341
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute>
342
+ </xsl:if>
343
+ <xsl:call-template name="tChopPunct">
344
+ <xsl:with-param name="pString" select="."/>
345
+ </xsl:call-template>
346
+ </rdfs:label>
347
+ <xsl:if test="$pRelated880/marc:subfield[@code='a'][position()]">
348
+ <rdfs:label>
349
+ <xsl:if test="$p880XmlLang != ''">
350
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$p880XmlLang"/></xsl:attribute>
351
+ </xsl:if>
352
+ <xsl:call-template name="tChopPunct">
353
+ <xsl:with-param name="pString" select="$pRelated880/marc:subfield[@code='a'][position()]"/>
354
+ </xsl:call-template>
355
+ </rdfs:label>
356
+ </xsl:if>
357
+ </bf:Agent>
358
+ </bf:agent>
359
+ </bf:PrimaryContribution>
360
+ </bf:contribution>
361
+ </xsl:for-each>
362
+ <xsl:for-each select="marc:subfield[@code='e']">
363
+ <xsl:variable name="encoded">
364
+ <xsl:call-template name="url-encode">
365
+ <xsl:with-param name="str" select="normalize-space(.)"/>
366
+ </xsl:call-template>
367
+ </xsl:variable>
368
+ <bf:language>
369
+ <bf:Language>
370
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($languages,$encoded)"/></xsl:attribute>
371
+ </bf:Language>
372
+ </bf:language>
373
+ </xsl:for-each>
374
+ <xsl:for-each select="marc:subfield[@code='p']">
375
+ <bf:title>
376
+ <bf:AbbreviatedTitle>
377
+ <bf:mainTitle>
378
+ <xsl:if test="$pXmlLang != ''">
379
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute>
380
+ </xsl:if>
381
+ <xsl:value-of select="."/>
382
+ </bf:mainTitle>
383
+ <xsl:if test="$pRelated880/marc:subfield[@code='p'][position()]">
384
+ <bf:mainTitle>
385
+ <xsl:if test="$p880XmlLang != ''">
386
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$p880XmlLang"/></xsl:attribute>
387
+ </xsl:if>
388
+ <xsl:call-template name="tChopPunct">
389
+ <xsl:with-param name="pString" select="$pRelated880/marc:subfield[@code='p'][position()]"/>
390
+ </xsl:call-template>
391
+ </bf:mainTitle>
392
+ </xsl:if>
393
+ </bf:AbbreviatedTitle>
394
+ </bf:title>
395
+ </xsl:for-each>
396
+ <xsl:for-each select="marc:subfield[@code='v']">
397
+ <bf:note>
398
+ <bf:Note>
399
+ <rdfs:label>
400
+ <xsl:if test="$pXmlLang != ''">
401
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$pXmlLang"/></xsl:attribute>
402
+ </xsl:if>
403
+ <xsl:call-template name="tChopPunct">
404
+ <xsl:with-param name="pString" select="."/>
405
+ </xsl:call-template>
406
+ </rdfs:label>
407
+ </bf:Note>
408
+ </bf:note>
409
+ </xsl:for-each>
410
+ <xsl:for-each select="marc:subfield[@code='x']">
411
+ <bf:identifiedBy>
412
+ <bf:Issn>
413
+ <rdf:value>
414
+ <xsl:call-template name="tChopPunct">
415
+ <xsl:with-param name="pString" select="."/>
416
+ </xsl:call-template>
417
+ </rdf:value>
418
+ </bf:Issn>
419
+ </bf:identifiedBy>
420
+ </xsl:for-each>
421
+ <xsl:apply-templates select="marc:subfield[@code='3']" mode="subfield3">
422
+ <xsl:with-param name="serialization" select="$serialization"/>
423
+ </xsl:apply-templates>
424
+ <xsl:apply-templates select="marc:subfield[@code='4']" mode="subfield4">
425
+ <xsl:with-param name="serialization" select="$serialization"/>
426
+ </xsl:apply-templates>
427
+ <bf:hasInstance>
428
+ <bf:Instance>
429
+ <xsl:attribute name="rdf:about"><xsl:value-of select="$pInstanceUri"/></xsl:attribute>
430
+ <xsl:apply-templates select="." mode="link7XXinstance">
431
+ <xsl:with-param name="serialization" select="$serialization"/>
432
+ <xsl:with-param name="pWorkUri" select="$pWorkUri"/>
433
+ <xsl:with-param name="pTag" select="$pTag"/>
434
+ </xsl:apply-templates>
435
+ </bf:Instance>
436
+ </bf:hasInstance>
437
+ </bf:Work>
438
+ </xsl:template>
439
+
440
+ <xsl:template match="marc:datafield" mode="link7XXinstance">
441
+ <xsl:param name="serialization" select="'rdfxml'"/>
442
+ <xsl:param name="pWorkUri"/>
443
+ <xsl:param name="pTag"/>
444
+
445
+ <xsl:variable name="vOccurrence">
446
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
447
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
448
+ </xsl:if>
449
+ </xsl:variable>
450
+ <xsl:variable name="vRelated880" select="../marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$pTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrence]" />
451
+ <xsl:variable name="v880XmlLang"><xsl:apply-templates select="$vRelated880" mode="xmllang"/></xsl:variable>
452
+
453
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
454
+ <xsl:choose>
455
+ <xsl:when test="$serialization = 'rdfxml'">
456
+ <xsl:apply-templates select="." mode="tLink7XXTitle">
457
+ <xsl:with-param name="serialization" select="$serialization"/>
458
+ <xsl:with-param name="pTitleType" select="'instance'"/>
459
+ <xsl:with-param name="pTag" select="$pTag"/>
460
+ </xsl:apply-templates>
461
+ <xsl:for-each select="marc:subfield[@code='b']">
462
+ <bf:editionStatement>
463
+ <xsl:if test="$vXmlLang != ''">
464
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
465
+ </xsl:if>
466
+ <xsl:call-template name="tChopPunct">
467
+ <xsl:with-param name="pString" select="."/>
468
+ </xsl:call-template>
469
+ </bf:editionStatement>
470
+ <xsl:if test="$vRelated880/marc:subfield[@code='b'][position()]">
471
+ <bf:editionStatement>
472
+ <xsl:if test="$v880XmlLang != ''">
473
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
474
+ </xsl:if>
475
+ <xsl:call-template name="tChopPunct">
476
+ <xsl:with-param name="pString" select="$vRelated880/marc:subfield[@code='b'][position()]"/>
477
+ </xsl:call-template>
478
+ </bf:editionStatement>
479
+ </xsl:if>
480
+ </xsl:for-each>
481
+ <xsl:for-each select="marc:subfield[@code='d']">
482
+ <bf:provisionActivityStatement>
483
+ <xsl:if test="$vXmlLang != ''">
484
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
485
+ </xsl:if>
486
+ <xsl:call-template name="tChopPunct">
487
+ <xsl:with-param name="pString" select="."/>
488
+ </xsl:call-template>
489
+ </bf:provisionActivityStatement>
490
+ <xsl:if test="$vRelated880/marc:subfield[@code='d'][position()]">
491
+ <bf:provisionActivityStatement>
492
+ <xsl:if test="$v880XmlLang != ''">
493
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
494
+ </xsl:if>
495
+ <xsl:call-template name="tChopPunct">
496
+ <xsl:with-param name="pString" select="$vRelated880/marc:subfield[@code='d'][position()]"/>
497
+ </xsl:call-template>
498
+ </bf:provisionActivityStatement>
499
+ </xsl:if>
500
+ </xsl:for-each>
501
+ <xsl:for-each select="marc:subfield[@code='f']">
502
+ <xsl:variable name="encoded">
503
+ <xsl:call-template name="url-encode">
504
+ <xsl:with-param name="str" select="normalize-space(.)"/>
505
+ </xsl:call-template>
506
+ </xsl:variable>
507
+ <bf:provisionActivity>
508
+ <bf:ProvisionActivity>
509
+ <bf:place>
510
+ <bf:Place>
511
+ <xsl:attribute name="rdf:about"><xsl:value-of select="concat($countries,$encoded)"/></xsl:attribute>
512
+ </bf:Place>
513
+ </bf:place>
514
+ </bf:ProvisionActivity>
515
+ </bf:provisionActivity>
516
+ </xsl:for-each>
517
+ <xsl:for-each select="marc:subfield[@code='g']">
518
+ <bf:part>
519
+ <xsl:if test="$vXmlLang != ''">
520
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
521
+ </xsl:if>
522
+ <xsl:call-template name="tChopPunct">
523
+ <xsl:with-param name="pString" select="."/>
524
+ </xsl:call-template>
525
+ </bf:part>
526
+ <xsl:if test="$vRelated880/marc:subfield[@code='g'][position()]">
527
+ <bf:part>
528
+ <xsl:if test="$v880XmlLang != ''">
529
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
530
+ </xsl:if>
531
+ <xsl:call-template name="tChopPunct">
532
+ <xsl:with-param name="pString" select="$vRelated880/marc:subfield[@code='g'][position()]"/>
533
+ </xsl:call-template>
534
+ </bf:part>
535
+ </xsl:if>
536
+ </xsl:for-each>
537
+ <xsl:for-each select="marc:subfield[@code='h']">
538
+ <bf:extent>
539
+ <bf:Extent>
540
+ <rdfs:label>
541
+ <xsl:if test="$vXmlLang != ''">
542
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
543
+ </xsl:if>
544
+ <xsl:call-template name="tChopPunct">
545
+ <xsl:with-param name="pString" select="."/>
546
+ </xsl:call-template>
547
+ </rdfs:label>
548
+ <xsl:if test="$vRelated880/marc:subfield[@code='h'][position()]">
549
+ <rdfs:label>
550
+ <xsl:if test="$v880XmlLang != ''">
551
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
552
+ </xsl:if>
553
+ <xsl:call-template name="tChopPunct">
554
+ <xsl:with-param name="pString" select="$vRelated880/marc:subfield[@code='h'][position()]"/>
555
+ </xsl:call-template>
556
+ </rdfs:label>
557
+ </xsl:if>
558
+ </bf:Extent>
559
+ </bf:extent>
560
+ </xsl:for-each>
561
+ <xsl:for-each select="marc:subfield[@code='j' or @code='m' or @code='n' or @code='q']">
562
+ <bf:note>
563
+ <bf:Note>
564
+ <rdfs:label>
565
+ <xsl:if test="$vXmlLang != ''">
566
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
567
+ </xsl:if>
568
+ <xsl:call-template name="tChopPunct">
569
+ <xsl:with-param name="pString" select="."/>
570
+ </xsl:call-template>
571
+ </rdfs:label>
572
+ <xsl:variable name="tCode" select="@code"/>
573
+ <xsl:if test="$vRelated880/marc:subfield[@code=$tCode][position()]">
574
+ <rdfs:label>
575
+ <xsl:if test="$v880XmlLang != ''">
576
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
577
+ </xsl:if>
578
+ <xsl:call-template name="tChopPunct">
579
+ <xsl:with-param name="pString" select="$vRelated880/marc:subfield[@code=$tCode][position()]"/>
580
+ </xsl:call-template>
581
+ </rdfs:label>
582
+ </xsl:if>
583
+ </bf:Note>
584
+ </bf:note>
585
+ </xsl:for-each>
586
+ <xsl:for-each select="marc:subfield[@code='k']">
587
+ <bf:seriesStatement>
588
+ <xsl:if test="$vXmlLang != ''">
589
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
590
+ </xsl:if>
591
+ <xsl:call-template name="tChopPunct">
592
+ <xsl:with-param name="pString" select="."/>
593
+ </xsl:call-template>
594
+ </bf:seriesStatement>
595
+ <xsl:if test="$vRelated880/marc:subfield[@code='k'][position()]">
596
+ <bf:seriesStatement>
597
+ <xsl:if test="$v880XmlLang != ''">
598
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
599
+ </xsl:if>
600
+ <xsl:call-template name="tChopPunct">
601
+ <xsl:with-param name="pString" select="$vRelated880/marc:subfield[@code='k'][position()]"/>
602
+ </xsl:call-template>
603
+ </bf:seriesStatement>
604
+ </xsl:if>
605
+ </xsl:for-each>
606
+ <xsl:for-each select="marc:subfield[@code='o']">
607
+ <bf:identifiedBy>
608
+ <bf:Local>
609
+ <rdf:value>
610
+ <xsl:call-template name="tChopPunct">
611
+ <xsl:with-param name="pString" select="."/>
612
+ </xsl:call-template>
613
+ </rdf:value>
614
+ </bf:Local>
615
+ </bf:identifiedBy>
616
+ </xsl:for-each>
617
+ <xsl:for-each select="marc:subfield[@code='r']">
618
+ <bf:identifiedBy>
619
+ <bf:ReportNumber>
620
+ <rdf:value>
621
+ <xsl:call-template name="tChopPunct">
622
+ <xsl:with-param name="pString" select="."/>
623
+ </xsl:call-template>
624
+ </rdf:value>
625
+ </bf:ReportNumber>
626
+ </bf:identifiedBy>
627
+ </xsl:for-each>
628
+ <xsl:for-each select="marc:subfield[@code='u' or @code='y' or @code='z']">
629
+ <xsl:variable name="vIdentifier">
630
+ <xsl:choose>
631
+ <xsl:when test="@code='u'">bf:Strn</xsl:when>
632
+ <xsl:when test="@code='y'">bf:Coden</xsl:when>
633
+ <xsl:when test="@code='z'">bf:Isbn</xsl:when>
634
+ </xsl:choose>
635
+ </xsl:variable>
636
+ <bf:identifiedBy>
637
+ <xsl:element name="{$vIdentifier}">
638
+ <rdf:value>
639
+ <xsl:call-template name="tChopPunct">
640
+ <xsl:with-param name="pString" select="."/>
641
+ </xsl:call-template>
642
+ </rdf:value>
643
+ </xsl:element>
644
+ </bf:identifiedBy>
645
+ </xsl:for-each>
646
+ <xsl:for-each select="marc:subfield[@code='w']">
647
+ <xsl:variable name="vIdClass">
648
+ <xsl:choose>
649
+ <xsl:when test="starts-with(.,'(DLC)')">bf:Lccn</xsl:when>
650
+ <xsl:otherwise>bf:Identifier</xsl:otherwise>
651
+ </xsl:choose>
652
+ </xsl:variable>
653
+ <xsl:apply-templates mode="subfield0orw" select=".">
654
+ <xsl:with-param name="serialization" select="$serialization"/>
655
+ <xsl:with-param name="pIdClass" select="$vIdClass"/>
656
+ </xsl:apply-templates>
657
+ </xsl:for-each>
658
+ <xsl:apply-templates select="marc:subfield[@code='3']" mode="subfield3">
659
+ <xsl:with-param name="serialization" select="$serialization"/>
660
+ </xsl:apply-templates>
661
+ <xsl:apply-templates select="marc:subfield[@code='4']" mode="subfield4">
662
+ <xsl:with-param name="serialization" select="$serialization"/>
663
+ </xsl:apply-templates>
664
+ <bf:instanceOf>
665
+ <xsl:attribute name="rdf:resource"><xsl:value-of select="$pWorkUri"/></xsl:attribute>
666
+ </bf:instanceOf>
667
+ </xsl:when>
668
+ </xsl:choose>
669
+ </xsl:template>
670
+
671
+ <xsl:template match="marc:datafield" mode="tLink7XXTitle">
672
+ <xsl:param name="serialization" select="'rdfxml'"/>
673
+ <xsl:param name="pTitleType"/>
674
+ <xsl:param name="pTag" />
675
+
676
+ <xsl:variable name="vOccurrence">
677
+ <xsl:if test="marc:subfield[@code='6'] and not(contains(marc:subfield[@code='6'], '-00'))">
678
+ <xsl:value-of select="substring(substring-after(marc:subfield[@code='6'],'-'),1,2)"/>
679
+ </xsl:if>
680
+ </xsl:variable>
681
+ <xsl:variable name="vRelated880" select="../marc:datafield[@tag='880' and substring(marc:subfield[@code='6'],1,3)=$pTag and substring(substring-after(marc:subfield[@code='6'],'-'),1,2)=$vOccurrence]" />
682
+ <xsl:variable name="v880XmlLang"><xsl:apply-templates select="$vRelated880" mode="xmllang"/></xsl:variable>
683
+
684
+ <xsl:variable name="vXmlLang"><xsl:apply-templates select="." mode="xmllang"/></xsl:variable>
685
+ <xsl:variable name="vMainTitle">
686
+ <xsl:call-template name="tChopPunct">
687
+ <xsl:with-param name="pString">
688
+ <xsl:choose>
689
+ <xsl:when test="$pTitleType='work' and marc:subfield[@code='s']">
690
+ <xsl:value-of select="marc:subfield[@code='s']"/>
691
+ </xsl:when>
692
+ <xsl:when test="marc:subfield[@code='t']">
693
+ <xsl:value-of select="marc:subfield[@code='t']"/>
694
+ </xsl:when>
695
+ <xsl:otherwise>
696
+ <xsl:apply-templates mode="concat-nodes-space" select="../marc:datafield[@tag='245']/marc:subfield[@code='a' or @code='b']"/>
697
+ </xsl:otherwise>
698
+ </xsl:choose>
699
+ </xsl:with-param>
700
+ </xsl:call-template>
701
+ </xsl:variable>
702
+ <xsl:variable name="vMainTitle880">
703
+ <xsl:if test="$vRelated880/marc:subfield[@code='s' or @code='t' or @code='a']">
704
+ <xsl:call-template name="tChopPunct">
705
+ <xsl:with-param name="pString">
706
+ <xsl:choose>
707
+ <xsl:when test="$pTitleType='work' and $vRelated880/marc:subfield[@code='s']">
708
+ <xsl:value-of select="marc:subfield[@code='s']"/>
709
+ </xsl:when>
710
+ <xsl:when test="$vRelated880/marc:subfield[@code='t']">
711
+ <xsl:value-of select="$vRelated880/marc:subfield[@code='t']"/>
712
+ </xsl:when>
713
+ <xsl:otherwise>
714
+ <xsl:apply-templates mode="concat-nodes-space" select="../marc:datafield[@tag='245']/marc:subfield[@code='a' or @code='b']"/>
715
+ </xsl:otherwise>
716
+ </xsl:choose>
717
+ </xsl:with-param>
718
+ </xsl:call-template>
719
+ </xsl:if>
720
+ </xsl:variable>
721
+ <xsl:if test="$vMainTitle != ''">
722
+ <xsl:choose>
723
+ <xsl:when test="$serialization='rdfxml'">
724
+ <bf:title>
725
+ <bf:Title>
726
+ <bf:mainTitle>
727
+ <xsl:if test="$vXmlLang != ''">
728
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
729
+ </xsl:if>
730
+ <xsl:value-of select="$vMainTitle"/>
731
+ </bf:mainTitle>
732
+ <xsl:if test="$vMainTitle880 != ''">
733
+ <bf:mainTitle>
734
+ <xsl:if test="$v880XmlLang != ''">
735
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
736
+ </xsl:if>
737
+ <xsl:value-of select="$vMainTitle880"/>
738
+ </bf:mainTitle>
739
+ </xsl:if>
740
+ <xsl:if test="$pTitleType='work'">
741
+ <xsl:for-each select="marc:subfield[@code='c']">
742
+ <bf:qualifier>
743
+ <xsl:if test="$vXmlLang != ''">
744
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
745
+ </xsl:if>
746
+ <xsl:call-template name="tChopPunct">
747
+ <xsl:with-param name="pString" select="."/>
748
+ <xsl:with-param name="pChopParens" select="true()"/>
749
+ </xsl:call-template>
750
+ </bf:qualifier>
751
+ </xsl:for-each>
752
+ <xsl:for-each select="$vRelated880/marc:subfield[@code='c']">
753
+ <bf:qualifier>
754
+ <xsl:if test="$v880XmlLang != ''">
755
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$v880XmlLang"/></xsl:attribute>
756
+ </xsl:if>
757
+ <xsl:call-template name="tChopPunct">
758
+ <xsl:with-param name="pString" select="."/>
759
+ <xsl:with-param name="pChopParens" select="true()"/>
760
+ </xsl:call-template>
761
+ </bf:qualifier>
762
+ </xsl:for-each>
763
+ </xsl:if>
764
+ </bf:Title>
765
+ </bf:title>
766
+ </xsl:when>
767
+ </xsl:choose>
768
+ </xsl:if>
769
+ </xsl:template>
770
+
771
+ </xsl:stylesheet>