当前位置:网站首页>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个元素
所以这两个合到一块就是取第三道第六个标签
边栏推荐
- 【MySQL学习笔记32】mvcc
- Typescript void base type
- 洛谷P4127 [AHOI2009]同类分布 题解
- Cf1036c class numbers solution
- Emo diary 1
- opencv学习笔记八--答题卡识别
- Jerry's general penetration test - do data transmission with app Communication [article]
- Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
- Ble of Jerry [chapter]
- TypeScript 可索引类型
猜你喜欢
杰理之BLE【篇】
When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
[CF Gym101196-I] Waif Until Dark 网络最大流
Excel的相关操作
How MySQL merges data
Google may return to the Chinese market after the Spring Festival.
JDBC learning notes
Bugku CTF daily question: do you want seeds? Blackmailed
qt颜色与字符串、uint相互转换
If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]
随机推荐
[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps
1015 reversible primes (20 points) prime d-ary
opencv学习笔记九--背景建模+光流估计
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
Google可能在春节后回归中国市场。
word中把帶有某個符號的行全部選中,更改為標題
Scala语言学习-08-抽象类
[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code
杰理之AD 系列 MIDI 功能说明【篇】
数字IC设计笔试题汇总(一)
Fundamentals of C language 9: Functions
Ble of Jerry [chapter]
Emo diary 1
#systemverilog# 可綜合模型的結構總結
Word delete the contents in brackets
C - Inheritance - hidden method
Cf1036c class numbers solution
How MySQL merges data
Twelve rules for naming variables
C语言 简单易懂的高精度加法