Skip to content

Commit 37954ce

Browse files
committed
Handle dollar3 and dollar6 when parsing subfields for PA groups.
1 parent db20f21 commit 37954ce

File tree

1 file changed

+80
-40
lines changed

1 file changed

+80
-40
lines changed

xsl/ConvSpec-Process8-ProvAct.xsl

+80-40
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<xsl:with-param name="v880Ref" select="$v880Ref"/>
8282
</xsl:call-template>
8383
</xsl:for-each>
84-
84+
8585
<xsl:for-each select="$v880Fields">
8686
<xsl:variable name="vTag">
8787
<xsl:value-of select="substring(marc:subfield[@code = '6'], 1, 3)"/>
@@ -93,9 +93,14 @@
9393
<xsl:variable name="v880Ref">
9494
<xsl:value-of select="concat('880-', $v880Occurrence)"/>
9595
</xsl:variable>
96-
<xsl:variable name="relatedField" select="../marc:datafield[@tag = $vTag and contains(marc:subfield[@code = '6'], $v880Ref)]"
97-
/>
98-
<xsl:copy-of select="$relatedField"/>
96+
97+
<!-- Is this 880 related to a 26X field in this record? -->
98+
<xsl:variable name="relatedField" select="../marc:datafield[@tag = $vTag and contains(marc:subfield[@code = '6'], $v880Ref)]" />
99+
100+
<!-- commented out on 30 Aug 2024. Did doing this break something? -->
101+
<!-- <xsl:copy-of select="$relatedField"/> -->
102+
103+
<!-- If no related field was found, then we have an unpaied 880. We need to output it. -->
99104
<xsl:if test="count($relatedField/marc:*) = 0">
100105
<xsl:variable name="dfFrom880-prenodeset">
101106
<marc:datafield>
@@ -121,7 +126,7 @@
121126
</xsl:for-each>
122127
</xsl:variable>
123128
<xsl:variable name="sfblocks" select="exsl:node-set($sfblocks-prenodeset)"/>
124-
<!--<xsl:copy-of select="$sfblocks"/>-->
129+
<!-- <xsl:message><xsl:copy-of select="$sfblocks"/></xsl:message> -->
125130

126131
<xsl:for-each select="$sfblocks/marc:sfGroup">
127132
<xsl:variable name="sfgTag" select="@tag"/>
@@ -249,11 +254,22 @@
249254
</bf:status>
250255
</xsl:if>
251256

252-
<xsl:apply-templates
253-
select="$df/marc:sf[@code = '3'] | marc:df[@tag = '880']/marc:sf[@code = '3']"
254-
mode="subfield3">
255-
<xsl:with-param name="serialization" select="$serialization"/>
256-
</xsl:apply-templates>
257+
<xsl:choose>
258+
<xsl:when test="$df/marc:sf[@code = '3']">
259+
<xsl:apply-templates
260+
select="$df/marc:sf[@code = '3'][1]"
261+
mode="subfield3">
262+
<xsl:with-param name="serialization" select="$serialization"/>
263+
</xsl:apply-templates>
264+
</xsl:when>
265+
<xsl:when test="marc:df[@tag = '880']/marc:sf[@code = '3']">
266+
<xsl:apply-templates
267+
select="marc:df[@tag = '880']/marc:sf[@code = '3'][1]"
268+
mode="subfield3">
269+
<xsl:with-param name="serialization" select="$serialization"/>
270+
</xsl:apply-templates>
271+
</xsl:when>
272+
</xsl:choose>
257273
<xsl:for-each select="$df/marc:sf[@code = 'a']">
258274
<xsl:variable name="sfPos" select="@pos"/>
259275
<xsl:variable name="vLabel">
@@ -485,6 +501,7 @@
485501
</xsl:call-template>
486502
</xsl:variable>
487503
<xsl:variable name="parsedSfs" select="exsl:node-set($parsedSfs-prenodeset)"/>
504+
<!-- <xsl:message><xsl:copy-of select="$parsedSfs"/></xsl:message> -->
488505

489506
<!-- Find the group numbers. -->
490507
<xsl:variable name="groups-prenodeset">
@@ -588,6 +605,18 @@
588605
<xsl:variable name="sf" select="$df/marc:subfield[$pos]"/>
589606

590607
<xsl:choose>
608+
<xsl:when test="$sf/@code = '3' or $sf/@code = '6'">
609+
<marc:sf>
610+
<xsl:copy-of select="$sf/@*"/>
611+
<xsl:attribute name="gpos">
612+
<xsl:value-of select="$gpos"/>
613+
</xsl:attribute>
614+
<xsl:attribute name="pos">
615+
<xsl:value-of select="$pos"/>
616+
</xsl:attribute>
617+
<xsl:copy-of select="$sf/text()"/>
618+
</marc:sf>
619+
</xsl:when>
591620
<xsl:when test="$df/@tag = '261' and ($sf/@code = 'a' or $sf/@code = 'b')">
592621
<xsl:variable name="map260sfs">
593622
<m sfCode="a">b</m>
@@ -656,36 +685,36 @@
656685
</marc:sf>
657686
</xsl:when>
658687
<xsl:when test="$sf/@code = 'a' or $sf/@code = 'b' or $sf/@code = 'c'">
659-
<marc:sf>
660-
<xsl:copy-of select="$sf/@*"/>
661-
<xsl:attribute name="gpos">
662-
<xsl:value-of select="$gpos"/>
663-
</xsl:attribute>
664-
<xsl:attribute name="pos">
665-
<xsl:value-of select="$pos"/>
666-
</xsl:attribute>
667-
<xsl:copy-of select="$sf/text()"/>
668-
</marc:sf>
669-
</xsl:when>
670-
<xsl:when test="$sf/@code = 'e' or $sf/@code = 'f' or $sf/@code = 'g'">
671-
<xsl:variable name="map260sfs">
672-
<m sfCode="e">a</m>
673-
<m sfCode="f">b</m>
674-
<m sfCode="g">c</m>
675-
</xsl:variable>
676-
<marc:sf type="Manufacture">
677-
<xsl:attribute name="code">
678-
<xsl:value-of select="exsl:node-set($map260sfs)/m[@sfCode = $sf/@code]"/>
679-
</xsl:attribute>
680-
<xsl:attribute name="gpos">
681-
<xsl:value-of select="$gpos"/>
682-
</xsl:attribute>
683-
<xsl:attribute name="pos">
684-
<xsl:value-of select="$pos"/>
685-
</xsl:attribute>
686-
<xsl:copy-of select="$sf/text()"/>
687-
</marc:sf>
688-
</xsl:when>
688+
<marc:sf>
689+
<xsl:copy-of select="$sf/@*"/>
690+
<xsl:attribute name="gpos">
691+
<xsl:value-of select="$gpos"/>
692+
</xsl:attribute>
693+
<xsl:attribute name="pos">
694+
<xsl:value-of select="$pos"/>
695+
</xsl:attribute>
696+
<xsl:copy-of select="$sf/text()"/>
697+
</marc:sf>
698+
</xsl:when>
699+
<xsl:when test="$sf/@code = 'e' or $sf/@code = 'f' or $sf/@code = 'g'">
700+
<xsl:variable name="map260sfs">
701+
<m sfCode="e">a</m>
702+
<m sfCode="f">b</m>
703+
<m sfCode="g">c</m>
704+
</xsl:variable>
705+
<marc:sf type="Manufacture">
706+
<xsl:attribute name="code">
707+
<xsl:value-of select="exsl:node-set($map260sfs)/m[@sfCode = $sf/@code]"/>
708+
</xsl:attribute>
709+
<xsl:attribute name="gpos">
710+
<xsl:value-of select="$gpos"/>
711+
</xsl:attribute>
712+
<xsl:attribute name="pos">
713+
<xsl:value-of select="$pos"/>
714+
</xsl:attribute>
715+
<xsl:copy-of select="$sf/text()"/>
716+
</marc:sf>
717+
</xsl:when>
689718
</xsl:choose>
690719

691720
<xsl:variable name="next_gpos" select="$gpos + 1"/>
@@ -700,6 +729,17 @@
700729
<xsl:with-param name="pos" select="$next_pos"/>
701730
</xsl:call-template>
702731
</xsl:when>
732+
<xsl:when
733+
test="
734+
($sf/@code = '6' and $df/marc:subfield[$next_pos][@code = '3' or @code = 'a'])
735+
or
736+
($sf/@code = '3' and $df/marc:subfield[$next_pos][@code = 'a'])">
737+
<xsl:call-template name="parse26x">
738+
<xsl:with-param name="df" select="$df"/>
739+
<xsl:with-param name="gpos" select="$gpos"/>
740+
<xsl:with-param name="pos" select="$next_pos"/>
741+
</xsl:call-template>
742+
</xsl:when>
703743
<xsl:when
704744
test="
705745
($sf/@code = 'a' and $df/marc:subfield[$next_pos][@code = 'a'])

0 commit comments

Comments
 (0)