From b22a192950ef1a3b389c89fab85fc0437b467ced Mon Sep 17 00:00:00 2001
From: David Maus <maus@hab.de>
Date: Fri, 16 Feb 2018 10:35:34 +0100
Subject: [PATCH] Referenz auf images normalisiert

URI-Referenz relativ zur METS-Datei in meta/
---
 src/xslt/mets.xsl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/xslt/mets.xsl b/src/xslt/mets.xsl
index f22742e..6ccd8fe 100644
--- a/src/xslt/mets.xsl
+++ b/src/xslt/mets.xsl
@@ -38,6 +38,10 @@
     <xsl:attribute name="FILEID" select="fun:normalize-fileId(key('files', .))"/>
   </xsl:template>
 
+  <xsl:template match="@xlink:href[ancestor::file/@MIMETYPE = 'image/jpeg']">
+    <xsl:attribute name="xlink:href" select="concat('../', tokenize(., '/')[last()])"/>
+  </xsl:template>
+
   <xsl:function name="fun:normalize-fileId" as="xs:string">
     <xsl:param name="file" as="element(file)"/>
     <xsl:value-of select="string-join( ('image', if ($file/../@USE) then lower-case($file/../@USE) else (), tokenize($file/FLocat/@xlink:href, '/')[last()]), '.')"/>
-- 
GitLab