我有以下输出:
<forms>
<form id="15">
<start>2013-12-09</start>
<end>2014-01-05</end>
</form>
</forms>
我想测试当前日期是否等于或大于“开始”且小于或等于“结束”
我将如何对此进行测试?
我的想法是:
<xsl:variable name="fstart">
<xsl:value-of select="start" />
</xsl:variable>
<xsl:variable name="fend">
<xsl:value-of select="end" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$fstart >= currentdate xor currentdate <= $fend ">
<!-- do stuff -->
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
我相信事情是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs">
...
<xsl:for-each select="forms/form">
<xsl:choose>
<xsl:when test="xs:date(start) <= current-date()
and
current-date() <= xs:date(end)">
<!-- in progress -->
</xsl:when>
<xsl:otherwise>
<!-- not started yet or already ended-->
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)