If a subfield has too much (arbitrarily defined as at least 10)
of trailing whitespace, trim the whitespace. This works around
a problem applying certain stylesheets (like the MARCXML-to-MODS
stylesheet) that use a recursive XSLT function to trim whitespace.
Note that only "excessive" whitespace is trimmed; some systems
emit subfields that contain semantically significant trailing
whitespace in certain fields.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
message("Dollar sign corrected");
}
+ # excessive trailing whitespace in subfield contents
+ if ($record[$ptr] =~ m|\s{10,}</subfield>|) {
+ $record[$ptr] =~ s|\s{10,}</subfield>|</subfield>|;
+ message("Trailing whitespace trimmed from subfield contents");
+ }
+
# automatable subfield maladies
$record[$ptr] =~ s/code=" ">c/code="c">/;
$record[$ptr] =~ s/code=" ">\$/code="c">\$/;