加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 如何在XSLT中实现if-else语句?

发布时间:2020-12-16 02:02:50 所属栏目:百科 来源:网络整理
导读:我试图在XSLT中实现一个if -else语句,但我的代码只是不解析。有没有任何想法? xsl:variable name="CreatedDate" select="@createDate"/ xsl:variable name="IDAppendedDate" select="2012-01-01" / bdate: xsl:value-of select="$CreatedDate"//b xsl:if t
我试图在XSLT中实现一个if -else语句,但我的代码只是不解析。有没有任何想法?
<xsl:variable name="CreatedDate" select="@createDate"/>
  <xsl:variable name="IDAppendedDate" select="2012-01-01" />
  <b>date: <xsl:value-of select="$CreatedDate"/></b> 

  <xsl:if test="$CreatedDate > $IDAppendedDate">
    <h2> mooooooooooooo </h2>
  </xsl:if>
  <xsl:else>
    <h2> dooooooooooooo </h2>
  </xsl:else>
您必须使用< xsl:choose>标签:
<xsl:choose>
         <xsl:when test="$CreatedDate > $IDAppendedDate">
           <h2> mooooooooooooo </h2>
         </xsl:when>
         <xsl:otherwise>
          <h2> dooooooooooooo </h2>
         </xsl:otherwise>
       </xsl:choose>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读