From d4f40dc0bd9bc27a352d7e02a5f53a39e646f41a Mon Sep 17 00:00:00 2001
From: Thorsten Vitt <thorsten.vitt@uni-wuerzburg.de>
Date: Wed, 27 Mar 2013 16:29:55 +0000
Subject: [PATCH] Added extra rules for author etc.

authors, funders, sponsors and contributors are now no
longer converted to respStmts but rather to the appropriate
TEI elements in the titleStmt.

fixes issue TG-1921 for the aggregator:
TextGrid-MD to TEI mapping is not capturing author etc. in a useful way
https://develop.sub.uni-goettingen.de/jira/browse/TG-1921

git-svn-id: https://develop.sub.uni-goettingen.de/repos/textgrid/trunk/services/aggregator@13860 7c539038-3410-0410-b1ec-0f2a7bf1c452
---
 src/main/resources/md2tei.xsl | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/md2tei.xsl b/src/main/resources/md2tei.xsl
index 79d61bd..805fa8f 100644
--- a/src/main/resources/md2tei.xsl
+++ b/src/main/resources/md2tei.xsl
@@ -14,8 +14,22 @@
                                 <xsl:value-of select="."/>
                             </title>
                         </xsl:for-each>
-
-                        <xsl:for-each select=".//md:agent">
+                        
+                        <xsl:call-template name="convert-authorlike">
+                            <xsl:with-param name="role">author</xsl:with-param>
+                        </xsl:call-template>
+                        <xsl:call-template name="convert-authorlike">
+                            <xsl:with-param name="role">sponsor</xsl:with-param>
+                        </xsl:call-template>
+                        <xsl:call-template name="convert-authorlike">
+                            <xsl:with-param name="role">funder</xsl:with-param>
+                        </xsl:call-template>
+                        <xsl:call-template name="convert-authorlike">
+                            <xsl:with-param name="role">contributor</xsl:with-param>
+                            <xsl:with-param name="element">principal</xsl:with-param>
+                        </xsl:call-template>
+                        
+                        <xsl:for-each select=".//md:agent[@role != 'author' and @role != 'sponser' and @role != 'funder' and @role != 'principal']">
                             <respStmt>
                                 <resp>
                                     <xsl:value-of select="@role"/>
@@ -287,7 +301,16 @@ and fill out source information in that edition's metadata.</xsl:comment>
             </xsl:if>
             <xsl:value-of select="$source"/>
         </date>
-    </xsl:template>
+    </xsl:template>    
 
+    <xsl:template name="convert-authorlike">
+        <xsl:param name="role"/>
+        <xsl:param name="element" select="$role"/>
+        <xsl:for-each select=".//md:generic/md:provided/md:title[@role = $role]">
+            <xsl:element name="{$element}">
+                <xsl:value-of select="."/>
+            </xsl:element>
+        </xsl:for-each>        
+    </xsl:template>
 
 </xsl:stylesheet>
-- 
GitLab