首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

position()

XSLT / XPath参考:XSLT元素, EXSLT函数,XPath函数,XPath轴

position函数从表达式评估上下文返回一个等于上下文位置的数字。

句法

代码语言:javascript
复制
position()

返回

与表达式评估上下文中的上下文位置相等的整数。

注意

  • 请注意,节点在上下文中的位置不是从零开始的。第一个节点的位置为1。
  • 上下文由路径的其余部分决定。
代码语言:javascript
复制
<xsl:template match="//a[position() = 5]">
 <!-- this template matches the fifth a element 
         anywhere in the document. -->
</xsl:template>
代码语言:javascript
复制
<xsl:template match="//div[@class='foo']/bar[position() = 1]">
 <!-- this template matches the first bar element that is
      a child of a div element with a class attribute equal to "foo" -->
</xsl:template>

定义

gecko支持

支持的。

扫码关注腾讯云开发者

领取腾讯云代金券