From 77e2a91a783a02aed1cf835cdc9d41681e013ea9 Mon Sep 17 00:00:00 2001 From: Erik Hanson Date: Wed, 13 Nov 2024 09:49:36 -0800 Subject: [PATCH] pkp/oaiJats#53 DOI text nodes are doubled up --- OAIMetadataFormat_JATS.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OAIMetadataFormat_JATS.php b/OAIMetadataFormat_JATS.php index 8fdbfd8..d0ab2cb 100644 --- a/OAIMetadataFormat_JATS.php +++ b/OAIMetadataFormat_JATS.php @@ -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));