From 0f360ac4df5283842813b81be3a7e940c4a71aae Mon Sep 17 00:00:00 2001
From: David Maus <maus@hab.de>
Date: Fri, 23 Mar 2018 14:06:40 +0100
Subject: [PATCH] Normalisiere @ID der physischen Struktur

---
 src/xslt/mets.xsl | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/xslt/mets.xsl b/src/xslt/mets.xsl
index 814cb31..49ecdf7 100644
--- a/src/xslt/mets.xsl
+++ b/src/xslt/mets.xsl
@@ -107,6 +107,16 @@
     </metsHdr>
   </xsl:template>
 
+  <xsl:template match="@ID[parent::div/fptr][ancestor::structMap/@TYPE = 'PHYSICAL']">
+    <xsl:variable name="fileId" select="fun:normalize-fileId(key('files', ../fptr/@FILEID))"/>
+    <xsl:attribute name="ID" select="fun:normalize-physId($fileId)"/>
+  </xsl:template>
+
+  <xsl:template match="@xlink:to[parent::smLink]">
+    <xsl:variable name="fileId" select="fun:normalize-fileId(key('files', /mets/structMap/div/div[@ID = current()]/fptr/@FILEID))"/>
+    <xsl:attribute name="xlink:to" select="fun:normalize-physId($fileId)"/>
+  </xsl:template>
+
   <xsl:template match="@ID[parent::file]">
     <xsl:attribute name="ID" select="fun:normalize-fileId(..)"/>
   </xsl:template>
-- 
GitLab