[lxml-dev] Potential bug when using nth-child in CSSSelector

John Evans john at jpevans.com
Sun Jun 22 09:42:59 CEST 2008


Hi All,

I have observed some unexpected behavior with lxml -- I looked in the bug
tracker and didn't see anything that seemed related to this.

daedalus:~ john$ python
Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:61022, Feb 27 2008,
16:52:03)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml.cssselect import CSSSelector
>>> CSSSelector("div div:nth-child(5) div div div:nth-child(3) img").path
"descendant-or-self::div/descendant::*[name() = 'div' and (position() = 5)]"
>>>

It looks like when you use the nth-child member in a CSSSelector it chops
off the rest of the CSSSelector and does not process it when compiling it
down to an xpath.

Is this a bug or am I just doing something stupid?

Thanks,
-
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20080622/9ae6535e/attachment.htm 


More information about the lxml-dev mailing list