Lists Home |
Date Index |
> Is it a mistake for XPath to try to incorporate so much of XQuery, or is
> this what users really want?
Jeni's answered many of the technical issues, but just to pick up on
this question which goes I think to the heart of the problem.
The way the question is phrased highlights the warped view of history
that has caused Xpath2 to be so alien. Xpath is an existing language,
and Xquery is just a draft spec, so the question shouldn't be about
Xpath incorporating Xquery, but rather
Why has Xquery failed to pick up on so many of the lessons learned from
over two years of Xpath use?
Look at the only comparable thing to supporting schema types in Xpath1
DTD ID support and the id() function. Have users been crying out for
more of this? No! The usual advice is to use xsl defined keys instead.
- dereferences -- id(), which does basically the same thing, is
very rarely used because people tend to want to make their
stylesheets robust in case DTDs aren't available for some reason,
so use key() instead. I don't see that dereferencing will be any
different, although if it used XML Schema identity constraints it
would be a lot more compelling
Using XSL keys allows you to tune your index to the needs of the
stylesheet rather than whatever features the author of the dtd/schema
for that document type thought might be useful things to index on. They
also protect the stylesheet from optional behaviour by XML parsers which
might or might not report the ID information.
So what does Xpath 2 do?
Firstly it provides the bizarre => operator which is a restricted
version of id(), then for all the new types it stresses the id()
approach of inferring type information which might possibly be supplied
by a suitable parser, rather than the approach that has proved far more
robust, allowing the stylesheet to specify what types it wants to use
for the content of certain elements.
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.