跟我学XSL(四)<xsl:apply-templates select="report"/> </TABLE> </xsl:template> <xsl:template match="report"> <TR> <TD><xsl:value-of select="class"/></TD> <TD><xsl:apply-templates select="q1"/></TD> <TD><xsl:apply-templates select="q2"/></TD> <TD><xsl:apply-templates select="q3"/></TD> <TD><xsl:apply-templates select="q4"/></TD> </TR> </xsl:template> <xsl:template match="q1|q2|q3|q4"> <!--此处测试产量,如小于等于20则添加一STYLE属性color,其值为red(红色)--> <xsl:if test=".[value() $le$ 20]"> <xsl:attribute name="style">color:red</xsl:attribute> </xsl:if> <xsl:value-of/> </xsl:template> </xsl:stylesheet> 说明: q1|q2|q3|q4 ──标记q1、q2、q3、 上一篇:跟我学XSL(三) 下一篇:用XSLT轻松实现树形折叠导航栏 更多相关文章
|
推荐文章
精彩文章
|