W3C home > Mailing lists > Public > www-style@w3.org > June 2003

Re: XPath as CSS-selectors?

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 18 Jun 2003 09:34:00 -0700 (PDT)
To: Asbjørn Ulsberg <asbjorn.ulsberg@nrk.no>
Cc: "'www-style@w3.org'" <www-style@w3.org>
Message-ID: <Pine.LNX.4.50.0306180922330.31876-100000@dhalsim.dreamhost.com>

On Wed, 18 Jun 2003, [iso-8859-1] Asbjørn Ulsberg wrote:
> What I notice, clearer than with CSS1 and 2, is that the CSS selectors
> just is a way of selecting nodes, exactly like XPath.

More to the point, XPath is like CSS selectors (XPath came after CSS).

CSS Selectors are currently carefully designed for performance. XPath is
not. CSS Selectors also have a terser syntax, and can address parts of
documents that XPath currently cannot (::selection, e.g.).

XPath can also do things which don't fit into the CSS syntax well, e.g.
selecting non-adjacent text ranges.

> In the former versions of CSS I can understand the need of creating a
> syntax for selecting nodes, as there weren't many alternatives in those
> days. Now, however, there are alternatives. We have XPath.

Why not the other way around? Shouldn't XSLT be changed to use CSS
Selectors rather than using XPath?

>   1. The language is already well defined and standardized.

As are CSS selectors.

>   2. It is widely used.

As are CSS selectors.

>   3. It is isolated as a stand-alone language, outside of any
>      other standard (which CSS-selectors isn't).

Yes they are. The CSS3 Selectors spec is independent of any other
language. Indeed it is used by STTS and XBL, both of which are not CSS

>   4. It is imho more powerful than CSS-selectors.

It was not designed for use in dynamic environments, which is a
requirement for the selecting language used in CSS.

Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 18 June 2003 12:31:06 UTC

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