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

doabooks - xsl-editing

parent 6d983105
Loading
Loading
Loading
Loading
+53 −8
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@
                <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:with-param name="value" select="'true'"/>
                </xsl:call-template>
                
                <xsl:call-template name="new-metadatum">
@@ -126,10 +126,29 @@
        </xsl:call-template>
    </xsl:template>
    <xsl:template match="marcxml:datafield[@tag='100']/child::node()[@code='a']">
        <xsl:variable name="authorNameOptimized">
            <xsl:choose>
                <xsl:when test="contains(text(), ',')">
                    <xsl:value-of select="text()"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:analyze-string select="text()" regex="^(.*) (.*)$">
                        <xsl:matching-substring>
                            <xsl:value-of select="regex-group(2)"/>
                            <xsl:text>, </xsl:text>
                            <xsl:value-of select="regex-group(1)"/>
                        </xsl:matching-substring>
                        <xsl:non-matching-substring>
                            <xsl:value-of select="."/>
                        </xsl:non-matching-substring>
                    </xsl:analyze-string>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <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:with-param name="value" select="$authorNameOptimized"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template match="marcxml:datafield[@tag='245']/child::node()[@code='a']">
@@ -210,12 +229,12 @@
                <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="'10501'"/>
                    <xsl:with-param name="value" select="'10500'"/>
                </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="'10501'"/>
                    <xsl:with-param name="value" select="'10500'"/>
                </xsl:call-template>
                <xsl:call-template name="new-metadatum">
                    <xsl:with-param name="key" select="'internal.identifier.classoz'"/>
@@ -232,12 +251,12 @@
                <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="'10501'"/>
                    <xsl:with-param name="value" select="'10500'"/>
                </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="'10501'"/>
                    <xsl:with-param name="value" select="'10500'"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="text() = 'Political theory'">
@@ -258,14 +277,33 @@
        <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:with-param name="value" select="replace(replace(text(),' +?, +?','; '),' +; +?','; ')"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template match="marcxml:datafield[@tag='700']/child::node()[@code='a']">
        <xsl:variable name="authorNameOptimized">
            <xsl:choose>
                <xsl:when test="contains(text(), ',')">
                    <xsl:value-of select="text()"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:analyze-string select="text()" regex="^(.*) (.*)$">
                        <xsl:matching-substring>
                            <xsl:value-of select="regex-group(2)"/>
                            <xsl:text>, </xsl:text>
                            <xsl:value-of select="regex-group(1)"/>
                        </xsl:matching-substring>
                        <xsl:non-matching-substring>
                            <xsl:value-of select="."/>
                        </xsl:non-matching-substring>
                    </xsl:analyze-string>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <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:with-param name="value" select="$authorNameOptimized"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template match="marcxml:datafield[@tag='720']/child::node()[@code='a']">
@@ -302,6 +340,13 @@
                <xsl:with-param name="value" select="text()"/>
            </xsl:call-template>
        </xsl:if>
        <xsl:if test="starts-with(text(), 'https://doi.org/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="replace(text(),'https://doi.org/','')"/>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>
    <xsl:template match="marcxml:datafield[@tag='856']/child::node()[@code='z']">
        <xsl:choose>