Re: CSS selectors are syntactic sugar for XPath expressions

"Liam R. E. Quin" <[email protected]>
Newsgroups gmane.text.xml.devel
Message-ID <[email protected]>
On Mon, 2022-03-21 at 16:49 -0400, Simon St.Laurent wrote:
> I, um, don't think you've met many CSS developers?  Selectors came 
> first, and there are definitely selectors without XPath equivalents.

And lots of XPath without CSS equivalents - even with XPath 1, CSS
can't look at element content and XPath can. Find all table cells whose
string value, interpreted as a number, is negative... XPath easy, CSS
nope. Find all paragraphs with an even number of span element children
- XPath easy, CSS nope.

Which came first depends on whether you see XPath as a natural
evolution of HyTime and TEI Pointers combined with the needs of DSSSL,
or as something new, but then, CSS was influenced by Grif.

Many CSS selectors can be translated into XPath expressions; you need
to add some functions, such as active() and hover(), and to find a
different mechanism to cope with pseudo-elements such as ::before, and
you may need a mechanism like XSLT's current() to implement some things
(i'm thinking e.g. of form controls and their labels).

But i agree, it's not about syntactic sugar :)

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: [email protected]
subscribe: [email protected]
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.