Commit be3ce572cd5d165ce42b52c07bef34d246c89128

Authored by Paulo Graça
1 parent 2145b4d949
Exists in master

PG: fix if missing givenname element

ingester/scripts/extract_metadata.pl
@@ -102,10 +102,14 @@ foreach my $item (@{$json_base->{author}}) { @@ -102,10 +102,14 @@ foreach my $item (@{$json_base->{author}}) {
102 my $author = $document->createElement( 'author' ); 102 my $author = $document->createElement( 'author' );
103 103
104 my $family = $document->createElement( 'family' ); 104 my $family = $document->createElement( 'family' );
105 - $family->addChild($document->createTextNode($item->{'family'})); 105 + if (defined ($item->{'family'})) {
  106 + $family->addChild($document->createTextNode($item->{'family'}));
  107 + }
106 108
107 my $given = $document->createElement( 'given' ); 109 my $given = $document->createElement( 'given' );
108 - $given->addChild($document->createTextNode($item->{'given'})); 110 + if (defined ($item->{'given'})) {
  111 + $given->addChild($document->createTextNode($item->{'given'}));
  112 + }
109 113
110 #print Dumper "<affiliation>".$item->{affiliation}."</affiliation>"; 114 #print Dumper "<affiliation>".$item->{affiliation}."</affiliation>";
111 $author->addChild($family); 115 $author->addChild($family);
ingester/xslt/dc-map.xslt
@@ -35,8 +35,11 @@ @@ -35,8 +35,11 @@
35 <xsl:for-each select="/crossref/authors/author"> 35 <xsl:for-each select="/crossref/authors/author">
36 <dcvalue element="contributor" qualifier="author"> 36 <dcvalue element="contributor" qualifier="author">
37 <xsl:value-of select="family"/> 37 <xsl:value-of select="family"/>
38 - <xsl:text>, </xsl:text>  
39 - <xsl:value-of select="given"/></dcvalue> 38 + <xsl:if test="given != ''">
  39 + <xsl:text>, </xsl:text>
  40 + <xsl:value-of select="given"/>
  41 + </xsl:if>
  42 + </dcvalue>
40 </xsl:for-each> 43 </xsl:for-each>
41 44
42 <xsl:for-each select="/crossref/DOI"> 45 <xsl:for-each select="/crossref/DOI">