This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Fwd: complex XPATH test
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: Fwd: [xsl] complex XPATH test
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 18 Jul 2001 02:25:21 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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