Re: Proposal of [attr/=regex] selector

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 UTC