W3C home > Mailing lists > Public > www-style@w3.org > October 2007

Re: Proposal of [attr/=regex] selector

From: Peter Moulder <Peter.Moulder@infotech.monash.edu.au>
Date: Tue, 23 Oct 2007 11:48:17 +1000
To: Nikodem <freyjkell@gmail.com>
Cc: www-style <www-style@w3.org>
Message-id: <20071023014817.GA7420@bowman.infotech.monash.edu.au>

On Sun, Oct 21, 2007 at 11:20:31AM +0200, Nikodem wrote:

> I would like to propose the selector that match elements with attribute 
> which value is OK with a Perl regular expression, i.e.:
>
> [attr/=/[0-9a-z]+/i]
>
> // matches:
> // <x attr="123Abc"/>
> // does not:
> // <x attr="123Abc:)"/>

What is the use case?  At present, lots of software has incomplete
support for CSS.  Adding more features to CSS makes it less likely for
existing features to be added.  Regular expression implementation is
non-trivial; this feature would be costly for small devices (mobile
phones) for a feature that is rarely needed.  Could the intended use
case be achieved with XSLT or scripting?
http://www.w3.org/TR/xquery-operators/#func-matches provides regular
expression matching that can be used from XSLT 2.0.  XSLT
(http://www.w3.org/TR/xslt20/) and more specifically XPath
(http://www.w3.org/TR/xpath20/) provides more powerful selectors than
CSS, and the output of XSLT can use CSS.  OTOH, XSLT is typically used
server-side rather than client-side.  This is good for reproducibility,
but may limit how it interacts with client-specific information (user
style sheets, @media selectors etc.).

(I've only limited experience with XSLT, btw.)

pjrm.
Received on Tuesday, 23 October 2007 01:49:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:55 GMT