当前位置:网站首页>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个元素
所以这两个合到一块就是取第三道第六个标签
边栏推荐
- 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
- Bit operation XOR
- Scala语言学习-08-抽象类
- [window] when the Microsoft Store is deleted locally, how to reinstall it in three steps
- C # create database connection object SQLite database
- The difference between TS Gymnastics (cross operation) and interface inheritance
- Ble of Jerry [chapter]
- Set picture annotation in markdown
- 2022年Instagram运营小技巧简单讲解
- The differences and advantages and disadvantages between cookies, seeion and token
猜你喜欢

Summary of Digital IC design written examination questions (I)

杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
![Ble of Jerry [chapter]](/img/d8/d080ccaa4ee530ed21d62755808724.png)
Ble of Jerry [chapter]

JMeter performance test steps practical tutorial
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics

NiO programming introduction

数字经济时代,如何保障安全?

数字IC设计笔试题汇总(一)

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

Week6 weekly report
随机推荐
杰理之普通透传测试---做数传搭配 APP 通信【篇】
Twelve rules for naming variables
Crawling exercise: Notice of crawling Henan Agricultural University
How to delete all the words before or after a symbol in word
word中把帶有某個符號的行全部選中,更改為標題
When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
JDBC learning notes
Multi attribute object detection on rare aircraft data sets: experimental process using yolov5
The way to learn go (II) basic types, variables and constants
智能终端设备加密防护的意义和措施
Set picture annotation in markdown
If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]
[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
Seriously recommend several machine learning official account
Methods for JS object to obtain attributes (. And [] methods)
Scala language learning-08-abstract classes
chrome查看页面fps
(4) Web security | penetration testing | network security web site source code and related analysis
Introduction to the basics of network security