Move buchpreis detection logic to Makefile
Resolves #40
diff --git a/Makefile b/Makefile
index 68848e2..6c11c6f 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,9 @@
$(TARGET_DIR)/%.i5.xml: $(BUILD_DIR)/% xslt/epub2i5.xsl xslt/idsCorpus-template.xml
mkdir -p $(TARGET_DIR)
echo "Converting $< to $@"
- $(SAXON) -xsl:xslt/epub2i5.xsl $(shell find $< -name "*.opf") > $@ || (sleep 5 && $(SAXON) -xsl:xslt/epub2i5.xsl $(shell find $< -name "*.opf") > $@) || (echo "WARN: ignoring invalid $@" && > $@)
+ $(SAXON) -xsl:xslt/epub2i5.xsl $(shell find $< -name "*.opf") $(shell if cat `find $< -name originalPath.xml` | grep -iq buchpreis; then echo buchpreis=1; fi)> $@ || \
+ (sleep 5 && $(SAXON) -xsl:xslt/epub2i5.xsl $(shell find $< -name "*.opf") $(shell if cat `find $< -name originalPath.xml` | grep -iq buchpreis; then echo buchpreis=1; fi) > $@) || (echo "WARN: ignoring invalid $@" && > $@)
+
%.zip: %.i5.xml
tei2korapxml -l warn -s -tk - < $< > $@
diff --git a/xslt/epub2i5.xsl b/xslt/epub2i5.xsl
index e2ab62f..75cb451 100644
--- a/xslt/epub2i5.xsl
+++ b/xslt/epub2i5.xsl
@@ -34,7 +34,7 @@
</xsl:choose>
</xsl:variable>
- <xsl:variable name="original_path" select="document(resolve-uri('../originalPath.xml', base-uri(/)))/originalPath"/>
+ <xsl:param name="buchpreis"/>
<xsl:variable name="dnbBookdataQuery" as="xs:string">
<xsl:value-of disable-output-escaping="yes" select="concat('https://services.dnb.de/sru/dnb?version=1.1&operation=searchRetrieve&query=', $idno_type, '%3D', $idno, '&recordSchema=oai_dc')"/>
@@ -382,7 +382,7 @@
<biblScope type="vol"/>
<biblScope type="volume-title"/>
</monogr>
- <xsl:if test="matches($original_path, 'Buchpreis', 'i')">
+ <xsl:if test="$buchpreis">
<xsl:element name="note">
<xsl:attribute name="type">award</xsl:attribute>
<xsl:attribute name="subtype">