Commit e3a9c39d authored by Steinberg, Jan's avatar Steinberg, Jan

new picaxml to metadata xml transformation

parent d943e194
Pipeline #9676 failed with stages
in 49 seconds
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:pica="info:srw/schema/5/picaXML-v1.0"
>
<xsl:output indent="yes"/>
<xsl:template match="/record">
<xsl:strip-space elements="*"/>
<!-- <xsl:message terminate="no">here is the tree at the current node <xsl:copy-of select="."/> </xsl:message> -->
<!-- <xsl:message terminate="no">here is some message for stderr, e.g. <xsl:value-of select='text()' /> </xsl:message> -->
<!--
<xsl:for-each select="./*">
<xsl:message terminate="no">a child=<xsl:value-of select="name()"/></xsl:message>
</xsl:for-each>
-->
<xsl:template match="/">
<publication>
<ssoar>
<wgl>
......@@ -13,11 +26,11 @@
</contributor>
</ssoar>
<dc>
<source>
<!--source>
<journal>
Deutsches Schiffahrtsarchiv
</journal>
</source>
</source-->
<language>de</language>
<rights>
<licence>3</licence>
......@@ -34,75 +47,99 @@
<issn>0343-3668</issn>
</identifier>
</dc>
<xsl:variable name="preferredMainTitle" select="datafield[tag='039I']/subfield[code='t']/content" />
<xsl:variable name="mainTitle">
<xsl:apply-templates select="pica:record" />
</publication>
</xsl:template>
<xsl:template match="pica:record">
<xsl:apply-templates select="pica:datafield[@tag='021A']"/>
<xsl:apply-templates select="pica:datafield[@tag='031A']"/>
<xsl:apply-templates select="pica:datafield[@tag='028A']"/>
<xsl:apply-templates select="pica:datafield[@tag='027D']"/>
<xsl:apply-templates select="pica:datafield[@tag='028C']"/>
<xsl:apply-templates select="pica:datafield[@tag='009P']"/>
</xsl:template>
<xsl:template match="pica:datafield[@tag='021A']">
<dc>
<title>
<xsl:choose>
<xsl:when test="$preferredMainTitle != ''">
<xsl:value-of select="$preferredMainTitle" />
<xsl:when test="string-length(/pica:record/pica:datafield[@tag='039I']/pica:subfield[@code='t']/text()) > 0">
<xsl:value-of select="/pica:record/pica:datafield[@tag='039I']/pica:subfield[@code='t']/text()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="datafield[tag='021A']/subfield[code='a']/content" />
<xsl:value-of select="pica:subfield[@code='a']/text()"/>
<xsl:if test="pica:subfield[@code='d']">
<xsl:text>: </xsl:text>
<xsl:value-of select="pica:subfield[@code='d']/text()"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="datafield[tag='021A']">
<dc>
<title>
<xsl:value-of select="$mainTitle"/><xsl:if test="subfield[code='d']">: <xsl:value-of select="subfield[code='d']/content"/></xsl:if>
</title>
</dc>
</xsl:for-each>
</title>
</dc>
</xsl:template>
<xsl:for-each select="datafield[tag='031A']">
<xsl:template match="pica:datafield[@tag='031A']">
<dc>
<source>
<volume>
<xsl:value-of select="subfield[code='d']/content"/>
</volume>
<pageinfo>
<xsl:value-of select="subfield[code='h']/content"/>
</pageinfo>
<xsl:if test="pica:subfield[@code='d']/text()">
<volume>
<xsl:value-of select="pica:subfield[@code='d']/text()"/>
</volume>
</xsl:if>
<xsl:if test="pica:subfield[@code='h']/text()">
<pageinfo>
<xsl:value-of select="pica:subfield[@code='h']/text()"/>
</pageinfo>
</xsl:if>
</source>
<date>
<issued>
<xsl:value-of select="subfield[code='j']/content"/>
</issued>
</date>
</dc>
</xsl:for-each>
<xsl:for-each select="datafield[tag='028A']">
<dc>
<contributor>
<author>
<xsl:value-of select="subfield[code='a']/content"/>, <xsl:value-of select="subfield[code='d']/content"/>
</author>
</contributor>
<xsl:if test="pica:subfield[@code='j']/text()">
<date>
<issued>
<xsl:value-of select="pica:subfield[@code='j']/text()"/>
</issued>
</date>
</xsl:if>
</dc>
</xsl:for-each>
<xsl:for-each select="datafield[tag='028C']">
</xsl:template>
<xsl:template match="pica:datafield[@tag='028A']">
<dc>
<contributor>
<author>
<xsl:value-of select="subfield[code='a']/content"/>, <xsl:value-of select="subfield[code='d']/content"/>
<xsl:value-of select="pica:subfield[@code='a']/text()"/>, <xsl:value-of select="pica:subfield[@code='d']/text()"/>
</author>
</contributor>
</dc>
</xsl:for-each>
<xsl:for-each select="datafield[tag='009P']">
<dc>
<identifier>
<url>
<xsl:value-of select="subfield[code='a']/content"/>
</url>
</identifier>
</dc>
</xsl:for-each>
</publication>
</xsl:template>
<xsl:template match="pica:datafield[@tag='027D']">
<dc>
<source>
<journal>
<xsl:value-of select="pica:subfield[@code='a']/text()"/>
</journal>
</source>
</dc>
</xsl:template>
<xsl:template match="pica:datafield[@tag='028C']">
<dc>
<contributor>
<author>
<xsl:value-of select="pica:subfield[@code='a']/text()"/>, <xsl:value-of select="pica:subfield[@code='d']/text()"/>
</author>
</contributor>
</dc>
</xsl:template>
<xsl:template match="pica:datafield[@tag='009P']">
<dc>
<identifier>
<url>
<xsl:value-of select="pica:subfield[@code='a']/text()"/>
</url>
</identifier>
</dc>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment