RE: semantic meaning of predicates
"Kay, Michael" <[email protected]> Tue, 5 Nov 2002 16:43:21 +0100
| Newsgroups | gmane.text.xml.xpath.general |
|---|---|
| Message-ID | <[email protected]> |
> Hi, I got one question regarding the semantic meaning of predicates. > For example, in message: > <a> > <b> > <id>1</id> > <id>2</id> > </b> > <b> > <id>3</id> > <id>4</id> > </b> > </a> > > 1. Is there a difference between (a)./a[b/id='1' and > b/id='2'] and (b)/a[b[id='1' and id='2'] Yes, there is a difference (though with this data, both give the same answer). (a) means "select the <a> element if it has a <b> with an <id> of 1 and if it also has a <b> with an <id> of 2". (b) means "select the <a> element if it has a <b> that has both an <id> of 1 and an <id> of 2". In other words, (a) will select the <a> element if the id="1" and id="2" are on different <b> children, while (b) requires them to be on the same child. Michael Kay