logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

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

Subject: Re: xpath: stop at first match
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.

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

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

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.

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".

. . . . . . . . . . . . . Ken

--
UBL/XML/XSLT/XSL-FO training:         Vårø, Denmark 06-09-25/10-06
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 
mailto:gkholman-22ZyzlhMEbWyOc6Qk57J4laTQe2KTcn/@public.gmane.org
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/o/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/o/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


<Prev in Thread] Current Thread [Next in Thread>