XSLT 运算符 和 记录一些用过的语句

来源:互联网 发布:美国留学 费用 知乎 编辑:程序博客网 时间:2024/04/27 13:41

Google

<script type="text/javascript">google_ad_client = "pub-5033576919944123";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_type = "text_image";//2007-10-24: csdn.bloggoogle_ad_channel = "8548491739";</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
1、运算符与特殊字符

/   选择子元素,返回左侧元素的直接子元素;如果“/”位于最左侧表示选择根结点的直接子元素 
//  递归下降,不论深度,搜索指定的元素;如果位于最左侧表示从根结点出发递归下降搜索指定元素 
.   表示当前元素 
*  通配符,选择任意元素,不考虑名字 
@ 取得属性值,作为属性名的前缀 
@* 通配符,选择任意属性,不考虑名字 
: 名字作用范围分隔符,将名字作用范围前缀与元素或属性名分隔开来 
!* 在相关节点上应用指定方法 
()* 分组,明确指定优先顺序 
[] 应用过滤样式 
[]* 下标运算符,用于在集合中指示元素 

2、逻辑运算符(比较运算符)

比较运算符 可选样式 描述 
and $and$或&& 逻辑与 
or $or$或|| 逻辑或 
not() $not$ 逻辑非 

3、关系运算符

= $eq$ 相等 
= $ieq$ 相等(不区分大小写) 
!= $ne$ 不等 
$ine$ 不等(不区分大小写) 
< $lt$ 小于 
$ilt$ 小于(不区分大小写) 
< = $le$ 小于等于 
$ile$ 小于等于(不区分大小写) 
> $gt$ 大于 
$igt$ 大于(不区分大小写) 
>= $ge$ 大于等于 
$ige$ 大于等于(不区分大小写) 
$all$ 集合运算符,如果集合中所有项目均满足条件则返回“真” 
$any$ 集合运算符,如果集合中任意项目满足条件则返回“真” 
| 集合运算符,返回两个集合的联合 

Record ":


<xsl:param name="start" />
<xsl:variable name="middle" select="$start + 2" />
<xsl:variable name="total" select="count(//product)" />

<xsl:variable name="toprange" select="/products/product[position() &gt;= $start and position() &lt;= $middle]" />
  <xsl:variable name="bottomrange" select="/products/product[position() &gt;= $middlePlusOne and position() &lt;= $end]" />

  <xsl:variable name="templastBegin" select="$total div 6" />
  <xsl:variable name="templastEnd" select="$total mod 2" />
  <xsl:variable name="lastBegin" select="substring($templastBegin,1,1) * 6 + 1" />

<xsl:variable name="src">
                                 <xsl:value-of select="Image" />
                               </xsl:attribute>
 


<script type="text/javascript">google_ad_client = "pub-5033576919944123";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_type = "text_image";//2007-10-24: csdn.bloggoogle_ad_channel = "8548491739";</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击