3.4 xsl:if
xsl:if类似普通程序语言的if条件语句,允许设定节点满足某个条件时,被模板处理。xsl:if的语法格式为:
<xsl:if test=布尔表达式>
template body
</xsl:if>
例如:
<xsl:template match="people">
<xsl:if test="@name">
<p><xsl:value-of select="@name"/></p>
</xsl:if>
</xsl:template>
这段代码的意思是检测people节点下所有的元素,如果发现有<name>元素,则将<name>元素的值输出。其中@符号是统配符,表示节点下所有的元素。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器