XSLT(4) control statement

本文详细介绍了XSL中的关键指令,包括if语句用于条件判断、choose用于多条件选择、for-each实现循环操作以及如何使用to操作符创建整数序列。此外还提到了在输出中如何正确处理特殊字符。

<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;




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值