Edgewall Software

Ticket #271 (new defect)

Opened 7 weeks ago

XPath gets lost when indexing children

Reported by: anonymous Owned by: cmlenz
Priority: major Milestone: 0.5.2
Component: General 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.

Attachments

Add/Change #271 (XPath gets lost when indexing children)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cmlenz. Next status will be 'new'
The owner will change from cmlenz to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.