Skip to content

Commit

Permalink
#53 DOI text nodes are doubled up
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhanson committed Nov 13, 2024
1 parent 0b74903 commit 77e2a91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions OAIMetadataFormat_JATS.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,10 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
// Store the DOI
if ($doi = trim($article->getStoredPubId('doi'))) {
$match = $xpath->query("//article/front/article-meta/article-id[@pub-id-type='doi']");
if ($match->length) $match->item(0)->appendChild($doc->createTextNode($doi));
else {
if ($match->length) {
$originalDoiNode = $match->item(0)->firstChild;
$match->item(0)->replaceChild($doc->createTextNode($doi), $originalDoiNode);
} else {
$articleIdNode = $this->_addChildInOrder($articleMetaNode, $doc->createElement('article-id'));
$articleIdNode->setAttribute('pub-id-type', 'doi');
$articleIdNode->appendChild($doc->createTextNode($doi));
Expand Down

0 comments on commit 77e2a91

Please sign in to comment.