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

Re: MicroXPath proposal

  • From: Liam R E Quin <liam@w3.org>
  • To: John Cowan <cowan@ccil.org>
  • Date: Sat, 15 Jan 2011 16:09:09 -0500

Re:  MicroXPath proposal
On Fri, 2011-01-14 at 13:45 -0500, John Cowan wrote:
> On Thu, Jan 13, 2011 at 10:01 PM, Liam R E Quin <liam@w3.org> wrote:
> 
> > I think you have to ask why people use XPath.
> 
> For lots of reasons, of course.  But MicroXPath is meant for embedded
> use in a MicroXML package in a general-purpose programming language,
> not for any sort of MicroXSLT or MicroXQuery.

Thanks for replying!

I'd argue that if you're using XPath to select elements you're indeed
using it as a (simple) query language...

> > * find the partNumer attribute of an element containing a particular
> > string (or of all such elements)
> 
> Given the element, it's trivial to get the attribute.  So contains()
> is a good thing.

Yes. Note, in XPath 2 there's the much-asked-for matches() function from
expath/exslt.

> > * find all sibling elements of a given match (most often, preceding or
> >  following siblings, e.g. trying to match an HTLM "section" delimited
> >  by h_n_ elements)
> > * match HTML class attributes (requires concat() and contains())
> > * match any HTML heading (h1|h2|...)
> 
> Those sound useful.  I'll think about how to support them.


> >> One principle is that since elements are the only kind of node in the
> >> MicroXPath data model, XPath expressions return only lists of
> >> elements.
> >
> > I think people will want lists of attributes too.

I should have said, lists of attribute values. One change in XPath 2 is
to add sequences, so you can have an expression that just returns (say)
a list of integers. It turns out this can be massively useful in exactly
your target environment, and if you keep it to nodes and strings, it
doesn't actually make the language larger, just removes a restriction
and makes the language more useful.

This is a large part of the success of JQuery - the insight that getting
all the way there with the query language can often remove any need for
cumbersome navigation.

  $("div.staff span.dayslate").css("color: red");

is clear to anyone used to JavaScript in a Web browser (once you accept
a function whose name is "$" of course!)...

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.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.