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 XPath expressions



On Mon, 21 Mar 2022 at 17:58, Roger L Costello <costello@mitre.org> wrote:
Hi Folks,


The CSS selectors are syntactic sugar (convenient shorthand notations) for equivalent XPath expressions.

er well better to say they have some overlapping functionality.

Anyway you want the CSS + selector here, a CSS selector of latitude + longitude selects the longitude element if immediately following a latitude.

This will display Result = 42.366978, -71.022362

<!DOCTYPE  html>
<html>

  <body>
   
Result = <span id="res"> g</span>  

<person >  <name>John Doe</name>
  <telephone>555-123-4567</telephone>
  <latitude>42.366978</latitude>
  <longitude>-71.022362</longitude>
</person>

 
 
  <script>
    var lng = document.querySelector('latitude + longitude');
    document.getElementById('res').textContent=
    lng.previousElementSibling.textContent + ', ' +
    lng.textContent ;
   </script>
   
   


[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