Even if we avoid going down the XPath2 path, adding support for lower-case() is probably something very useful to test attribute values. I have a specific example : when you try to detect headers and footers in a web page, you want to find elements having a class or an ID containing (case insensitive test) for instance "nav" or "head" or "foot".
Created attachment 283346 [details] [diff] [review] tentative patch After years of silent prayers in the shadow of Da SuperReviewer peterv, after years of prosternation murmuring "Ommmmmmmmmmmmm" when He appears, I finally try to follow His (x)path and submit my first XSLT patch...
I'm not a fan of putting these in the null namespace as there are defined places to put extension methods, i.e. non-null namespaces. Ideally we should add this and upper-case() to the exslt:string namespace, but we'd need to contact the exslt guys for that and I'm not sure they are very active still.
Also, this is too late to make firefox 3 as we're way past feature freeze. The upside is that that'd leave us lots of time to talk the exslt folks into adding this.
Option for when you're talking about html4 compat IDs that are restricted to [A-Za-z][A-Za-z0-9:_.-]* <xsl:variable name="ascii_latin_upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:variable name="ascii_latin_lower" select="'abcdefghijklmnopqrstuvwxyz'"/> <xsl:if test="'nav'=translate(@id,$ascii_latin_upper,$ascii_latin_lower)"> <!-- --> </xsl:if>
Comment on attachment 283346 [details] [diff] [review] tentative patch Marking this r- since we need to do something other than mix this with the standard names. Would be great if you raised this on the exslt list. The SetCapacity call also looks redundant, it should be even faster to simply do ToLowerCase(resultStr, strRes->mValue). You could also make strRes a simple raw-pointer to save yourself a couple of refcounts.
cc-ing peterv on this. It'd be very nice for bug 595198.
(In reply to comment #7) > cc-ing peterv on this. It'd be very nice for bug 595198. indeed. I was surprised this wasn't already implemented.
Yeah, I'm starting to think we should just do this.