Subject: Re: are multiple predicates same as boolean and
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Fri, 21 Nov 2008 14:13:56 +0000
|
Mukul Gandhi wrote:
> thanks David for the answer. I have few more questions
>
> On Fri, Nov 21, 2008 at 7:13 PM, David Carlisle <davidc@xxxxxxxxx> wrote:
>> X[position()=2][position()=2]
>
> I think this would mean, X[2][2] which will always be an empty sequence, i.e. ()
> am I correct?
>
> apart from this use case you cited, are all other forms equivalent
> (which do not involve positional predicates)?
No.
> like,
> X[@a='hi'][@b='hi..']
If X[@a='hi'] matches a node, then that node will become the context
node when evaluating [@b='hi..']
> would be same as
> X[@a='hi' and @b='hi..']
X is the context node here, so the predicate will be considering @b='hi..'
X[P][Q] is equivalent to X[P and Q] if and only if Q does not depend on
the context node at all.
To extend this:
X[P][Q][]...[Z] is equivalent to X[P and Q ... and Z] if and only if Q,
R, .. Z do not depend on the context node at all.
(In all cases, X is the context node when evaluating P, so P can depend
on the context node.)
Ronan
--
Ronan Klyne
Business Collaborator Developer
Tel: +44 01189 028518
ronan.klyne@xxxxxxxxxxx
www.groupbc.com
|