Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions mir-module/src/main/resources/xslt/import/mods2mycoreobject.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="#all">

<xsl:param name="parentId" />

<xsl:output method="xml" encoding="UTF-8" indent="yes" />

<xsl:template match="/">
<mycoreobject>
<xsl:if test="string-length($parentId) &gt; 0">
<structure>
<parents class="MCRMetaLinkID" notinherit="true" heritable="false">
<parent xlink:type="locator" xlink:href="{$parentId}" />
</parents>
</structure>
</xsl:if>
<metadata>
<def.modsContainer class="MCRMetaXML" heritable="false" notinherit="true">
<modsContainer inherited="0">
<xsl:copy-of select="mods:mods"/>
</modsContainer>
</def.modsContainer>
</metadata>
</mycoreobject>
</xsl:template>

</xsl:stylesheet>
36 changes: 36 additions & 0 deletions mir-module/src/main/resources/xslt/import/remove-genres.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="#all">

<xsl:mode on-no-match="shallow-copy" />

<xsl:template match="mods:genre" />

<xsl:template match="mods:identifier[@type='isbn']" >
<xsl:variable name="isbn" select="translate(text(),'-','')" />
<xsl:variable name="valid_isbn">
<xsl:choose>
<xsl:when test="translate($isbn,'123456789X','0000000000') = '0000000000000' and (starts-with($isbn,'978') or starts-with($isbn,'979')) ">
<xsl:value-of select="text()" />
</xsl:when>
<xsl:when test="translate($isbn,'123456789X','0000000000') = '0000000000' ">
<xsl:value-of select="text()" />
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="string-length($valid_isbn) &gt; 0">
<mods:identifier type="isbn">
<xsl:value-of select="text()" />
</mods:identifier>
</xsl:if>
</xsl:template>

<xsl:template match="mods:relatedItem/@otherType[../@type]">
<!-- MIR-1120 remove @otherType if @type is present -->
</xsl:template>

</xsl:stylesheet>
Loading