- both solr.xslt to define licence field for solr

- composer updates
- sytax in SolrDocumentXslt.php
This commit is contained in:
Arno Kaimbacher 2020-05-20 14:41:49 +02:00
parent 671cdb1e4e
commit 780bdbb4a4
4 changed files with 38 additions and 21 deletions

View File

@ -21,15 +21,15 @@ class SolrDocumentXslt
$this->processor = new \XSLTProcessor; $this->processor = new \XSLTProcessor;
$this->processor->importStyleSheet($xslt); $this->processor->importStyleSheet($xslt);
} catch (Exception $e) { } catch (\Exception $e) {
throw new Exception('invalid XSLT file for deriving Solr documents', 0, $e); throw new \Exception('invalid XSLT file for deriving Solr documents', 0, $e);
} }
} }
public function toSolrDocument(Dataset $rdrDataset, \DOMDocument $solrDoc) public function toSolrDocument(Dataset $rdrDataset, \DOMDocument $solrDoc)
{ {
if (!($solrDoc instanceof \DOMDocument)) { if (!($solrDoc instanceof \DOMDocument)) {
throw new Exception('provided Solr document must be instance of DOMDocument'); throw new \Exception('provided Solr document must be instance of DOMDocument');
} }
$modelXml = $this->getModelXml($rdrDataset);//->saveXML(); $modelXml = $this->getModelXml($rdrDataset);//->saveXML();

31
composer.lock generated
View File

@ -821,16 +821,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v6.18.14", "version": "v6.18.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "503d1511d6792b0b8d0a4bfed47f7c2f29634e1c" "reference": "a1fa3ddc0bb5285cafa6844b443633f7627d75dc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/503d1511d6792b0b8d0a4bfed47f7c2f29634e1c", "url": "https://api.github.com/repos/laravel/framework/zipball/a1fa3ddc0bb5285cafa6844b443633f7627d75dc",
"reference": "503d1511d6792b0b8d0a4bfed47f7c2f29634e1c", "reference": "a1fa3ddc0bb5285cafa6844b443633f7627d75dc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -855,6 +855,7 @@
"symfony/finder": "^4.3.4", "symfony/finder": "^4.3.4",
"symfony/http-foundation": "^4.3.4", "symfony/http-foundation": "^4.3.4",
"symfony/http-kernel": "^4.3.4", "symfony/http-kernel": "^4.3.4",
"symfony/polyfill-php73": "^1.17",
"symfony/process": "^4.3.4", "symfony/process": "^4.3.4",
"symfony/routing": "^4.3.4", "symfony/routing": "^4.3.4",
"symfony/var-dumper": "^4.3.4", "symfony/var-dumper": "^4.3.4",
@ -963,7 +964,7 @@
"framework", "framework",
"laravel" "laravel"
], ],
"time": "2020-05-12T14:41:15+00:00" "time": "2020-05-19T17:03:02+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -1030,16 +1031,16 @@
}, },
{ {
"name": "laravelcollective/html", "name": "laravelcollective/html",
"version": "v6.1.1", "version": "v6.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/LaravelCollective/html.git", "url": "https://github.com/LaravelCollective/html.git",
"reference": "895115187e6fca81350a0b1152b5804f52a8ac28" "reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/895115187e6fca81350a0b1152b5804f52a8ac28", "url": "https://api.github.com/repos/LaravelCollective/html/zipball/5ef9a3c9ae2423fe5618996f3cde375d461a3fc6",
"reference": "895115187e6fca81350a0b1152b5804f52a8ac28", "reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1094,7 +1095,7 @@
], ],
"description": "HTML and Form Builders for the Laravel Framework", "description": "HTML and Form Builders for the Laravel Framework",
"homepage": "https://laravelcollective.com", "homepage": "https://laravelcollective.com",
"time": "2020-05-17T20:19:55+00:00" "time": "2020-05-19T18:02:16+00:00"
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
@ -1431,16 +1432,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.34.0", "version": "2.34.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "52ea68aebbad8a3b27b5d24e4c66ebe1933f8399" "reference": "3e87404329b8072295ea11d548b47a1eefe5a162"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/52ea68aebbad8a3b27b5d24e4c66ebe1933f8399", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/3e87404329b8072295ea11d548b47a1eefe5a162",
"reference": "52ea68aebbad8a3b27b5d24e4c66ebe1933f8399", "reference": "3e87404329b8072295ea11d548b47a1eefe5a162",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1510,7 +1511,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-05-12T19:53:34+00:00" "time": "2020-05-19T22:14:16+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",

View File

@ -301,6 +301,14 @@
</xsl:element> </xsl:element>
</xsl:for-each> </xsl:for-each>
<!-- licences -->
<xsl:if test="/Opus/Rdr_Dataset/Licence">
<xsl:element name="field">
<xsl:attribute name="name">licence</xsl:attribute>
<xsl:value-of select="@Name" />
</xsl:element>
</xsl:for-each>
<!-- series ids and series number per id (modeled as dynamic field) --> <!-- series ids and series number per id (modeled as dynamic field) -->
<xsl:for-each select="/Opus/Rdr_Dataset/Series"> <xsl:for-each select="/Opus/Rdr_Dataset/Series">
<xsl:element name="field"> <xsl:element name="field">

View File

@ -38,7 +38,8 @@
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:php="http://php.net/xsl">
<xsl:output method="xml" indent="yes" /> <xsl:output method="xml" indent="yes" />
@ -300,6 +301,14 @@
</xsl:element> </xsl:element>
</xsl:for-each> </xsl:for-each>
<!-- licences -->
<xsl:if test="/Opus/Rdr_Dataset/Licence">
<xsl:element name="field">
<xsl:attribute name="name">licence</xsl:attribute>
<xsl:value-of select="@Name" />
</xsl:element>
</xsl:for-each>
<!-- series ids and series number per id (modeled as dynamic field) --> <!-- series ids and series number per id (modeled as dynamic field) -->
<xsl:for-each select="/Opus/Rdr_Dataset/Series"> <xsl:for-each select="/Opus/Rdr_Dataset/Series">
<xsl:element name="field"> <xsl:element name="field">
@ -405,8 +414,7 @@
<xsl:for-each select="/Opus/Rdr_Dataset/Reference"> <xsl:for-each select="/Opus/Rdr_Dataset/Reference">
<xsl:element name="field"> <xsl:element name="field">
<xsl:attribute name="name">reference</xsl:attribute> <xsl:attribute name="name">reference</xsl:attribute>
<xsl:value-of select="json-to-xml(/Opus/Rdr_Dataset/Reference)"/> <xsl:value-of select="@Value"/>
<!-- <xsl:value-of select="@Value"/> -->
</xsl:element> </xsl:element>
</xsl:for-each> </xsl:for-each>