This comment is reply for 5369 sumim: その手がありましたか!って、もはや悪のり...(除算・余剰を使わずに閏年). Go to thread root.
turugina #7311(2008/08/24 19:53 GMT) [ XSLT ] Rating0/0=0.00
そうか、その手が。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" > <xsl:output method="text" /> <xsl:template match="/" > <xsl:for-each select="1900 to 2100"> <xsl:variable name="thisYear" as="xs:date" select="xs:date(fn:concat(xs:string(.), '-01-01'))" /> <xsl:variable name="nextYear" as="xs:date" select="xs:date(fn:concat(xs:string(1+.), '-01-01'))" /> <xsl:if test="fn:days-from-duration($nextYear - $thisYear)=366"> <xsl:value-of select="." /> <xsl:text> 年は閏年♪
</xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Rating0/0=0.00-0+
[ reply ]
turugina
#7311()
[
XSLT
]
Rating0/0=0.00
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" > <xsl:output method="text" /> <xsl:template match="/" > <xsl:for-each select="1900 to 2100"> <xsl:variable name="thisYear" as="xs:date" select="xs:date(fn:concat(xs:string(.), '-01-01'))" /> <xsl:variable name="nextYear" as="xs:date" select="xs:date(fn:concat(xs:string(1+.), '-01-01'))" /> <xsl:if test="fn:days-from-duration($nextYear - $thisYear)=366"> <xsl:value-of select="." /> <xsl:text> 年は閏年♪
</xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>Rating0/0=0.00-0+