From 1866095aab179d19db0bf4068b4df4ccb657daca Mon Sep 17 00:00:00 2001
From: David Maus <maus@hab.de>
Date: Fri, 6 Oct 2017 12:28:11 +0200
Subject: [PATCH] =?UTF-8?q?BEACON=20f=C3=BCr=20Edition=20erstellen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Makefile                           |  4 ++++
 resources/xproc/edition/beacon.xsl | 31 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 resources/xproc/edition/beacon.xsl

diff --git a/Makefile b/Makefile
index 94a423bd..dbd48c0a 100644
--- a/Makefile
+++ b/Makefile
@@ -34,5 +34,9 @@ sitemap:
 repository:
 	calabash.cmd -o public/repertorium.xml resources/xproc/repertorium/oais.xpl
 
+.PHONY: beacon
+beacon: linkmap
+	transform.cmd -o:public/beacon.txt -xsl:resources/xproc/edition/beacon.xsl resources/daten/edition/diarium/linkmap.xml
+
 .PHONY: publish
 publish: mets linkmap sitemap solr deploy
diff --git a/resources/xproc/edition/beacon.xsl b/resources/xproc/edition/beacon.xsl
new file mode 100644
index 00000000..987c2164
--- /dev/null
+++ b/resources/xproc/edition/beacon.xsl
@@ -0,0 +1,31 @@
+<xsl:transform version="2.0"
+               xpath-default-namespace="http://docs.oasis-open.org/ns/xri/xrd-1.0"
+               xmlns:tei="http://www.tei-c.org/ns/1.0"
+               xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:output method="text" encoding="utf-8"/>
+
+  <xsl:template match="XRDS">
+    <xsl:text>#FORMAT: BEACON&#10;</xsl:text>
+    <xsl:text>#PREFIX: http://d-nb.info/gnd/&#10;</xsl:text>
+    <xsl:text>#TARGET: http://selbstzeugnisse.hab.de/{ID}&#10;</xsl:text>
+    <xsl:text>#VERSION: 0.1&#10;</xsl:text>
+    <xsl:text>#CONTACT: maus@hab.de&#10;</xsl:text>
+    <xsl:text>#INSTITUTION: Herzog August Bibliothek Wolfenbüttel&#10;</xsl:text>
+    <xsl:text>#TIMESTAMP: </xsl:text><xsl:value-of select="format-date(current-date(), '[Y]-[M01]-[D01]')"/><xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="Link">
+    <xsl:variable name="gndUri" select="document(@href)/tei:idno[starts-with(., 'http://d-nb.info/gnd/')]"/>
+    <xsl:if test="$gndUri">
+      <xsl:value-of select="substring-after($gndUri, 'http://d-nb.info/gnd/')"/>
+      <xsl:text>||</xsl:text>
+      <xsl:value-of select="substring-after(../Subject, 'http://selbstzeugnisse.hab.de/')"/>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="text()"/>
+  
+</xsl:transform>
-- 
GitLab