Skip to content
Snippets Groups Projects
Commit a1abbddd authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

Convert authors etc. to the corresponding TEI header statement

parent d4f40dc0
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="UTF-8"/>
<xsl:key name="author" match="md:agent[@role='author'] | md:author" use="."/>
<xsl:key name="sponsor" match="md:agent[@role='sponsor']" use="."/>
<xsl:key name="funder" match="md:agent[@role='funder']" use="."/>
<xsl:key name="contributor" match="md:agent[@role='contributor']" use="."/>
<xsl:template match="/">
<teiHeader>
......@@ -17,6 +21,8 @@
<xsl:call-template name="convert-authorlike">
<xsl:with-param name="role">author</xsl:with-param>
<xsl:with-param name="canonical" select="true()"/>
</xsl:call-template>
<xsl:call-template name="convert-authorlike">
<xsl:with-param name="role">sponsor</xsl:with-param>
......@@ -303,14 +309,37 @@ and fill out source information in that edition's metadata.</xsl:comment>
</date>
</xsl:template>
<xsl:template name="convert-authorlike">
<xsl:template name="convert-authorlike-old">
<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:param name="canonical" select="false()"/>
<xsl:for-each select=".//md:agent[@role = $role]">
<xsl:element name="{$element}">
<xsl:copy-of select="@*"/>
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<!-- This template converts author-like elements that should not be converted to a respStmt.
-->
<xsl:template name="convert-authorlike">
<!-- The role from the TG metadata. There must be a key defined for that role. -->
<xsl:param name="role" />
<!-- The TEI element -->
<xsl:param name="element" select="$role"/>
<xsl:param name="canonical" select="false()"/>
<xsl:for-each select=".//md:agent[@role = $role][count(. | key($role, .)[1]) = 1]">
<xsl:element name="{$element}">
<xsl:if test="$canonical and (@id != '')">
<xsl:attribute name="key">
<xsl:value-of select="@id" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="." />
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment