Skip to content

Commit 485b84b

Browse files
authored
Merge pull request #107 from lcnetdev/issue-83-marc-255
Update conversion for MARC 255.
2 parents a99dc13 + 8d00274 commit 485b84b

5 files changed

Lines changed: 72 additions & 66 deletions

File tree

spec/ConvSpec-250-270-R2.xlsx

-15 KB
Binary file not shown.

spec/ConvSpec-250-270-v1.4.xlsx

15.1 KB
Binary file not shown.

test/ConvSpec-250-270.xspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
<x:scenario label="255 - CARTOGRAPHIC MATHEMATICAL DATA">
2424
<x:context href="data/ConvSpec-250-270/marc.xml"/>
25-
<x:expect label="255 creates a cartographicAttributes/Cartographic property of the Work" test="count(//bf:Work[1]/bf:cartographicAttributes/bf:Cartographic) = 1"/>
26-
<x:expect label="$a creates a scale/Scale property of the Work" test="//bf:Work[1]/bf:scale/bf:Scale/rdfs:label = 'Scale [ca. 1:500,000]'"/>
25+
<x:expect label="255 with $b/$c/$d/$e/$f/$g creates a cartographicAttributes/Cartographic property of the Work" test="count(//bf:Work[1]/bf:cartographicAttributes/bf:Cartographic) = 1"/>
26+
<x:expect label="$a creates a scale/Scale property of the Work" test="//bf:Work[1]/bf:scale[1]/bf:Scale/rdfs:label = 'Scale [ca. 1:500,000]'"/>
27+
<x:expect label="...even if no other subfields" test="//bf:Work[1]/bf:scale[2]/bf:Scale/rdfs:label = 'Scales differ'"/>
2728
<x:expect label="$b creates a projection/Projection property of the Cartographic" test="//bf:Work[1]/bf:cartographicAttributes[1]/bf:Cartographic/bf:projection/bf:Projection/rdfs:label = 'Conic proj.'"/>
2829
<x:expect label="$c creates a coordinates property of the Cartographic" test="//bf:Work[1]/bf:cartographicAttributes[1]/bf:Cartographic/bf:coordinates = 'E 72°--E 148°/N 13°--N 18°'"/>
2930
<x:expect label="$d creates an ascensionAndDeclination property of the Cartographic" test="//bf:Work[1]/bf:cartographicAttributes[1]/bf:Cartographic/bf:ascensionAndDeclination = 'RA 0 hr. to 24 hr./Decl. +90° to -90°'"/>

test/data/ConvSpec-250-270/marc.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<subfield code="f">-113.628304 -113.498001 47.009300 46.087225</subfield>
2020
<subfield code="g">-113.628304 -113.498001 47.009300 46.087225</subfield>
2121
</datafield>
22+
<datafield tag="255" ind1=" " ind2=" ">
23+
<subfield code="a">Scales differ.</subfield>
24+
</datafield>
2225
<datafield tag="256" ind1=" " ind2=" ">
2326
<subfield code="a">Computer data (2 files : 876,000, 775,000 records).</subfield>
2427
</datafield>

xsl/ConvSpec-250-270.xsl

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -77,70 +77,72 @@
7777
</bf:Scale>
7878
</bf:scale>
7979
</xsl:for-each>
80-
<bf:cartographicAttributes>
81-
<bf:Cartographic>
82-
<xsl:for-each select="marc:subfield[@code='b']">
83-
<bf:projection>
84-
<bf:Projection>
85-
<rdfs:label>
86-
<xsl:if test="$vXmlLang != ''">
87-
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
88-
</xsl:if>
89-
<!-- leave trailing period for abbreviations -->
90-
<xsl:call-template name="chopPunctuation">
91-
<xsl:with-param name="chopString" select="."/>
92-
<xsl:with-param name="punctuation"><xsl:text>:,;/ </xsl:text></xsl:with-param>
93-
</xsl:call-template>
94-
</rdfs:label>
95-
</bf:Projection>
96-
</bf:projection>
97-
</xsl:for-each>
98-
<xsl:if test="$vCoordinates != ''">
99-
<bf:coordinates>
100-
<xsl:if test="$vXmlLang != ''">
101-
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
102-
</xsl:if>
103-
<xsl:value-of select="$vCoordinates"/>
104-
</bf:coordinates>
105-
</xsl:if>
106-
<xsl:if test="$vZone != ''">
107-
<bf:ascensionAndDeclination>
108-
<xsl:if test="$vXmlLang != ''">
109-
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
110-
</xsl:if>
111-
<xsl:value-of select="$vZone"/>
112-
</bf:ascensionAndDeclination>
113-
</xsl:if>
114-
<xsl:if test="$vEquinox != ''">
115-
<bf:equinox>
116-
<xsl:if test="$vXmlLang != ''">
117-
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
118-
</xsl:if>
119-
<xsl:value-of select="$vEquinox"/>
120-
</bf:equinox>
121-
</xsl:if>
122-
<xsl:for-each select="marc:subfield[@code='f']">
123-
<bf:outerGRing>
124-
<xsl:if test="$vXmlLang != ''">
125-
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
126-
</xsl:if>
127-
<xsl:call-template name="chopPunctuation">
128-
<xsl:with-param name="chopString" select="."/>
129-
</xsl:call-template>
130-
</bf:outerGRing>
131-
</xsl:for-each>
132-
<xsl:for-each select="marc:subfield[@code='g']">
133-
<bf:exclusionGRing>
134-
<xsl:if test="$vXmlLang != ''">
135-
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
136-
</xsl:if>
137-
<xsl:call-template name="chopPunctuation">
138-
<xsl:with-param name="chopString" select="."/>
139-
</xsl:call-template>
140-
</bf:exclusionGRing>
141-
</xsl:for-each>
142-
</bf:Cartographic>
143-
</bf:cartographicAttributes>
80+
<xsl:if test="marc:subfield[@code='b' or @code='c' or @code='d' or @code='f' or @code='g']">
81+
<bf:cartographicAttributes>
82+
<bf:Cartographic>
83+
<xsl:for-each select="marc:subfield[@code='b']">
84+
<bf:projection>
85+
<bf:Projection>
86+
<rdfs:label>
87+
<xsl:if test="$vXmlLang != ''">
88+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
89+
</xsl:if>
90+
<!-- leave trailing period for abbreviations -->
91+
<xsl:call-template name="chopPunctuation">
92+
<xsl:with-param name="chopString" select="."/>
93+
<xsl:with-param name="punctuation"><xsl:text>:,;/ </xsl:text></xsl:with-param>
94+
</xsl:call-template>
95+
</rdfs:label>
96+
</bf:Projection>
97+
</bf:projection>
98+
</xsl:for-each>
99+
<xsl:if test="$vCoordinates != ''">
100+
<bf:coordinates>
101+
<xsl:if test="$vXmlLang != ''">
102+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
103+
</xsl:if>
104+
<xsl:value-of select="$vCoordinates"/>
105+
</bf:coordinates>
106+
</xsl:if>
107+
<xsl:if test="$vZone != ''">
108+
<bf:ascensionAndDeclination>
109+
<xsl:if test="$vXmlLang != ''">
110+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
111+
</xsl:if>
112+
<xsl:value-of select="$vZone"/>
113+
</bf:ascensionAndDeclination>
114+
</xsl:if>
115+
<xsl:if test="$vEquinox != ''">
116+
<bf:equinox>
117+
<xsl:if test="$vXmlLang != ''">
118+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
119+
</xsl:if>
120+
<xsl:value-of select="$vEquinox"/>
121+
</bf:equinox>
122+
</xsl:if>
123+
<xsl:for-each select="marc:subfield[@code='f']">
124+
<bf:outerGRing>
125+
<xsl:if test="$vXmlLang != ''">
126+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
127+
</xsl:if>
128+
<xsl:call-template name="chopPunctuation">
129+
<xsl:with-param name="chopString" select="."/>
130+
</xsl:call-template>
131+
</bf:outerGRing>
132+
</xsl:for-each>
133+
<xsl:for-each select="marc:subfield[@code='g']">
134+
<bf:exclusionGRing>
135+
<xsl:if test="$vXmlLang != ''">
136+
<xsl:attribute name="xml:lang"><xsl:value-of select="$vXmlLang"/></xsl:attribute>
137+
</xsl:if>
138+
<xsl:call-template name="chopPunctuation">
139+
<xsl:with-param name="chopString" select="."/>
140+
</xsl:call-template>
141+
</bf:exclusionGRing>
142+
</xsl:for-each>
143+
</bf:Cartographic>
144+
</bf:cartographicAttributes>
145+
</xsl:if>
144146
</xsl:when>
145147
</xsl:choose>
146148
</xsl:template>

0 commit comments

Comments
 (0)