XSLT(4) control statement

来源:互联网 发布:推广网站源码 编辑:程序博客网 时间:2024/04/28 20:32

<xsl:if>

The if statement is Necessary when you want to test if a sequence is empty or not.
<xsl:if test="expression">
  ...some output if the expression is true...
</xsl:if>

<xsl:choose>

<xsl:choose>
  <xsl:when test="expression">
    ... some output ...
  </xsl:when>
  <xsl:otherwise>
    ... some output ....
  </xsl:otherwise>
</xsl:choose>

<xsl:for-each>

<xsl:for-each select="expression">
... some output ...
</xsl:for-each>

Sequences of integers with to operator

You can create an integer sequence with the to operator
1 to 5

<xsl:for-each select="1 to 5"><br /></xsl:for-each>

Filtering illegal characters

Some characters needs to be escape
Greater than( > ) needs to be escaped as  &gt;
Less than( < ) needs to be escaped as &lt;




原创粉丝点击