当前位置:网站首页>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个元素
所以这两个合到一块就是取第三道第六个标签
边栏推荐
- 学go之路(一)go的基本介绍到第一个helloworld
- 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
- Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
- [dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
- C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
- qt颜色与字符串、uint相互转换
- Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer
- [window] when the Microsoft Store is deleted locally, how to reinstall it in three steps
- Chrome view page FPS
- 多线程和并发编程(二)
猜你喜欢
Crawling exercise: Notice of crawling Henan Agricultural University
Week6 weekly report
jmeter性能测试步骤实战教程
(4) Web security | penetration testing | network security web site source code and related analysis
TypeScript接口与泛型的使用
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
Leecode-c language implementation -15 Sum of three ----- ideas to be improved
Detailed explanation | detailed explanation of internal mechanism of industrial robot
杰理之BLE【篇】
Go learning --- use reflection to judge whether the value is valid
随机推荐
How to delete all the words before or after a symbol in word
JMeter performance test steps practical tutorial
[MySQL learning notes 32] mvcc
杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
JDBC learning notes
Brief explanation of instagram operation tips in 2022
leecode-C语言实现-15. 三数之和------思路待改进版
The differences and advantages and disadvantages between cookies, seeion and token
word设置目录
Wonderful use of TS type gymnastics string
杰理之BLE【篇】
Go learning -- implementing generics based on reflection and empty interfaces
Memory error during variable parameter overload
js對象獲取屬性的方法(.和[]方式)
Typescript variable scope
OpenJudge NOI 2.1 1749:数字方格
Bugku CTF daily question: do you want seeds? Blackmailed
【mysql学习笔记30】锁(非教程)
【mysql学习笔记29】触发器
navicat如何导入MySQL脚本