[topicmapmail] xpath: stop at first match

G. Ken Holman gkholman at CraneSoftwrights.com
Sun Jul 30 15:54:45 EDT 2006


At 2006-07-30 13:16 -0400, Carlo Moneti wrote:
>Forgive me if this message seems a bit 
>off-topic. It does however pertain to a topic maps application I'm developing.

XSLT and XPath questions would be better posted to the following list:

   http://www.mulberrytech.com/xsl/xsl-list

There are a number of subscribers who would 
enthusiastically respond to such questions.

There is also an *excellent* XSLT FAQ at:

   http://www.dpawson.co.uk

>I've looked around around quite a bit, but I 
>can't seem to determine whether there is an 
>xpath expression construct that would cause the 
>processor to stop upon finding the first match 
>(as opposed to always scanning the whole document for all possible matches).

I'm not sure what you mean by "always scanning 
the whole document", and you also don't indicate 
if you are using select= or match=

>Do anyone have some info to shed on this? And if 
>the construct doesn't exist, does it strike you 
>as a quite desirable optimization?

Please describe your requirement in more detail, 
possibly on the XSL list where there will be many 
people probably willing to help.

If you are using something like "//thing", then 
"//thing[1]" will not work for you because it 
will find the first child *at every level of the 
tree* ... the way around this is (//thing)[1], 
but as always, the use of "//" is terribly inefficient.

Let us know what you need in more detail.

. . . . . . . . . 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 at CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/t/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/t/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



More information about the topicmapmail mailing list