turugina #6577(2008/06/24 12:01 GMT) [ XSLT ] Rating0/0=0.00
素直に if を使わない。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xsl:output method="text" /> <xsl:template match="/" > <xsl:for-each select="1 to 9"> <xsl:variable name="i" as="xs:integer" select="." /> <xsl:for-each select="1 to 9"> <xsl:value-of select="$i" /> <xsl:text> * </xsl:text> <xsl:value-of select="." /> <xsl:text> = </xsl:text> <xsl:variable name="elm" as="element()"> <xsl:element name="n"> <xsl:value-of select="$i*." /> </xsl:element> </xsl:variable> <xsl:apply-templates select="$elm" /> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:for-each> </xsl:template> <xsl:template match="n"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="n[.<10]"> <xsl:text> </xsl:text> <xsl:value-of select="." /> </xsl:template> </xsl:stylesheet>
Rating0/0=0.00-0+
[ reply ]
turugina
#6577()
[
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" > <xsl:output method="text" /> <xsl:template match="/" > <xsl:for-each select="1 to 9"> <xsl:variable name="i" as="xs:integer" select="." /> <xsl:for-each select="1 to 9"> <xsl:value-of select="$i" /> <xsl:text> * </xsl:text> <xsl:value-of select="." /> <xsl:text> = </xsl:text> <xsl:variable name="elm" as="element()"> <xsl:element name="n"> <xsl:value-of select="$i*." /> </xsl:element> </xsl:variable> <xsl:apply-templates select="$elm" /> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:for-each> </xsl:template> <xsl:template match="n"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="n[.<10]"> <xsl:text> </xsl:text> <xsl:value-of select="." /> </xsl:template> </xsl:stylesheet>Rating0/0=0.00-0+
[ reply ]