doi_datacite.xslt: put 'affiliation' afte 'nameIdentifier'

- EditotController.php: add addAlternateLandingPageAttribute for doir registration
- RequestController.php: show correct alternaeIdentifier
This commit is contained in:
Arno Kaimbacher 2022-01-19 16:09:50 +01:00
parent 76b351fb73
commit 2e1cca030b
3 changed files with 36 additions and 7 deletions

View File

@ -609,7 +609,9 @@ class RequestController extends Controller
*/
private function addLandingPageAttribute(\DOMNode $document, $dataid)
{
$url = route('frontend.dataset.show', $dataid);
// $url = route('frontend.dataset.show', $dataid);
$base_domain = config('tethys.base_domain');
$url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid;
$owner = $document->ownerDocument;
$attr = $owner->createAttribute('landingpage');

View File

@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
use \Exception;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use App\Models\DatasetIdentifier;
use App\Models\Oai\OaiModelError;
@ -62,7 +63,7 @@ class EditorController extends Controller
$this->doiClient = $DoiClient;
//$this->middleware('auth');
$this->xml = new \DomDocument();
$this->xml = new \DomDocument('1.0', 'UTF-8');
$this->proc = new \XSLTProcessor();
}
@ -701,6 +702,7 @@ class EditorController extends Controller
$cache = ($dataset->xmlCache) ? $dataset->xmlCache : new \App\Models\XmlCache();
$xmlModel->setXmlCache($cache);
$domNode = $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0);
$this->addAlternateLandingPageAttribute($domNode, $dataset->publish_id);
$node = $this->xml->importNode($domNode, true);
$this->addSpecInformation($node, 'data-type:' . $dataset->type);
@ -742,6 +744,24 @@ class EditorController extends Controller
}
}
/**
* Add the landingpage attribute to Rdr_Dataset XML output.
*
* @param \DOMNode $document Rdr_Dataset XML serialisation
* @param string $docid Id of the dataset
* @return void
*/
private function addAlternateLandingPageAttribute(\DOMNode $document, $dataid)
{
$base_domain = config('tethys.base_domain');
$url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid;
$owner = $document->ownerDocument;
$attr = $owner->createAttribute('landingpage');
$attr->appendChild($owner->createTextNode($url));
$document->appendChild($attr);
}
/**
* Load an xslt stylesheet.
*
@ -749,7 +769,7 @@ class EditorController extends Controller
*/
private function loadStyleSheet($stylesheet)
{
$this->xslt = new \DomDocument;
$this->xslt = new \DomDocument('1.0', 'UTF-8');
$this->xslt->load($stylesheet);
$this->proc->importStyleSheet($this->xslt);
if (isset($_SERVER['HTTP_HOST'])) {

View File

@ -350,13 +350,20 @@
<familyName>
<xsl:value-of select="@LastName" />
</familyName>
<affiliation>GBA</affiliation>
</xsl:if>
<xsl:if test="@IdentifierOrcid != ''">
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">
<xsl:value-of select="@IdentifierOrcid" />
</nameIdentifier>
</xsl:if>
<affiliation>GBA</affiliation>
</xsl:if>
<xsl:if test="@NameType = 'Organizational'">
<xsl:if test="@IdentifierOrcid != ''">
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">
<xsl:value-of select="@IdentifierOrcid" />
</nameIdentifier>
</xsl:if>
</xsl:if>
<!--
<nameType><xsl:value-of select="@NameType" /></nameType>