当前位置:网站首页>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个元素
所以这两个合到一块就是取第三道第六个标签
边栏推荐
- TypeScript void 基础类型
- Key value judgment in the cycle of TS type gymnastics, as keyword use
- Emo diary 1
- Typescript variable scope
- Significance and measures of encryption protection for intelligent terminal equipment
- Résumé de la structure du modèle synthétisable
- Structure summary of SystemVerilog integrable model
- JMeter performance test steps practical tutorial
- JDBC learning notes
- Bit operation XOR
猜你喜欢
Go learning -- implementing generics based on reflection and empty interfaces
[cf gym101196-i] waif until dark network maximum flow
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer
【mysql学习笔记30】锁(非教程)
学go之路(一)go的基本介绍到第一个helloworld
Redis builds clusters
How to delete all the words before or after a symbol in word
If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]
ORACLE列转行--某字段按指定分隔符转多行
随机推荐
[cf gym101196-i] waif until dark network maximum flow
After the hot update of uniapp, "mismatched versions may cause application exceptions" causes and Solutions
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
杰理之如若需要大包发送,需要手机端修改 MTU【篇】
烧录场景下的源代码防泄密方案分享
智能终端设备加密防护的意义和措施
Related operations of Excel
Multithreading and concurrent programming (2)
TypeScript接口与泛型的使用
ORACLE列转行--某字段按指定分隔符转多行
Supervisor usage document
jmeter性能测试步骤实战教程
[MySQL learning notes 29] trigger
C - Inheritance - hidden method
杰理之AD 系列 MIDI 功能说明【篇】
Ble of Jerry [chapter]
Ble of Jerry [chapter]
杰理之BLE【篇】
Simulation of Teman green interferometer based on MATLAB
Methods for JS object to obtain attributes (. And [] methods)