xpath question
Stefan Behnel
stefan.behnel-n05pAM at web.de
Tue Jul 4 06:39:00 EDT 2006
uche.ogbuji at gmail.com wrote:
> bruce wrote:
>> is there anyone with XPath expertise here? i'm trying to figure out if
>> there's a way to use regex expressions with an xpath query? i've seen
>> references to the ability to use regex and xpath/xml, but i'm not sure how
>> to do it...
>>
>> i have a situation where i have something like:
>> /html/table/..../[@class='foo']
>>
>> is it possible to do soomething like [@class~=/fo/] so i'd match the class
>> attribute with fo....
>>
>> i'm trying to parse HTML/Web docs...
>
> 4Suite [1] supports regex in XPath using the EXSLT community standard's
> regex module [2]. It would be something like:
>
> [re:match(@class, 'fo.*']
>
> With the re prefix set as required by the EXSLT module.
Same for lxml, although it's currently only enabled in XSLT:
http://codespeak.net/lxml/api.html#xslt
Guess I should change that for 1.1...
Stefan
More information about the Python-list
mailing list