[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: CSS selectors are syntactic sugar for XPathexpressions

  • From: "Liam R. E. Quin" <liam@fromoldbooks.org>
  • To: "Simon St.Laurent" <simonstl@simonstl.com>, xml-dev@l...
  • Date: Mon, 21 Mar 2022 21:13:13 -0400

Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.