Edgewall Software

Opened 16 years ago

Closed 16 years ago

#271 closed defect (fixed)

XPath gets lost when indexing children

Reported by: anonymous Owned by: cmlenz
Priority: major Milestone: 0.6
Component: XPath support Version: 0.5.1
Keywords: xpath Cc:

Description

[Sorry if my terminology is inaccurate, but I am no XML expert...]

Here is what I do:

from genshi.input import html
from genshi.filters import Transformer
html = HTML('<ul><li>item1<ul><li>subitem11</li></ul></li><li>item2<ul><li>subitem21</li></ul></li></ul>')
print html | Transformer('li[1]/ul').attr('attribute', 'value')

Then I do get what I expect (sub-ul of first top-level li selected):

<ul><li>item1<ul attribute="value"><li>subitem11</li></ul></li><li>item2<ul><li>subitem21</li></ul></li></ul>

But if:

print html | Transformer('li[2]/ul').attr('attribute', 'value')

I would expect that sub-ul of second top-level li be selected), but here is what I get:

<ul><li>item1<ul><li>subitem11</li></ul></li><li>item2<ul><li>subitem21</li></ul></li></ul>

In other words: nothing is selected.

Change History (2)

comment:1 Changed 16 years ago by cmlenz

  • Component changed from General to XPath support
  • Milestone changed from 0.5.2 to 0.6

This seems to work correctly on the SoC XPath refactoring branch.

comment:2 Changed 16 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Okay, the branch has been integrated, and I've added a test for this behavior in [1043:1044].

Note: See TracTickets for help on using tickets.