当前位置:网站首页>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个元素
所以这两个合到一块就是取第三道第六个标签
边栏推荐
- C - Inheritance - polymorphism - virtual function member (lower)
- Full Score composition generator: living on code
- 洛谷P1836 数页码 题解
- 可变参数重载时的内存错误
- 成为优秀的TS体操高手 之 TS 类型体操前置知识储备
- JDBC learning notes
- Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
- Word setting directory
- Ble of Jerry [chapter]
- 烧录场景下的源代码防泄密方案分享
猜你喜欢
![[MySQL learning notes 30] lock (non tutorial)](/img/9b/1e27575d83ff40bebde118b925f609.png)
[MySQL learning notes 30] lock (non tutorial)

C - Inheritance - polymorphism - virtual function member (lower)

Related operations of Excel

Google may return to the Chinese market after the Spring Festival.

jmeter性能测试步骤实战教程

Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume

Simulation of Michelson interferometer based on MATLAB

Crawling exercise: Notice of crawling Henan Agricultural University
![Ble of Jerry [chapter]](/img/ed/32a5d045af8876d7b420ae9058534f.png)
Ble of Jerry [chapter]

Bugku CTF daily question: do you want seeds? Blackmailed
随机推荐
Basics of reptile - Scratch reptile
Scala语言学习-08-抽象类
OpenJudge NOI 2.1 1749:数字方格
Luogu p4127 [ahoi2009] similar distribution problem solution
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
chrome查看页面fps
Go learning -- implementing generics based on reflection and empty interfaces
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
【mysql学习笔记30】锁(非教程)
Multi attribute object detection on rare aircraft data sets: experimental process using yolov5
C语言 简单易懂的高精度加法
杰理之需要修改 gatt 的 profile 定义【篇】
超级浏览器是指纹浏览器吗?怎样选择一款好的超级浏览器?
杰理之BLE【篇】
Full Score composition generator: living on code
The way to learn go (I) the basic introduction of go to the first HelloWorld
word怎么只删除英语保留汉语或删除汉语保留英文
Games101 Lesson 7 shading 1 Notes
The differences and advantages and disadvantages between cookies, seeion and token