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

new picaxml to metadata xml transformation

parent d943e194
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:pica="info:srw/schema/5/picaXML-v1.0"
>
<xsl:output indent="yes"/> <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> <publication>
<ssoar> <ssoar>
<wgl> <wgl>
...@@ -13,11 +26,11 @@ ...@@ -13,11 +26,11 @@
</contributor> </contributor>
</ssoar> </ssoar>
<dc> <dc>
<source> <!--source>
<journal> <journal>
Deutsches Schiffahrtsarchiv Deutsches Schiffahrtsarchiv
</journal> </journal>
</source> </source-->
<language>de</language> <language>de</language>
<rights> <rights>
<licence>3</licence> <licence>3</licence>
...@@ -34,75 +47,99 @@ ...@@ -34,75 +47,99 @@
<issn>0343-3668</issn> <issn>0343-3668</issn>
</identifier> </identifier>
</dc> </dc>
<xsl:apply-templates select="pica:record" />
<xsl:variable name="preferredMainTitle" select="datafield[tag='039I']/subfield[code='t']/content" /> </publication>
<xsl:variable name="mainTitle"> </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:choose>
<xsl:when test="$preferredMainTitle != ''"> <xsl:when test="string-length(/pica:record/pica:datafield[@tag='039I']/pica:subfield[@code='t']/text()) > 0">
<xsl:value-of select="$preferredMainTitle" /> <xsl:value-of select="/pica:record/pica:datafield[@tag='039I']/pica:subfield[@code='t']/text()"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <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:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </title>
</dc>
<xsl:for-each select="datafield[tag='021A']"> </xsl:template>
<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>
<xsl:for-each select="datafield[tag='031A']"> <xsl:template match="pica:datafield[@tag='031A']">
<dc> <dc>
<source> <source>
<volume> <xsl:if test="pica:subfield[@code='d']/text()">
<xsl:value-of select="subfield[code='d']/content"/> <volume>
</volume> <xsl:value-of select="pica:subfield[@code='d']/text()"/>
<pageinfo> </volume>
<xsl:value-of select="subfield[code='h']/content"/> </xsl:if>
</pageinfo> <xsl:if test="pica:subfield[@code='h']/text()">
<pageinfo>
<xsl:value-of select="pica:subfield[@code='h']/text()"/>
</pageinfo>
</xsl:if>
</source> </source>
<date> <xsl:if test="pica:subfield[@code='j']/text()">
<issued> <date>
<xsl:value-of select="subfield[code='j']/content"/> <issued>
</issued> <xsl:value-of select="pica:subfield[@code='j']/text()"/>
</date> </issued>
</dc> </date>
</xsl:for-each> </xsl:if>
<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>
</dc> </dc>
</xsl:for-each> </xsl:template>
<xsl:for-each select="datafield[tag='028C']"> <xsl:template match="pica:datafield[@tag='028A']">
<dc> <dc>
<contributor> <contributor>
<author> <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> </author>
</contributor> </contributor>
</dc> </dc>
</xsl:for-each> </xsl:template>
<xsl:template match="pica:datafield[@tag='027D']">
<xsl:for-each select="datafield[tag='009P']"> <dc>
<dc> <source>
<identifier> <journal>
<url> <xsl:value-of select="pica:subfield[@code='a']/text()"/>
<xsl:value-of select="subfield[code='a']/content"/> </journal>
</url> </source>
</identifier> </dc>
</dc>
</xsl:for-each>
</publication>
</xsl:template> </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> </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