xsl-list
[Top] [All Lists]

## Re: [xsl] are multiple predicates same as boolean and

2008-11-21 09:16:25
```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(_at_)nag(_dot_)co(_dot_)uk> 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[(_at_)a='hi'][(_at_)b='hi..']
```
```
If X[(_at_)a='hi'] matches a node, then that node will become the context
node when evaluating [(_at_)b='hi..']

```
```would be same as
X[(_at_)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