Commit 2fdf0db
committed
fix: XPath following, following-sibling, preceding, preceding-sibling for multiple node
## Why?
See: #251 (comment)
- XPath : a/d/preceding::* => ["d", "c", "b"]
```xml
<a>
<b/> <!-- a/d/preceding::b -->
<c/> <!-- a/d/preceding::c -->
<d/> <!-- a/d/preceding::d -->
<d/> <!-- self -->
<e/>
<f/>
</a>
```
- XPath : a/d/following::* => ["d", "e", "f"]
```xml
<a>
<b/>
<c/>
<d/> <!-- self -->
<d/> <!-- a/d/following::d -->
<e/> <!-- a/d/following::e -->
<f/> <!-- a/d/following::f -->
</a>
```
- XPath : a/b/x/following-sibling:* => ["c", "d", "e"]
```xml
<a>
<b>
<x/> <!-- self -->
<c/> <!-- a/b/x/following-sibling::c -->
<d/> <!-- a/b/x/following-sibling::d -->
</b>
<b>
<x/> <!-- self -->
<e/> <!-- a/b/x/following-sibling::e -->
</b>
</a>
```
- XPath : a/b/x/following-sibling:* => ["c", "d", "x", "e"]
```xml
<a>
<b>
<x/> <!-- self -->
<c/> <!-- a/b/x/following-sibling::c -->
<d/> <!-- a/b/x/following-sibling::d -->
<x/> <!-- a/b/x/following-sibling::x -->
<e/> <!-- a/b/x/following-sibling::e -->
</b>
</a>
```
- XPath : a/b/x/preceding-sibling::* => ["e", "d", "c"]
```xml
<a>
<b>
<c/> <!-- a/b/x/preceding-sibling::c -->
<d/> <!-- a/b/x/preceding-sibling::d -->
<x/> <!-- self -->
</b>
<b>
<e/> <!-- a/b/x/preceding-sibling::e -->
<x/> <!-- self -->
</b>
</a>
```
- XPath : a/b/x/preceding-sibling::* => ["e", "x", "d", "c"]
```xml
<a>
<b>
<c/> <!-- a/b/x/preceding-sibling::c -->
<d/> <!-- a/b/x/preceding-sibling::d -->
<x/> <!-- a/b/x/preceding-sibling::x -->
<e/> <!-- a/b/x/preceding-sibling::e -->
<x/> <!-- self -->
</b>
</a>
```
- XPath : //a/x/following-sibling:*[1] => ["w", "x", "y", "z"]
```xml
<div>
<div>
<a/> <-- self -->
<w/> <-- //a/x/following-sibling:*[1] -->
</div>
<a/> <-- self -->
<x/> <-- //a/x/following-sibling:*[1] -->
<a/> <-- self -->
<y/> <-- //a/x/following-sibling:*[1] -->
<a/> <-- self -->
<z/> <-- //a/x/following-sibling:*[1] -->
</div>
```1 parent de6f40e commit 2fdf0db
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
419 | 454 | | |
420 | 455 | | |
421 | 456 | | |
422 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
423 | 462 | | |
424 | 463 | | |
425 | 464 | | |
| |||
0 commit comments