Subject: RE: Fwd: complex XPATH test
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 18 Jul 2001 02:25:21 +0100
|
> For starters, there has to be a better way of returning the
> position of a
> node within a node set than what I used here (the for-each
> block). Anyone
> have any ideas?
The only alternative that comes to mind is
count(xx:intersection($nodeset, preceding::node()))
where xx:intersection can be done either using an extension function or
using
$x[count(.|$y)=count($y)]
But your method is probably faster!
(The other approach is to ask whether you couldn't have determined/retained
the position at the time the node-set was being built in the first place).
> Second, why is it that ".=$curr" tests the value of each
> against each other,
> rather than a 'node id' or something? Wouldn't it make sense
> for that to
> actually check that the nodes are equivalent
It certainly would make sense for XPath to provide a node-identity test;
whether it would have been better to use the "=" operator for that purpose
is an unanswerable question.
Mike Kay
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
Nate Austin - Tue, 17 Jul 2001 15:05:21 -0400 (EDT)
- Wendell Piez - Tue, 17 Jul 2001 16:05:35 -0400 (EDT)
- Michael Kay - Tue, 17 Jul 2001 22:51:59 -0400 (EDT) <=
- David Carlisle - Wed, 18 Jul 2001 04:13:34 -0400 (EDT)
Adam Van Den Hoven - Wed, 18 Jul 2001 12:32:39 -0400 (EDT)
|
|