XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] CSS selectors are syntactic sugar for XPathexpressions

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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS