W3C home > Mailing lists > Public > www-style@w3.org > April 2005

Re: XPath & CSS, again

From: Pascal Schmitt <pascal@cebra.nu>
Date: Mon, 11 Apr 2005 19:49:09 +0000
Message-Id: <cfd676dca349bd4afb8f7658a62fa3ea@cebra.nu>
Cc: www-style@w3.org
To: Bert Bos <bert@w3.org>


> I think XPath has different goals, viz., selecting not just elements,
> but also individual attributes, comments, etc. And it is meant to be
> used by a different group of people. That is why it has a different
> syntax. Note that not only does it lack special syntax for CLASS
> attributes, it *can't* select on CLASS attributes at all. (With XSLT,
> my estimate is that you need about 50 lines to select an element with a
> certain CLASS. With the new regular expressions in XPath 2.0 it is
> tricky, but possible within XPath.) Clearly that is not what XPath was
> designed for.

Really? I thought it would be enough to use this expression:

//*[(@class = $c) or contains(@class, concat(' ', $c, ' ')) or 
starts-with(@class, concat($c, ' ') or ends-with(@class, concat(' ', 

(okay, it /is/ long, but not 50 lines. )

My intention was not to /replace/ CSS with XPath but to enhance it. 
Especially for generated-content, this would be helpful as there is 
afaik no special CSS-Syntax yet (and you could use XPath 1:1 for 
generated-content, couldn't you?)

Pascal Schmitt
Received on Monday, 11 April 2005 20:36:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:17 UTC