我有這個MODSXSLT選擇採取哪些子元素
<modsCollection>
<mods ID="master">
<originInfo>
<dateOther encoding="8601" type="publication">2016</dateOther>
</originInfo>
<originInfo>
<dateOther encoding="8601" type="onlineFirst">2015</dateOther>
</originInfo>
<originInfo>
<dateOther encoding="8601" type="accepted">2014</dateOther>
</originInfo>
<originInfo>
<dateOther encoding="8601" type="submitted">2013</dateOther>
</originInfo>
</mods>
</modsCollection>
我需要將這一元素dateOther爲等效DC:日期,但我有不同的類型屬性,只需要一dateOther(如果一個刊物存在,我們採取這個日期,否則,如果它不比我們在線第一,如果它不存在,接受等)。
所以在上MODS的情況下,我們將創建
<dc:date>2016</dc:date>
因爲屬性類型=出版物dateOther存在,如果沒有,我們將採取類型= onlineFirst等
日期的順序其他外觀可能不同,只能有一個或多個。
問題開始轉變,我無法選擇所有originInfo/dateOther元素,所以我可以通過選擇
<xsl:template match="//mods:mods[@ID = 'master']/mods:originInfo/mods:dateOther">
<xsl:choose>
<xsl:when test="...">
<dc:date>...</dc:date>
</xsl:when>
...
</xsl:choose>
</xsl:template>
任何幫助解決這將是有益的比較。
請註明是否使用XSLT 1.0或2.0。 –