当前位置:网站首页>xpath中的position()函数使用
xpath中的position()函数使用
2022-07-06 07:33:00 【亚古兽超进化】
只想获取元素的其中几个
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>welcome to my index</title>
</head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
</ul>
</body>
</html>
如何取到第三到第六个li标签
//ul/li[position()>2][position()<5]
//position()位置放在可变的[2]里面
找时li标签先大于二,从第三个开始,然后再找四个li标签
我看了很多人解释position()函数,但是没有说这个是怎么匹配的,我目前的理解是这样的。
解释一下:
position()>2 表示从第三个元素开始取
position()<5 表示取4个元素
所以这两个合到一块就是取第三道第六个标签
边栏推荐
猜你喜欢
![Ble of Jerry [chapter]](/img/00/27486ad68bf491997d10e387c32dd4.png)
Ble of Jerry [chapter]

Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer

Bugku CTF daily question: do you want seeds? Blackmailed

学go之路(一)go的基本介绍到第一个helloworld

qt颜色与字符串、uint相互转换

Crawling exercise: Notice of crawling Henan Agricultural University

Relevant introduction of clip image

杰理之如若需要大包发送,需要手机端修改 MTU【篇】

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Solution to the problem of breakthrough in OWASP juice shop shooting range
随机推荐
If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]
C # connect to SQLite database to read content
Simple and understandable high-precision addition in C language
杰理之需要修改 gatt 的 profile 定义【篇】
Ble of Jerry [chapter]
QT color is converted to string and uint
navicat如何导入MySQL脚本
Significance and measures of encryption protection for intelligent terminal equipment
[MySQL learning notes 29] trigger
#systemverilog# 可綜合模型的結構總結
[MySQL learning notes 32] mvcc
opencv学习笔记九--背景建模+光流估计
word中把帶有某個符號的行全部選中,更改為標題
Simulation of Michelson interferometer based on MATLAB
The way to learn go (I) the basic introduction of go to the first HelloWorld
数字IC设计笔试题汇总(一)
Key value judgment in the cycle of TS type gymnastics, as keyword use
【MySQL学习笔记32】mvcc
OpenJudge NOI 2.1 1661:Bomb Game
leecode-C語言實現-15. 三數之和------思路待改進版