Commit 1af3fe8c authored by Gerrit Hübbers's avatar Gerrit Hübbers 🃏
Browse files

WIP.

parent 4b3c412e
......@@ -341,16 +341,14 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
map.put("nlm", xMetaDissPlusXsltString);
/*
String oaiDcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/jsaa-oai_dc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
getResourceAsStream("xslt/interculture-oai_dc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
*/
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("http://www.interculture-journal.com/index.php/icj/oai/", map);
Bundle bundle = bss.getBundle("oai:www.interculture-journal.com:article/273");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
......@@ -369,6 +367,9 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertEquals(2, metadata.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.misc", "icj-273") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "2196-9485") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "http://www.interculture-journal.com/index.php/icj/article/view/273") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "Vietnam: Economic Strategy and Economic Reality") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Fforde, Adam") ) );
......
......@@ -92,7 +92,7 @@
</xsl:template>
<xsl:template match="nlm:issn[@pub-type='epub']">
<xsl:message terminate="no">here is some message for stderr1, e.g. <xsl:value-of select='@xml:lang' /> </xsl:message>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
......@@ -146,6 +146,17 @@
</xsl:call-template>
</xsl:template>
<xsl:template match="nlm:self-uri[ not(@content-type) ]">
<xsl:message terminate="no">here is some message for stderr1, e.g. <xsl:value-of select='@xlink:href' /> </xsl:message>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.url'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="@xlink:href"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:title">
<xsl:variable name="publicationLanguage" select="/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/xMetaDiss:xMetaDiss/dc:language[@xsi:type='dcterms:ISO639-2']" />
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
xmlns:cc="http://www.d-nb.de/standards/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:ddb="http://www.d-nb.de/standards/ddb/"
xmlns:dini="http://www.d-nb.de/standards/xmetadissplus/type/"
xmlns:doi="http://www.d-nb.de/standards/doi/"
xmlns:hdl="http://www.d-nb.de/standards/hdl/"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:nlm="http://dtd.nlm.nih.gov/publishing/2.3"
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:pc="http://www.d-nb.de/standards/pc/"
xmlns:thesis="http://www.ndltd.org/standards/metadata/etdms/1.0/"
xmlns:urn="http://www.d-nb.de/standards/urn/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xMetaDiss="http://www.d-nb.de/standards/xmetadissplus/"
xmlns:xoai="http://www.lyncode.com/xoai"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:zoai="http://git.gesis.org/dda/zoai">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- <xsl:copy-of select="."/> -->
<!-- <xsl:message terminate="no">here is some message for stderr, e.g. <xsl:value-of select='text()' /> </xsl:message> -->
<!-- override default template -->
<xsl:template match="*" />
<xsl:template match="/">
<xsl:element name="bundle">
<xsl:element name="metadata">
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc">
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="dc:language">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage( text() )" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.language'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$sanitizedLanguage"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="new-metadatum">
<xsl:param name="key" />
<xsl:param name="language" />
<xsl:param name="value" />
<xsl:element name="metadatum">
<xsl:element name="key">
<xsl:value-of select="$key" />
</xsl:element>
<xsl:if test="$language != ''">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage($language)" />
<xsl:element name="language">
<xsl:value-of select="$sanitizedLanguage" />
</xsl:element>
</xsl:if>
<xsl:element name="value">
<xsl:value-of select="$value" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:function name="zoai:sanitizeLanguage">
<xsl:param name="inputLanguage" />
<xsl:choose>
<xsl:when test="$inputLanguage = 'ger'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'eng'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$inputLanguage" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
Supports Markdown
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