logo       

Re: xpath: stop at first match: msg#00003

Subject: Re: xpath: stop at first match
On 2006.08.01 21:44 G. Ken Holman wrote:
At 2006-08-01 21:05 -0400, Carlo Moneti wrote:
A "stop on first match" option in xpath strikes me as a highly useful feature. And, in my case, my code would be tighter and more consistent. I'm sorry to get confirmation that it doesn't exist.

In my opinion, W3C and ISO standards properly specify results, not behaviours. Products compete on the implementation of their own behaviours to produce the specified results.

See bottom

Two people, myself included, have told you that the following specifies what you want:

  /topicMap/topic[@id='$id'][1]

Well, not really. Also, I was well aware of this option beforehand. Frankly, the position() function is not relevant, not in function or intended purpose. See below

It would be inappropriate for a standard to dictate *how* that is implemented. In the XSLT world the Saxon processor returns the first without looking beyond, while I believe (though I'm not positive) the XT processor obtains all and then returns the first of them.

That's interesting. Then Saxon must provide a setting or query syntax for this, I presume?

If the implementation of XPath you are using is not lazily implemented, then change it or obtain another that is lazily implemented ... in my opinion the specification is not to blame or to be "fixed".

I only suggested that a "stop-on-first-match" option is very useful and perhaps worthy of being added to the xpath spec.

I agree that a spec should not include how a feature is to be implemented. But I'm suggesting a new feature. You bring up an interesting semantic (if not philosophical) issue in your distinction between specifying "results" rather than "behavoirs"---by which I'm interpreting (from a user's perspective) as "features" and "implementation details". As I understand, the option to return only one item is a "feature" by virtue of the fact that the spec requires that functionality and the query syntax to support it. Apparently, the community has not much noticed that when querying for a known unique value it would be desirable to be able to tell the processor to stop on first match. If and when they do, they may wish to elevate such functionality to a "feature" by assigning a syntax for the option and adding it to the spec. If it's an option, it is by definition a feature, not an implementation detail. In fact, it can only be implemented as an option because only the programmer knows when a query is for a unique item.

Thanks,
Carlo


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe