[lxml-dev] case-insensitive xpath search
Stefan Behnel
stefan_ml at behnel.de
Wed May 16 21:42:34 CEST 2007
Paul Eipper wrote:
> I wonder if this is the right place to ask, but I am trying to run a
> case-insensitive search on a XML using lxml XPath.
>
> This is the current search (not case-insensitive):
>
> keyword = "what to find"
> o.xpath( '//*[ contains( @*, "%s" ) ]' % keyword )
>
> how could I make that be a case-insensitive search ?
It will be easy to do in lxml 1.3, as it will support regexps.
http://codespeak.net/lxml/dev/xpathxslt.html#the-xpath-class
http://www.exslt.org/regexp/index.html
If you don't want to wait: have you tried if the translate() function from
XSLT is available?
Stefan
More information about the lxml-dev
mailing list