当前位置:网站首页>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 learning -- implementing generics based on reflection and empty interfaces
- Typescript indexable type
- C - Inheritance - polymorphism - virtual function member (lower)
- 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
- Scala language learning-08-abstract classes
- TypeScript 接口属性
- TypeScript 可索引类型
- Simulation of Teman green interferometer based on MATLAB
- Emo diary 1
- When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
猜你喜欢

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

Twelve rules for naming variables

Set picture annotation in markdown
![[cf gym101196-i] waif until dark network maximum flow](/img/66/6b339fc23146b5fbdcd2a1fa0a2349.png)
[cf gym101196-i] waif until dark network maximum flow

Force buckle day31

合规、高效,加快药企数字化转型,全新打造药企文档资源中心

opencv学习笔记八--答题卡识别
![If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]](/img/57/12a97ab3d2dabfaf06bbe1788450cf.png)
If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]

Do you really think binary search is easy

【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
随机推荐
Week6 weekly report
Word delete the contents in brackets
Simple and understandable high-precision addition in C language
jmeter性能测试步骤实战教程
杰理之AD 系列 MIDI 功能说明【篇】
洛谷P1836 数页码 题解
Typescript void base type
Full Score composition generator: living on code
杰理之BLE【篇】
C - Inheritance - hidden method
GET/POST/PUT/PATCH/DELETE含义
杰理之普通透传测试---做数传搭配 APP 通信【篇】
leecode-C語言實現-15. 三數之和------思路待改進版
opencv学习笔记八--答题卡识别
杰理之需要修改 gatt 的 profile 定义【篇】
js對象獲取屬性的方法(.和[]方式)
C intercept string
【mysql学习笔记29】触发器
Ble of Jerry [chapter]
[MySQL learning notes 30] lock (non tutorial)