rob*_*ing 9 xslt xpath xpath-2.0
鉴于这篇XML
<dc:date>info:eu-repo/date/embargoEnd/2013-06-12</dc:date>
<dc:date>2012-07-04</dc:date>
Run Code Online (Sandbox Code Playgroud)
我需要使用XSL只输出字符串的年份而不是以 info:eu-repo.我正在尝试这种方式,但它不起作用.我错了for-each?
<xsl:if test="not(starts-with('dc:date', 'info:eu-repo'))">
<xsl:for-each select="dc:date">
<publicationYear>
<xsl:variable name="date" select="."/>
<xsl:value-of select="substring($date, 0, 5)"/>
</publicationYear>
</xsl:for-each>
</xsl:if>
Run Code Online (Sandbox Code Playgroud)
DRC*_*RCB 19
我猜您'在start-with查询中不需要,并且您可能希望以稍微不同的方式迭代日期:
<xsl:for-each select="dc:date">
<xsl:variable name="date" select="."/>
<xsl:if test="not(starts-with($date, 'info:eu-repo'))">
<publicationYear>
<xsl:value-of select="substring($date, 0, 5)"/>
</publicationYear>
</xsl:if>
</xsl:for-each>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
52339 次 |
| 最近记录: |