• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

antchfx / xpath
78%
master: 78%

Build:
Build:
LAST BUILD BRANCH: fix-ancestor-predicate-chain
DEFAULT BRANCH: master
Repo Added 08 May 2017 11:19AM UTC
Files 8
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH fix-ancestor-predicate-chain
branch: fix-ancestor-predicate-chain
CHANGE BRANCH
x
Reset
  • fix-ancestor-predicate-chain
  • 0.1
  • 1.1.0
  • master
  • refs/tags/v1.3.0
  • refs/tags/v1.3.1
  • refs/tags/v1.3.2
  • refs/tags/v1.3.3
  • refs/tags/v1.3.4
  • refs/tags/v1.3.5
  • v1.0.0
  • v1.1.0
  • v1.1.1
  • v1.1.10
  • v1.1.11
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.1.5
  • v1.1.6
  • v1.1.7
  • v1.1.8
  • v1.1.9
  • v1.2.0

09 Nov 2025 09:33PM UTC coverage: 78.01% (+0.03%) from 77.98%
19214782526

Pull #119

github

mislav
Fix chained predicates on ancestor axis

The XPath expression with chained predicates on the ancestor axis was not
working correctly. For example:
  //*[@itemprop="author"][ancestor::*[@itemscope][1][@itemtype="Comment"]]

This expression should find all elements with @itemprop="author" whose first
@itemscope ancestor has @itemtype="Comment". However, it was returning 0
results instead of the expected elements.

Root cause:
1. ancestorQuery.table (deduplication table) was persisting across Evaluate()
   calls, preventing ancestors from being found for subsequent input contexts.
2. filterQuery.positmap (position map) was not being reset during Evaluate(),
   causing position tracking to be incorrect when the same predicate query was
   reused for multiple input nodes.

Fix:
- Reset ancestorQuery.table to nil in Evaluate() to ensure clean state for
  each evaluation
- Reset filterQuery.positmap to nil in Evaluate() to ensure clean state for
  each evaluation

These changes ensure that when a predicate query is evaluated multiple times
(once for each candidate node), the internal state is properly reset, allowing
the query to work correctly for each evaluation.

💁 Unit test by Mislav
🤖 Implementation by [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Pull Request #119: Fix chained predicates on ancestor axis

4 of 4 new or added lines in 1 file covered. (100.0%)

2313 of 2965 relevant lines covered (78.01%)

232.11 hits per line

Relevant lines Covered
Build:
Build:
2965 RELEVANT LINES 2313 COVERED LINES
232.11 HITS PER LINE
Source Files on fix-ancestor-predicate-chain
  • Tree
  • List 8
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
19214782526 fix-ancestor-predicate-chain Fix chained predicates on ancestor axis The XPath expression with chained predicates on the ancestor axis was not working correctly. For example: //*[@itemprop="author"][ancestor::*[@itemscope][1][@itemtype="Comment"]] This expression should f... Pull #119 09 Nov 2025 09:34PM UTC mislav github
78.01
See All Builds (153)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc