Commit 32d91cd3 authored by Steinberg, Jan's avatar Steinberg, Jan

PoS and null pointer problem

parent de059266
......@@ -244,7 +244,8 @@ public class XsltTransformerOaiPmhBundlesStreamSource implements BundlesStreamSo
LOG.debug("1- filtering away oaiPmhIdentifier={}", oaiPmhIdentifier);
LOG.debug("Error detail: {}", e.getCause().getLocalizedMessage());
resultBundle = null;
break;
// test if this break is really necessary, taken out. STJ
// break;
}
else {
LOG.warn("2- fatalError. Filtering away oaiPmhIdentifier=" + oaiPmhIdentifier, e);
......
......@@ -1068,6 +1068,125 @@ public class XsltTransformerOaiPmhBundlesStreamSourceTest {
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "MISC") ) );
}
@Test
public void getSinglePublicationPos() throws IOException {
Map<String, String> map = new HashMap<>();
String oaiMarcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/pos-oai_marc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_marc", oaiMarcXsltString);
String oaiDcXsltString = IOUtils.toString(
getClass().
getClassLoader().
getResourceAsStream("xslt/pos-oai_dc-2-xmlbundle.xslt"), StandardCharsets.UTF_8);
map.put("oai_dc", oaiDcXsltString);
XsltTransformerOaiPmhBundlesStreamSource bss = new XsltTransformerOaiPmhBundlesStreamSource("http://pathofscience.org/index.php/index/oai/", map);
Bundle bundle = bss.getBundle("oai:ojs.pathofscience.org:article/378");
LOG.info("{}", bundle);
Set<Metadatum> metadata = bundle.getMetadata();
metadata.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.stock", "article") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.type.document", "32") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.journal", "1570") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Mendívil-Portillo, María Aracely") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Gálvez-Bon, Luz Cecilia") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Ibarra-Michel, Juan Pedro") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.contributor.author", "Soto-Karass, José Guadalupe") ) );
assertEquals(4, metadata.stream().filter(m -> m.getKey().equals("dc.contributor.author") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.date.issued", "2017") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "en", "This research shows the results of the implementation of a public cultural policy at the municipal level and has as a main objective to evaluate, from the perspective of the agenda 21 of culture, the program \"Art for social development\" by the Municipal Institute of Art and Culture developed in a secondary-level boarding school located at the Topolobampo community, in the municipality of Ahome, Mexico. A QUAN-QUAL methodology was used with instruments like questionnaires applied to the young participants and interviews with the workshop facilitators and administrative staff. Guitar, painting and theatre workshops were given, through which the development of new artistic expression skills was achieved, as well as contributing to the strengthening of social behaviors such as tolerance, patience and interpersonal communication, among others. It was found the constant need of having permanent programs of integral training, both in the field of artistic training and socio-emotional, giving priority to groups at risk, such as students of the boarding school that mostly come from families of scarce resources, some of the low performance academic and aggressive behavior. The conclusion is that public policies are required to promote greater articulation of education and culture in order to have a stronger impact on the social and cultural inclusion of young people.") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "ru", "В статье изучена трактовка механизма управления предприятием. Авторами исследованы и систематизированы различные точки зрения исследователей о комплексном подходе к процессам взаимодействия различных подсистем, принимающих участие в управленческих процессах. Исследователями определены основные задачи предприятий в современных условиях, содействующие их развитию, доказана необходимость изменений социальной ориентации системы управления в соответствии с адаптацией предприятия к нестабильной среде. Авторами обоснована взаимосвязь эколого-ориентированной деятельности предприятия и его конкурентоспособности. Доказано, что важным аспектом в эффективной реализации экономической составляющей в системе управления предприятием является поддержка динамического равновесия развития.") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.description.abstract", "uk", "У статті досліджено трактування механізму управління підприємством. Авторами вивчені і систематизовані різні точку зору дослідників щодо комплексного підходу до процесу взаємодії різних підсистем, які приймають участь в управлінських процесах. Дослідниками визначені основні завдання підприємств в сучасних умовах, які сприяють їх розвитку, доведено необхідність змін соціальної орієнтації системи управління відповідно до адаптації підприємства до нестабільного середовища. Авторами обґрунтовано взаємозв’язок еколого-орієнтованої діяльності підприємства і його конкурентоспроможності. Доведено, що важливим аспектом в ефективній реалізації економічної складової в системі управління підприємством є підтримка динамічної рівноваги розвитку.") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.issn", "2413-9009") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.url", "http://pathofscience.org/index.php/ps/article/view/378/411") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.language", "en") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.volume", "3") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.source.volume") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.issue", "8") ) );
assertEquals(0, metadata.stream().filter(m -> m.getKey().equals("dc.source.issuetopic") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.source.pageinfo", "2001-2014") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "en", "The Evaluation of Public Policies from the Perspective of the Agenda 21 of Culture: a Case Study") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.title.alternative", "ru", "Управление устойчивым развитием современного предприятия") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("dc.title", "uk", "Управління сталим розвитком сучасного підприємства") ) );
assertEquals(1, metadata.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
assertTrue( metadata.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.22178/pos.25-6") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.dda.reference", "http://pathofscience.org/index.php/index/oai/@@oai:ojs.pathofscience.org:article/378") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.publisher.country", "MISC") ) );
// assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.classoz", "10900") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.classoz", "10200") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.identifier.ddc", "300") ) );
//assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.ddc", "330") ) );
assertTrue( metadata.contains( new SimpleMetadatum("internal.status", "formal und inhaltlich fertig erschlossen") ) );
assertTrue( metadata.contains( new SimpleMetadatum("dc.subject.other", "culture; public policies") ) );
Set<InputStream> fileSet = bundle.getContents();
assertTrue( fileSet.size() >= 2);
// -------
Bundle bundle2 = bss.getBundle("oai:ojs.pathofscience.org:article/172");
LOG.info("{}", bundle2);
Set<Metadatum> metadata2 = bundle2.getMetadata();
metadata2.stream().map(Object::toString).forEach(LOG::info);
assertTrue( metadata2.contains( new SimpleMetadatum("dc.type.stock", "article") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.type.document", "32") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.journal", "1570") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.pubstatus", "1") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Лісова, Сніжана Володимирівна") ) );
// assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Gálvez-Bon, Luz Cecilia") ) );
// assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Ibarra-Michel, Juan Pedro") ) );
// assertTrue( metadata2.contains( new SimpleMetadatum("dc.contributor.author", "Soto-Karass, José Guadalupe") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.contributor.author") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.review", "1") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.description.review") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.date.issued", "2016") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.abstract", "en", "The article analyzes the features of the image of the leading TV-presenters of such channels as \"1+1\", \"Inter\", \"STB\" during 1991-2001. It describes Lyudmila Dobrovolska’s, Svetlana Leontieva’s and Irina Vannikova’s basic image characteristics.") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.abstract", "ru", "В статье проанализированы особенности построения имиджа ключевых ведущих теленовостей таких телеканалов, как  «1+1», «ИНТЕР», «СТБ» в течение 1991-2001 годов. Описаны основные имиджевые характеристики Людмилы Добровольской, Светланы Леонтьевой и Ирины Ванниковой.") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.description.abstract", "uk", "У статті проаналізовано особливості побудови іміджу провідних ведучих таких телеканалів, як «1+1», «ІНТЕР», «СТБ» упродовж 1991-2001 років. Описані основні іміджеві характеристики Людмили Добровольської, Світлани Леонтьєвої та Ірини Ванникової. ") ) );
assertEquals(3, metadata2.stream().filter(m -> m.getKey().equals("dc.description.abstract") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.issn", "2413-9009") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.url", "http://pathofscience.org/index.php/ps/article/view/172/194") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.identifier.url") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.language", "uk") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.volume", "2") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.source.volume") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.rights.licence", "16") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.issue", "5") ) );
assertEquals(0, metadata2.stream().filter(m -> m.getKey().equals("dc.source.issuetopic") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.source.pageinfo", "4.1-4.7") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.source.pageinfo") ).count() );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.title.alternative", "en", "Construction of the image of the leading Ukrainian TV newsreaders of 1991-2001") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.title.alternative", "ru", "Построение имиджа ключевых ведущих украинских теленовостей 1991-2001 годов") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.title", "uk", "Побудова іміджу провідних ведучих українських теленовин 1991-2001 років") ) );
assertEquals(1, metadata2.stream().filter(m -> m.getKey().equals("dc.title") ).count() );
// assertTrue( metadata2.contains( new SimpleMetadatum("dc.identifier.doi", "https://doi.org/10.22178/pos.25-6") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("internal.dda.reference", "http://pathofscience.org/index.php/index/oai/@@oai:ojs.pathofscience.org:article/172") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.publisher.country", "MISC") ) );
// assertTrue( metadata2.contains( new SimpleMetadatum("internal.identifier.classoz", "10900") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.classoz", "10800") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("internal.identifier.ddc", "300") ) );
//assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.ddc", "330") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("internal.status", "formal und inhaltlich fertig erschlossen") ) );
assertTrue( metadata2.contains( new SimpleMetadatum("dc.subject.other", "Image, Lyudmila Dobrovolska, Svetlana Leontieva, Irina Vannikova, TV-presenter, wardrobe, appearance, voice") ) );
Set<InputStream> fileSet2 = bundle2.getContents();
assertEquals( 2, fileSet2.size());
}
@Test
public void getSinglePublicationRegion() throws IOException {
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.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:variable name="sets">
<xsl:for-each select="//oai:setSpec" >
<xsl:value-of select="text()"/>
<xsl:text> ; </xsl:text>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="not(contains($sets, 'ps:Social+Work ;')
or contains($sets, 'ps:Sociology ;')
or contains($sets, 'ps:Culture ;')
or contains($sets, 'ps:Communication ;'))">
<xsl:value-of select="error(QName('','filteraway'), 'is not in defined sets')" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc" />
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc">
<xsl:apply-templates select="dc:title" />
<xsl:apply-templates select="dc:description[@xml:lang='en-US']" />
<xsl:apply-templates select="dc:description[@xml:lang='ru-RU']" />
<xsl:apply-templates select="dc:description[@xml:lang='uk-UA']" />
<xsl:apply-templates select="dc:language" />
<xsl:apply-templates select="dc:source[@xml:lang='en-US']" />
<xsl:apply-templates select="dc:identifier[matches(text(), '^10\..*')]" />
<!--xsl:apply-templates select="dc:type[@xml:lang='en-US']" /-->
<xsl:apply-templates select="dc:relation" />
<xsl:apply-templates select="dc:subject" />
</xsl:template>
<xsl:template match="dc:relation">
<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="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:subject">
<xsl:if test="not(starts-with(text(), 'Sociology') or starts-with(text(), 'JEL Class'))">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.other'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="dc:description[@xml:lang='uk-UA']">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage( text() )" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.abstract'"/>
<xsl:with-param name="language" select="'uk'"/>
<xsl:with-param name="value" select="normalize-space(text())"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:description[@xml:lang='ru-RU']">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage( text() )" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.abstract'"/>
<xsl:with-param name="language" select="'ru'"/>
<xsl:with-param name="value" select="normalize-space(text())"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:description[@xml:lang='en-US']">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage( text() )" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.abstract'"/>
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="normalize-space(text())"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:language">
<xsl:if test="position()=1">
<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:if>
</xsl:template>
<xsl:template match="dc:identifier[matches(text(), '^10\..*')]">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.doi'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="concat('https://doi.org/', text())"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dc:source[@xml:lang='en-US']">
<xsl:variable name="pageinfo" select="tokenize( text(),'; ' )[last()]" />
<xsl:if test="$pageinfo != '' and matches($pageinfo, '^\d+(-\d+)?')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.pageinfo'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$pageinfo"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$pageinfo != '' and matches($pageinfo, '^\w\d+(-\w\d+)?')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.pageinfo'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$pageinfo"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--xsl:template match="dc:type[@xml:lang='en-US']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.other'"/>
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template-->
<xsl:template match="dc:title">
<xsl:variable name="sanitizedLanguage" select="zoai:sanitizeLanguage( @xml:lang )" />
<xsl:variable name="sanitizedMainLanguage" select="zoai:sanitizeLanguage( /oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:language[1] )" />
<xsl:choose>
<xsl:when test="$sanitizedLanguage = $sanitizedMainLanguage">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'"/>
<xsl:with-param name="language" select="$sanitizedLanguage"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$sanitizedLanguage = 'uk' and $sanitizedMainLanguage = ''">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'"/>
<xsl:with-param name="language" select="'uk'"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title.alternative'"/>
<xsl:with-param name="language" select="$sanitizedLanguage"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</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' or $inputLanguage = 'DE' or $inputLanguage = 'de-DE' or $inputLanguage = 'deu'">
<xsl:value-of select="'de'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'eng' or $inputLanguage = 'EN' or $inputLanguage = 'en-US' or $inputLanguage = 'en-GB'">
<xsl:value-of select="'en'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'ukr' or $inputLanguage = 'uk-UA'">
<xsl:value-of select="'uk'" />
</xsl:when>
<xsl:when test="$inputLanguage = 'rus' or $inputLanguage = 'ru-RU'">
<xsl:value-of select="'ru'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$inputLanguage" />
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.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_marc="http://www.openarchives.org/OAI/1.1/oai_marc"
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: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>
-->
<!-- override default template -->
<xsl:template match="*" />
<xsl:template match="/">
<xsl:element name="bundle">
<xsl:element name="metadata">
<xsl:variable name="sets">
<xsl:for-each select="//oai:setSpec" >
<xsl:value-of select="text()"/>
<xsl:text> ; </xsl:text>
</xsl:for-each>
</xsl:variable>
<!--xsl:choose>
<xsl:when test="not(contains($sets, 'ps:Social+Work ;')
or contains($sets, 'ps:Sociology ;')
or contains($sets, 'ps:Culture ;')
or contains($sets, 'ps:Communication ;'))">
<xsl:value-of select="error(QName('','filteraway'), 'is not in defined sets')" />
</xsl:when>
<xsl:otherwise-->
<xsl:variable name="ddaReference" select="concat(oai:OAI-PMH/oai:request[@verb='GetRecord']/text(), '@@', oai:OAI-PMH/oai:request[@verb='GetRecord']/@identifier)" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.dda.reference'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="$ddaReference"/>
</xsl:call-template>
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_marc:oai_marc" />
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:header" />
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.stock'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'article'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.type.document'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'32'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.rights.licence'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'16'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.journal'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1570'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.pubstatus'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.publisher.country'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'MISC'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'ssoar.urn.registration'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'false'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.review'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'1'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'2413-9009'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.status'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'formal und inhaltlich fertig erschlossen'"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="contains($sets,'ps:Social+Work')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'360'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'360'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'20600'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'20600'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($sets,'ps:Sociology')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10200'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10200'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($sets,'ps:Culture')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10000'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10000'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($sets,'ps:Communication')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.ddc'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'300'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'internal.identifier.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10800'"/>
</xsl:call-template>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.subject.classoz'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'10800'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<!--/xsl:otherwise>
</xsl:choose-->
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_marc:oai_marc">
<xsl:apply-templates select="oai_marc:varfield[@tag='022']/child::node()[@label='$a']"/>
<xsl:apply-templates select="oai_marc:varfield[@tag='100']/child::node()[@label='a']"/>
<!--xsl:apply-templates select="oai_marc:varfield[@id='245']/child::node()[@label='a']"/-->
<xsl:apply-templates select="oai_marc:varfield[@tag='520']/child::node()[@label='a']"/>
<!--xsl:apply-templates select="oai_marc:varfield[@id='546']/child::node()[@label='a']"/-->
<xsl:apply-templates select="oai_marc:varfield[@tag='720']/child::node()[@label='a']"/>
<xsl:apply-templates select="oai_marc:varfield[@tag='786']/child::node()[@label='n']"/>
<!--xsl:apply-templates select="oai_marc:varfield[@id='856']/child::node()[@label='u']"/-->
</xsl:template>
<!--xsl:template match="oai_marc:varfield[@tag='022']/child::node()[@label='$a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.identifier.issn'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template-->
<xsl:template match="oai_marc:varfield[@tag='100']/child::node()[@label='a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.contributor.author'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<!--xsl:template match="oai_marc:varfield[@tag='245']/child::node()[@label='a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.title'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template-->
<!--xsl:template match="oai_marc:varfield[@tag='520']/child::node()[@label='a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.description.abstract'"/>
<xsl:with-param name="language" select="'en'"/>
<xsl:with-param name="value" select="normalize-space(text())"/>
</xsl:call-template>
</xsl:template-->
<!--xsl:template match="oai_marc:varfield[@tag='546']/child::node()[@label='a']">
<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="normalize-space(text())"/>
</xsl:call-template>
</xsl:template-->
<xsl:template match="oai_marc:varfield[@tag='720']/child::node()[@label='a']">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.contributor.author'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="oai_marc:varfield[@tag='786']/child::node()[@label='n']">
<xsl:if test="contains(text(), ' Vol ')">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.volume'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="replace(replace(text(), '^.* Vol ', ''), '[, ].*$', '')"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.issue'"/>
<xsl:with-param name="language" select="''"/>