Commit 66c4e4be authored by Steinberg, Jan's avatar Steinberg, Jan

xsl optimizations plus additional setSpec filter in xsl

parent 7efb1956
...@@ -34,7 +34,22 @@ ...@@ -34,7 +34,22 @@
<xsl:template match="/"> <xsl:template match="/">
<xsl:element name="bundle"> <xsl:element name="bundle">
<xsl:element name="metadata"> <xsl:element name="metadata">
<xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc" /> <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, '10419_48639 ;'))" >
<xsl:value-of select="error(QName('','filteraway'), 'is not in set 10419_48639')" />
</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:element> </xsl:element>
</xsl:template> </xsl:template>
...@@ -136,14 +151,7 @@ ...@@ -136,14 +151,7 @@
<xsl:with-param name="key" select="'dc.source.series'"/> <xsl:with-param name="key" select="'dc.source.series'"/>
<xsl:with-param name="language" select="''"/> <xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="substring-before(substring-after(., 'Series: '), ' ;')"/> <xsl:with-param name="value" select="substring-before(substring-after(., 'Series: '), ' ;')"/>
</xsl:call-template> </xsl:call-template>
<xsl:if test="/OAI-PMH/GetRecord/record/metadata/oai_dc:dc/dc:type[starts-with(.,'doc-type')] != 'doc-type:book'">
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.contributor.corporateeditor'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="'381'"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains(., ' ; ')"> <xsl:if test="contains(., ' ; ')">
<xsl:call-template name="new-metadatum"> <xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.source.volume'"/> <xsl:with-param name="key" select="'dc.source.volume'"/>
...@@ -590,27 +598,35 @@ ...@@ -590,27 +598,35 @@
</xsl:template> </xsl:template>
<xsl:template match="dc:publisher"> <xsl:template match="dc:publisher">
<xsl:choose> <xsl:if test="not(//dc:type/text() = 'doc-type:article')">
<xsl:when test="contains(text(), ': ')"> <xsl:choose>
<xsl:call-template name="new-metadatum"> <xsl:when test="contains(text(),'Wissenschaftszentrum Berlin')">
<xsl:with-param name="key" select="'dc.publisher.city'"/> <xsl:call-template name="new-metadatum">
<xsl:with-param name="language" select="''"/> <xsl:with-param name="key" select="'dc.contributor.corporateeditor'"/>
<xsl:with-param name="value" select="substring-before(text(), ': ')"/> <xsl:with-param name="language" select="''"/>
</xsl:call-template> <xsl:with-param name="value" select="'381'"/>
<xsl:call-template name="new-metadatum"> </xsl:call-template>
<xsl:with-param name="key" select="'dc.publisher'"/> <xsl:call-template name="new-metadatum">
<xsl:with-param name="language" select="''"/> <xsl:with-param name="key" select="'dc.publisher.city'"/>
<xsl:with-param name="value" select="normalize-space(substring-after(text(), ': '))"/> <xsl:with-param name="language" select="''"/>
</xsl:call-template> <xsl:with-param name="value" select="Berlin"/>
</xsl:when> </xsl:call-template>
<xsl:otherwise> </xsl:when>
<xsl:call-template name="new-metadatum"> <xsl:when test="contains(text(), ': ')">
<xsl:with-param name="key" select="'dc.publisher'"/> <xsl:call-template name="new-metadatum">
<xsl:with-param name="language" select="''"/> <xsl:with-param name="key" select="'dc.publisher.city'"/>
<xsl:with-param name="value" select="normalize-space(text())"/> <xsl:with-param name="language" select="''"/>
</xsl:call-template> <xsl:with-param name="value" select="substring-before(text(), ': ')"/>
</xsl:otherwise> </xsl:call-template>
</xsl:choose>
<xsl:call-template name="new-metadatum">
<xsl:with-param name="key" select="'dc.publisher'"/>
<xsl:with-param name="language" select="''"/>
<xsl:with-param name="value" select="normalize-space(substring-after(text(), ': '))"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="dc:subject[starts-with(.,'ddc:')]"> <xsl:template match="dc:subject[starts-with(.,'ddc:')]">
......
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