Hi,
I'm not sure if this is the right place to report this, but I believe I've found something in the MODS to DC XSLT (MODS3-5_DC_XSLT1-
0.xsl) that could be fixed.
We were getting empty dc:subject elements in our XML from the following template:
<xsl:template match="mods:subject[mods:topic | mods:name | mods:occupation | mods:geographic | mods:hierarchicalGeographic |
mods:cartographics | mods:temporal] ">
<dc:subject>
<xsl:for-each select="mods:topic | mods:occupation">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:for-each>
<xsl:for-each select="mods:name">
<xsl:call-template name="name"/>
</xsl:for-each>
</dc:subject>
This was from MODS records that had mods:geographic elements, for instance, but no mods:topic, mods:occupation, or mods:name elements.
My solution was to wrap the dc:subject that is generated for mods:topic or mods:occupation elements, and mods:name elements, in an xsl:test
to make sure one of those exists before outputting the dc:subject element:
<xsl:if test="mods:topic | mods:occupation | mods:name">
<dc:subject>
<xsl:for-each select="mods:topic | mods:occupation">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">--</xsl:if>
</xsl:for-each>
<xsl:for-each select="mods:name">
<xsl:call-template name="name"/>
</xsl:for-each>
</dc:subject>
</xsl:if>
I've attached a patch as well (which may more clearly illustrate the change). If there is some place else (a GitHub repository, for
instance) to which I should report this, please let me know.
Thanks,
Kevin
|