xslt语法之---If Else

大家都知道,XSL中是没有if else的,那么要想实现if else该怎么办呢?

其实很简单

<xsl:choose>
        <xsl:when test="position()=1"> 
        </xsl:when>

       <xsl:otherwise> 
       </xsl:otherwise>
</xsl:choose>
上面when相当于if,otherwise相当于else。外面的<xsl:choose>一定不能少,when标签里的test是加条件的地方,返回值是boolean类型。position()是XSLT的函数。
 
posted @ 2013-12-13 15:43  cRaZy_TyKeIo  阅读(1748)  评论(0)    收藏  举报