Xslt & Xpath参考手册
XPath 函数 | XPath Functions
position()
XSLT / XPath参考:XSLT元素, EXSLT函数,XPath函数,XPath轴
该position
函数从表达式评估上下文返回一个等于上下文位置的数字。
句法
position()
返回
与表达式评估上下文中的上下文位置相等的整数。
注意
- 请注意,节点在上下文中的位置不是从零开始的。第一个节点的位置为1。
- 上下文由路径的其余部分决定。
<xsl:template match="//a[position() = 5]">
<!-- this template matches the fifth a element
anywhere in the document. -->
</xsl:template>
<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>
定义
XPath 1.0 4.1
gecko支持
支持的。
XPath 函数 | XPath Functions相关
XSLT 是扩展样式表转换语言 的外语缩写,这是一种对 XML(标准通用标记语言的子集)文档进行转化的语言,XSLT 中的 T 代表英语中的“转换”(Transformation)。它是 XSL(eXtensible Stylesheet Language)规范的一部分