lcnetdev / marc2bibframe2

Convert MARC records to BIBFRAME2 RDF
http://www.loc.gov/bibframe/
Creative Commons Zero v1.0 Universal
88 stars 35 forks source link

Fix recursion issue; test for existence of 490 and not assume. Added… #146

Closed kefo closed 5 years ago

kefo commented 5 years ago

… test for additional scenario. All tests pass.

@wafschneider I'll let you merge this if it looks sensible. I think it is going to be fine and correct but you are waaaaay more familiar with the workings of this section of the XSL and the specs around this.

kefo commented 5 years ago

Looks good to me. Simpler. Not essential, but something about this for-each is tugging at me.

https://github.com/lcnetdev/marc2bibframe2/blob/b189c2c3e1cd6e7c6403e16c6d14ceb1eb3a6ff9/xsl/ConvSpec-Process6-Series.xsl#L195

Since, ultimately, it is the subfield=x that we're interested in, the for-each could just query for that path specifically:

<xsl:for-each select="../marc:datafield[@tag='490' and @ind1='1'][$pCurrentPos]/marc:subfield[@code='x']" />

BUt maybe not because I'm not entirely sure what is happening a few lines down where you find following-sibling::marc:subfield....

wafschneider commented 5 years ago

The issue is that a repeating $a (for series/subseries) may or may not have a paired $x (which can also repeat). I think the basic unit we have to process to match with the 8XX is the $a (except in the case of a parallel title), then we have to see if the matched $a has a sibling $x that occurs before another $a appears in the field.

I will go ahead and merge this PR, and if we can come up with a better algorithm, I'm happy to deal with that as a separate issue. Thanks, @kefo!