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

> > * 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 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]

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