If metadata cannot be retrieved via SRU API fallback to static metatada ISBN search
Fixes ERROR: No metadata found for IDNO: 9783701183081
Die zweite ID ist bereits in der Metadaten-CSV enthalten (dort unter ID
8000000009).
diff --git a/test/resources/DNB/9783701183081.epub b/test/resources/DNB/9783701183081.epub
new file mode 100644
index 0000000..fdf1b00
--- /dev/null
+++ b/test/resources/DNB/9783701183081.epub
Binary files differ
diff --git a/test/resources/DNB/Buchpreis_2024/9783701183081.epub b/test/resources/DNB/Buchpreis_2024/9783701183081.epub
new file mode 120000
index 0000000..1baef18
--- /dev/null
+++ b/test/resources/DNB/Buchpreis_2024/9783701183081.epub
@@ -0,0 +1 @@
+../9783701183081.epub
\ No newline at end of file
diff --git a/test/test-xml.sh b/test/test-xml.sh
index 904ab24..aee9b40 100755
--- a/test/test-xml.sh
+++ b/test/test-xml.sh
@@ -65,6 +65,12 @@
xmllint -noout xslt/static_metadata.xml
assert_eq "$?" "0" "static_metadata.xml is well-formed"
+observed=$(xmlstarlet sel --net -t -v "count(/idsCorpus/idsDoc/idsText/idsHeader/fileDesc[publicationStmt/idno[@type='IDN' and .='8000000009']]/sourceDesc//h.title[.='Ein Hund kam in die Küche'])" target/dnb23.i5.xml)
+assert_eq "$observed" "1" "static metadata is also used as fallback by ISBN and via symbolic link"
+
+observed=$(xmlstarlet sel --net -t -v "count(/idsCorpus/idsDoc/idsText/idsHeader/fileDesc/sourceDesc/biblStruct/note[@type='award'][@subtype='Buchpreis deutscher_buchpreis'])" target/dnb23.i5.xml)
+assert_eq "$observed" "1" "award is also correctly identified for static metadata epubs"
+
exit_with_test_summary
diff --git a/xslt/epub2i5.xsl b/xslt/epub2i5.xsl
index f2f2414..2847b81 100644
--- a/xslt/epub2i5.xsl
+++ b/xslt/epub2i5.xsl
@@ -45,7 +45,8 @@
<xsl:message select="concat('debug message idno: ', $idno)"/>
<xsl:message select="concat('debug message original title from static metadata: ', if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno]//dc:title else '')"/>
</xsl:if>
- <xsl:copy-of select="if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno] else doc($dnbBookdataQuery)"/>
+ <xsl:variable name="tmp" select="if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno] else doc($dnbBookdataQuery)"/>
+ <xsl:copy-of select="if($tmp//dc:title) then $tmp else doc('static_metadata.xml')//oai:dc[replace(dc:identifier[@xsi:type='tel:ISBN'][1], '-', '')=$idno]"/>
</xsl:variable>
<xsl:variable name="autor"